結果

問題 No.1109 調の判定
ユーザー ぷら
提出日時 2021-03-14 15:53:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 662 bytes
コンパイル時間 1,582 ms
コンパイル使用メモリ 169,580 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-06 05:43:53
合計ジャッジ時間 3,065 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const int sound[7] = {0,2,4,5,7,9,11};

int main() {
    int N;
    cin >> N;
    vector<int>T(N);
    for(int i = 0; i < N; i++) {
        cin >> T[i];
    }
    int ans = -1;
    for(int i = 0; i < 12; i++) {
        int cnt = 0;
        for(int j = 0; j < N; j++) {
            for(int k = 0; k < 7; k++) {
                if((i+sound[k])%12 == T[j]) {
                    cnt++;
                }
            }
        }
        if(cnt == N) {
            if(ans != -1) {
                cout << -1 << endl;
                return 0;
            }
            ans = i;
        }
    }
    cout << ans << endl;
}
0