結果
| 問題 |
No.1109 調の判定
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-10 21:42:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,062 bytes |
| コンパイル時間 | 1,462 ms |
| コンパイル使用メモリ | 166,732 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 08:32:42 |
| 合計ジャッジ時間 | 2,594 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
/**
* author: yuya1234
* created: 10.07.2020 21:27:37
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(x.begin(),x.end())
#define SORTD(x) sort(x.rbegin(),x.rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SZ(x) ll(x.size())
#define MEMSET(v, h) memset((v), h, sizeof(v))
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
int n;
cin>>n;
int t[n];
REP(i,n)cin>>t[i];
int ans=-1,cnt,aa=0;
REP(i,12)
{
cnt=0;
REP(j,n)
{
if((i)%12==t[j]
|| (2+i)%12==t[j]
|| (4+i)%12==t[j]
|| (5+i)%12==t[j]
|| (7+i)%12==t[j]
|| (9+i)%12==t[j]
|| (11+i)%12==t[j]) cnt++;
}
if(cnt==n)
{
ans=i;
aa++;
}
}
if(aa>1)cout<<-1<<endl;
else cout<<ans<<endl;
return 0;
}