結果
| 問題 |
No.1109 調の判定
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-06 20:02:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 722 bytes |
| コンパイル時間 | 2,561 ms |
| コンパイル使用メモリ | 201,368 KB |
| 最終ジャッジ日時 | 2025-01-15 20:05:09 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()
const double PI = acos(-1);
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<int> T(n);
REP (i, n) cin >> T[i];
vector<int> ret;
vector<int> diff {0, 2, 4, 5, 7, 9, 11};
REP (i, 12) {
set<int> st;
for (int d: diff) {
st.insert((i + d) % 12);
}
bool ck = true;
for (int t: T) {
ck &= st.count(t);
}
if (ck)
ret.push_back(i);
}
if (ret.size() == 1)
cout << ret[0] << endl;
else
cout << -1 << endl;
return 0;
}