結果

問題 No.1109 調の判定
ユーザー merom686
提出日時 2020-07-11 00:03:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 703 bytes
コンパイル時間 746 ms
コンパイル使用メモリ 89,696 KB
最終ジャッジ日時 2025-01-11 19:20:55
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;

    int x = 0;
    for (int t : { 0, 2, 4, 5, 7, 9, 11 }) {
        x ^= 1 << t;
    }
    x = x ^ x << 12;

    int y = 0;
    for (int i = 0; i < n; i++) {
        int t;
        cin >> t;

        y ^= 1 << t;
    }

    int r = -1;
    for (int j = 0; j < 12; j++) {
        if (!(y << j & ~x)) {
            if (r >= 0) {
                cout << -1 << endl;
                exit(0);
            }
            r = (12 - j) % 12;
        }
    }

    cout << r << endl;

    return 0;
}
0