結果
| 問題 |
No.1109 調の判定
|
| コンテスト | |
| ユーザー |
rgkb0303
|
| 提出日時 | 2020-07-11 03:29:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,042 bytes |
| コンパイル時間 | 1,608 ms |
| コンパイル使用メモリ | 169,748 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 02:26:20 |
| 合計ジャッジ時間 | 3,077 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> t(n);
for (int i = 0; i < n; i++) {
cin >> t.at(i);
}
if (n <= 2 || n >= 8) {
cout << -1 << endl;
}
else {
int answer = -1;
bool first = false;
bool second = false;
for (int i = 0; i < 12; i++) {
for (int j = 0; j < n; j++) {
int x = (t.at(j) - i + 12) % 12;
if (x != 0 && x != 2 && x != 4 && x != 5 && x != 7 && x != 9 && x != 11) {
break;
}
else if (j == n - 1) {
if (first) {
second = true;
}
answer = i;
first = true;
}
}
if (second) {
cout << -1 << endl;
break;
}
else if (i == 11) {
cout << answer << endl;
}
}
}
}
rgkb0303