結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int long long
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

signed main() {
    int n;
    cin >> n;
    int t[n];
    rep (i, 0, n) cin >> t[i];
    set<int> st;
    rep (i, 0, 12) {
        bool chk = 1;
        rep (j, 0, n) {
            int s = (t[j] - i) % 12;
            if (s < 0) s += 12;
            if (s == 0 || s == 2 || s == 4 || s == 5 || s == 7 || s == 9 ||
                s == 11) {
                continue;
            } else {
                chk = 0;
                break;
            }
        }
        if (chk) st.insert (i);
    }
    if (st.size() == 1) {
        for (auto i : st) cout << i << "\n";
    } else {
        cout << "-1\n";
    }
}
0