結果
| 問題 |
No.1109 調の判定
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-21 21:03:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 601 bytes |
| コンパイル時間 | 1,483 ms |
| コンパイル使用メモリ | 169,756 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-21 13:05:23 |
| 合計ジャッジ時間 | 2,602 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int64_t n;
cin >> n;
vector<int64_t> t(n), ans;
for (int64_t i = 0; i < n; i++) cin >> t[i];
int64_t d[7] = {0, 2, 4, 5, 7, 9, 11};
for (int64_t i = 0; i < 12; i++) {
bool flag = true;
for (int64_t j = 0; j < n; j++) {
bool check = false;
for (int64_t k = 0; k < 7; k++) if (t[j] % 12 == (i + d[k]) % 12) check = true;
if (!check) {
flag = false;
break;
}
}
if (flag) ans.push_back(i);
}
if (ans.size() == 1) cout << ans[0] << '\n';
else cout << "-1\n";
return 0;
}