結果

問題 No.1109 調の判定
ユーザー 🍮かんプリン
提出日時 2020-07-10 21:35:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 878 bytes
コンパイル時間 2,065 ms
コンパイル使用メモリ 159,096 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 08:06:28
合計ジャッジ時間 3,276 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.07.10 21:35:02
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

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++) {
        bool ok = true;
        for (int j = 0; j < n; j++) {
            if (i % 12 == t[j] || (i + 2) % 12 == t[j] || (i + 4) % 12 == t[j] || (i + 5) % 12 == t[j] || (i + 7) % 12 == t[j] || (i + 9) % 12 == t[j] || (i + 11) % 12 == t[j]) {
            }
            else {
                ok = false;
                break;
            }
        }
        if (ok && ans != -1) {
            cout << -1 << endl;
            return 0;
        }
        else if (ok) {
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}
0