結果
| 問題 |
No.1109 調の判定
|
| コンテスト | |
| ユーザー |
iqueue02
|
| 提出日時 | 2020-07-10 21:40:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 674 bytes |
| コンパイル時間 | 3,765 ms |
| コンパイル使用メモリ | 198,968 KB |
| 最終ジャッジ日時 | 2025-01-11 18:10:55 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
int a[] = {0, 2, 4, 5, 7, 9, 11};
int main() {
int n;
cin >> n;
vector<int> t(n);
rep(i,n) cin >> t[i];
vector<int> res;
for (int d = 0; d < 12; d++) {
set<int> st;
for (int i = 0; i < 7; i++) {
st.insert((d + a[i]) % 12);
}
bool ok = true;
for (int i = 0; i < n; i++) {
if (!st.count(t[i])) ok = false;
}
if (ok) res.emplace_back(d);
}
if (res.size() != 1) cout << -1 << endl;
else cout << res.front() << endl;
return 0;
}
iqueue02