結果

問題 No.1109 調の判定
ユーザー goto_isyuku
提出日時 2020-07-10 21:31:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,004 bytes
コンパイル時間 1,521 ms
コンパイル使用メモリ 169,688 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 07:54:59
合計ジャッジ時間 2,709 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define ALL(V) (V).begin(),(V).end()

using namespace std;
typedef long long ll;

const double PI = 3.1415926535897932384626;
const ll MODN = 1000000007;
const ll MODN2 = 998244353;
const double EPS = 1e-10;

int main(){

    int n;
    cin >> n;

    vector<int> t(n);

    rep(i, n) cin >> t[i];

    int ans = -1;
    vector<int> diff = {0, 2, 4, 5, 7, 9, 11};

    rep(i, 12){
        bool tmp = true;

        rep(j, n){
            bool tmp2 = false;
            rep(k, 7){
                if(t[j] == (i + diff[k]) % 12){
                    tmp2 = true;
                    break;
                }
            }

            if(!tmp2){
                tmp = false;
                break;
            }
        }

        if(tmp){
            if(ans == -1){
                ans = i;
            }else{
                ans = -1;
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}
0