結果

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

ソースコード

diff #

#include <bits/stdc++.h>

using ll = long long;

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    scanf("%d", &n);

    vector<int> s0{0,2,4,5,7,9,11};
    vector<int> t(n);
    for (int i = 0; i < n; ++i)
        scanf("%d", &t[i]);

    sort(t.begin(), t.end());
    int res{ -1 };
    vector<int> s(s0);
    for (int i = 0; i < 12; ++i)
    {
        if (includes(s.begin(), s.end(), t.begin(), t.end()))
        {
            if (res != -1)
            {
                res = -1;
                break;
            }
            res = i;
        }

        s.clear();
        for (size_t j = 0; j < s0.size(); ++j)
            s.push_back((s0[j] + i + 1) % 12);

        sort(s.begin(), s.end());
    }

    printf("%d\n",res);

    return 0;
}
0