結果
| 問題 |
No.1109 調の判定
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-10 21:30:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 515 bytes |
| コンパイル時間 | 1,865 ms |
| コンパイル使用メモリ | 201,256 KB |
| 最終ジャッジ日時 | 2025-01-11 17:55:24 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> A(N);
for(int i=0; i<N; i++) cin >> A[i];
vector<int> ans;
for(int d=0; d<12; d++){
set<int> st;
for(int i : {0, 2, 4, 5, 7, 9, 11}) st.insert((d+i)%12);
bool ok = true;
for(int a : A) if(!st.count(a)) ok = false;
if(ok) ans.push_back(d);
}
if(ans.size() == 1){
cout << ans[0] << endl;
}else{
cout << -1 << endl;
}
return 0;
}