結果
| 問題 |
No.1109 調の判定
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2019-10-14 02:49:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 848 bytes |
| コンパイル時間 | 1,671 ms |
| コンパイル使用メモリ | 168,340 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 22:14:21 |
| 合計ジャッジ時間 | 3,142 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
bool iscenter(const int i, const vector<int> &t) {
for (auto x : t) {
switch ((x - i + 12) % 12) {
case 1:
case 3:
case 6:
case 8:
case 10:
return false;
}
}
return true;
}
int main() {
int n;
cin >> n;
assert(1 <= n && n <= 12);
vector<int> t(n);
for (int i = 0; i < n; i++) {
cin >> t.at(i);
assert(0 <= t.at(i) && t.at(i) < 12);
if (i > 0) assert(t.at(i) > t.at(i - 1));
}
int ok = -1;
for (int i = 0; i < 12; i++) {
if (iscenter(i, t)) {
if (ok == -1) {
ok = i;
} else {
cout << -1 << endl;
return 0;
}
}
}
cout << ok << endl;
}
trineutron