結果
| 問題 |
No.1109 調の判定
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-10 21:31:53 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 909 bytes |
| コンパイル時間 | 3,024 ms |
| コンパイル使用メモリ | 203,996 KB |
| 最終ジャッジ日時 | 2025-01-11 17:58:33 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
int main() {
ll n;
std::cin >> n;
map<ll,bool> ex;
for (int i = 0; i < n; i++) {
ll t;
std::cin >> t;
ex[t] = true;
}
vector<ll> aa = {0,2,4,5,7,9,11};
vector<ll> ans;
for (int i = 0; i < 12; i++) {
bool ok = true;
for (int j = 0; j < 12; j++) {
if(ex[j]){
bool okk = false;
for (auto e : aa) {
if(j==(e+i)%12){
okk = true;
}
}
if(!okk){
ok = false;
break;
}
}
}
if(ok) ans.push_back(i);
}
if(ans.size()==1){
std::cout << ans[0] << std::endl;
}else{
std::cout << -1 << std::endl;
}
}