結果

問題 No.1109 調の判定
ユーザー minimamu21
提出日時 2020-07-11 16:53:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 676 bytes
コンパイル時間 1,474 ms
コンパイル使用メモリ 172,320 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-13 05:39:05
合計ジャッジ時間 2,650 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
    int n;
    cin>>n;
    vector<bool>ok(12,true);
    vector<int>a[12];
    int d[7]={0,2,4,5,7,9,11};
    rep(i,12)rep(j,7){
        a[i].push_back((i+d[j])%12);
    }
    rep(i,n){
        int t;
        cin>>t;
        rep(j,12){
            bool exist=false;
            rep(k,7){
                if(a[j][k]==t)exist=true;
            }
            if(!exist)ok[j]=false;
        }
    }
    int cnt=0;
    rep(i,12)if(ok[i])cnt++;
    if(cnt==1){
        rep(i,12)if(ok[i])cout<<i<<endl;
    }
    else cout<<-1<<endl;
}
0