結果

問題 No.1109 調の判定
ユーザー syomusyomu
提出日時 2020-07-10 21:57:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,175 bytes
コンパイル時間 1,655 ms
コンパイル使用メモリ 165,524 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-01 17:48:59
合計ジャッジ時間 2,921 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 1 ms
4,376 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 1 ms
4,376 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 WA -
testcase_43 AC 1 ms
4,384 KB
testcase_44 AC 1 ms
4,376 KB
testcase_45 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h> //全てのヘッダファイルをインクルード

//ループ
#define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ

//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;

using namespace std;

//#include "./lib/generic/search.h"

int main(){
    int n;
    cin >> n;
    int t[n], chk[7], ans=0, cnt=0, cnt2=0;
    rep(i, n){
        cin >> t[i];
        chk[i] = 0;
    }
    rep(i, n){
        cnt = 0;
        chk[0] = t[i]%12;
        chk[1] = (t[i]+2)%12;
        chk[2] = (t[i]+4)%12;
        chk[3] = (t[i]+5)%12;
        chk[4] = (t[i]+7)%12;
        chk[5] = (t[i]+9)%12;
        chk[6] = (t[i]+11)%12;
        rep(j, n){
            rep(k, 7){
                if(t[j]==chk[k]) cnt++;
            }
        }
        if(cnt==n && cnt2==0){
            cnt2 = 1;
            ans = t[i];
            cnt = 0;
        }
        if(cnt==n && cnt2==1){
            cnt2 = 2;
            ans = -1;
            break;
        }
    }
    if(cnt2==1) cout << ans << endl;
    else cout << "-1" << endl;
    return 0;
}
0