結果

問題 No.1109 調の判定
ユーザー 👑 CleyL
提出日時 2021-11-14 10:37:56
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 72,868 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-29 09:24:31
合計ジャッジ時間 1,804 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>

using namespace std;

int tyo[7] = {0,2,4,5,7,9,11};
int main(){
  int n;cin>>n;
  set<int> A;
  for(int i = 0; n > i; i++){
    int x;cin>>x;
    A.insert(x);
  }
  int ans = -1;
  for(int i = 0; 12 > i; i++){
    int z = 0;
    for(int j = 0; 7 > j; j++){
      if(A.count((i+tyo[j])%12))z++;
    }
    if(z == A.size()){
      if(ans == -1){
        ans = i;
      }else{
        cout << -1 << endl;
        return 0;
      }
    }
  }
  cout << ans << endl;
}
0