結果

問題 No.1109 調の判定
ユーザー syomusyomu
提出日時 2020-07-10 21:39:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,025 bytes
コンパイル時間 1,721 ms
コンパイル使用メモリ 163,872 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 16:21:44
合計ジャッジ時間 2,800 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 WA -
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 2 ms
5,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 WA -
testcase_43 AC 2 ms
5,376 KB
testcase_44 AC 2 ms
5,376 KB
testcase_45 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:44:24: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   44 |     if(cnt==n) cout << ans << endl;
      |                        ^~~
main.cpp:20:23: note: 'ans' was declared here
   20 |     int t[n], chk[7], ans, cnt=0;
      |                       ^~~

ソースコード

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, cnt=0;
    rep(i, n){
        cin >> t[i];
        chk[i] = 0;
    }
    rep(i, n){
        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){
            ans = t[i];
            break;
        }
        cnt = 0;
    }
    if(cnt==n) cout << ans << endl;
    else cout << "-1" << endl;
    return 0;
}
0