提出 #62045088
ソースコード 拡げる
#ifndef ATCODER // AtCoder 環境でない場合はデバッグモードを有効にする. コンパイルにすごく時間がかかる!
#define _GLIBCXX_DEBUG // out of rangeを検出してくれる。#include<bits/stdc++.h>の前に記述する必要あり
#endif
#include<bits/stdc++.h>
using namespace std;
struct IOSetup {
IOSetup() {
// 実行が高速化するコード
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
// 小数点以下10桁まで(四捨五入)
cout << fixed << setprecision(10);
}
} iosetup;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, b, a) for (int i = b; i > a; i--)
#define rep3(i, a, b, d) for (int i = a; i < b; i+=d)
#define rrep3(i, b, a, d) for (int i = b; i > a; i-=d)
#define between(x, a, b) (((a) <= (x)) && ((x) < (b)))
// Template function to print various container types
template<typename Container>
void print(const Container& a) {
cout << "{";
bool first = true;
for (const auto& i : a) {
if (!first) {
cout << ",";
}
cout << i;
first = false;
}
cout << "}" << endl;
}
// Template function to print 2D vector
template<typename T>
void printvec2d(const vector<vector<T>>& a) {
size_t rows = a.size();
for (size_t i = 0; i < rows; ++i) {
print(a[i]);
}
}
// Template function to print 3D vector
template<typename T>
void printvec3d(const vector<vector<vector<T>>>& a) {
size_t depth = a.size();
for (size_t i = 0; i < depth; ++i) {
printvec2d(a[i]);
cout << endl;
}
}
int main() {
int n;
cin >> n;
vector<long long> a(n);
rep(i, n) cin >> a[i];
long long l0 = a[0] / gcd(a[0], a[1]), l1 = a[1] / gcd(a[0], a[1]);
rep(i, n - 1) {
long long r0 = a[i] / gcd(a[i], a[i + 1]), r1 = a[i + 1] / gcd(a[i], a[i + 1]);
if (!(l0 == r0 && l1 == r1)) {
cout << "No";
return 0;
}
}
cout << "Yes";
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Geometric Sequence |
| ユーザ | kazuki00 |
| 言語 | C++ 23 (gcc 12.2) |
| 得点 | 200 |
| コード長 | 2117 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 3608 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example_00.txt, example_01.txt, example_02.txt |
| All | example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| example_00.txt | AC | 1 ms | 3488 KiB |
| example_01.txt | AC | 1 ms | 3384 KiB |
| example_02.txt | AC | 1 ms | 3524 KiB |
| hand_00.txt | AC | 1 ms | 3432 KiB |
| hand_01.txt | AC | 1 ms | 3476 KiB |
| hand_02.txt | AC | 1 ms | 3420 KiB |
| hand_03.txt | AC | 1 ms | 3444 KiB |
| hand_04.txt | AC | 1 ms | 3380 KiB |
| hand_05.txt | AC | 1 ms | 3476 KiB |
| hand_06.txt | AC | 1 ms | 3472 KiB |
| hand_07.txt | AC | 1 ms | 3488 KiB |
| hand_08.txt | AC | 1 ms | 3468 KiB |
| hand_09.txt | AC | 1 ms | 3476 KiB |
| hand_10.txt | AC | 1 ms | 3480 KiB |
| hand_11.txt | AC | 1 ms | 3532 KiB |
| random_00.txt | AC | 1 ms | 3424 KiB |
| random_01.txt | AC | 1 ms | 3396 KiB |
| random_02.txt | AC | 1 ms | 3436 KiB |
| random_03.txt | AC | 1 ms | 3416 KiB |
| random_04.txt | AC | 1 ms | 3412 KiB |
| random_05.txt | AC | 1 ms | 3536 KiB |
| random_06.txt | AC | 1 ms | 3608 KiB |
| random_07.txt | AC | 1 ms | 3536 KiB |
| random_08.txt | AC | 1 ms | 3396 KiB |
| random_09.txt | AC | 1 ms | 3476 KiB |
| random_10.txt | AC | 1 ms | 3476 KiB |
| random_11.txt | AC | 1 ms | 3468 KiB |
| random_12.txt | AC | 1 ms | 3396 KiB |
| random_13.txt | AC | 1 ms | 3404 KiB |
| random_14.txt | AC | 1 ms | 3460 KiB |