結果
| 問題 |
No.1109 調の判定
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-27 08:45:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 642 bytes |
| コンパイル時間 | 847 ms |
| コンパイル使用メモリ | 64,384 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-27 08:46:01 |
| 合計ジャッジ時間 | 2,288 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
main.cpp:15:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | rep(i,n)scanf("%d",&t[i]);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include<iostream>
#include<vector>
#include<cassert>
#define rep(i,n) for(i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int n;
int main(){
int i,j,k,ans=-1;
scanf("%d",&n);
vector<int> t(n);
rep(i,n)scanf("%d",&t[i]);
const int dt[]={0,2,4,5,7,9,11},MAX_D=7;
rep(i,12){
rep(j,n){
rep(k,MAX_D)if((i+dt[k])%12==t[j])break;
if(k==MAX_D)break;
}
if(j==n){
if(ans>=0){
puts("-1");
return 0;
}
ans=i;
}
}
printf("%d\n",ans);
return 0;
}