結果
問題 | No.1109 調の判定 |
ユーザー |
![]() |
提出日時 | 2020-07-10 21:31:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 803 bytes |
コンパイル時間 | 799 ms |
コンパイル使用メモリ | 92,456 KB |
最終ジャッジ日時 | 2025-01-11 17:57:46 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std; using ll = long long; int main() { int n; cin >> n; int p[7] = { 0,2,4,5,7,9,11 }; int s[12] = {}; for (int i = 0; i < 7; i++) { s[p[i]]++; } int q[12] = {}; for (int i = 0; i < n; i++) { int t; cin >> t; q[t] = 1; } int r = -1; for (int j = 0; j < 12; j++) { int b = 1; for (int i = 0; i < 12; i++) { if (q[(i + j) % 12] && !s[i]) b = 0; } if (b) { if (r >= 0) { cout << -1 << endl; exit(0); } r = j; } } cout << r << endl; return 0; }