結果
問題 |
No.1109 調の判定
|
ユーザー |
![]() |
提出日時 | 2020-07-11 00:08:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,100 bytes |
コンパイル時間 | 1,322 ms |
コンパイル使用メモリ | 107,904 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 20:23:36 |
合計ジャッジ時間 | 2,383 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include<iostream> #include<algorithm> #include<vector> #include<string> #include<utility> #include<map> #include<set> #include<queue> #include<stack> #include<functional> #include<math.h> #include<random> using namespace std; #define N (1000000000+7) #define M 998244353 #define INF 1e16 typedef long long ll; typedef pair<int,int> P; const int inf = (int)1e9; ll A(ll x){ if(x>=0)return x; else return -x; } ll gcd(ll a, ll b) { if (b > a) { ll tmp = b; b = a; a = tmp; } if (a%b == 0)return b; else return gcd(b, a%b); } map<int,int>mp; int main(void){ int n; cin>>n; vector<int>t(n); for(int i=0;i<n;i++)cin>>t[i]; int ans = -1; for(int d=0;d<12;d++){ set<int>s; s.insert(d%12); s.insert((d+2)%12); s.insert((d+4)%12); s.insert((d+5)%12); s.insert((d+7)%12); s.insert((d+9)%12); s.insert((d+11)%12); bool flag = true; for(int i=0;i<n;i++){ if(s.count(t[i])==0){ //cout<<d<<" "<<t[i]<<endl; flag = false; } } if(flag){ if(ans==-1)ans=d; else{ ans = -1; break; } } } cout<<ans<<endl; return 0; }