結果
| 問題 | No.1109 調の判定 |
| コンテスト | |
| ユーザー |
misora192
|
| 提出日時 | 2020-07-10 22:29:18 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 453µs | |
| コード長 | 861 bytes |
| 記録 | |
| コンパイル時間 | 972 ms |
| コンパイル使用メモリ | 186,476 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-13 21:44:59 |
| 合計ジャッジ時間 | 3,069 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)
using namespace std;
typedef long long ll;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
set<int> st;
rep(i, n){
int t;
cin >> t;
st.insert(t);
}
int cnt = 0;
int x = -1;
rep(i, 12){
int u = 0;
if(st.count((i) % 12) == 1) u++;
if(st.count((i+2) % 12) == 1) u++;
if(st.count((i+4) % 12) == 1) u++;
if(st.count((i+5) % 12) == 1) u++;
if(st.count((i+7) % 12) == 1) u++;
if(st.count((i+9) % 12) == 1) u++;
if(st.count((i+11) % 12) == 1) u++;
if(u == n) {
cnt++;
x = i;
}
}
if(cnt == 1){
cout << x << endl;
}else{
cout << -1 << endl;
}
}
misora192