結果
問題 |
No.1109 調の判定
|
ユーザー |
|
提出日時 | 2020-07-10 21:25:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 760 bytes |
コンパイル時間 | 1,665 ms |
コンパイル使用メモリ | 174,416 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 07:39:09 |
合計ジャッジ時間 | 2,929 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr char newl = '\n'; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector<int> t(n); for (int i = 0; i < n; i++) { cin >> t[i]; } vector<int> ans; for (int i = 0; i < 12; i++) { set<int> s; for (int j : {0, 2, 4, 5, 7, 9, 11}) { s.insert((i + j) % 12); } bool f = true; for (int j = 0; j < n; j++) { if (s.find(t[j]) == s.end()) { f = false; break; } } if (!f) continue; ans.push_back(i); } cout << (ans.size() != 1 ? -1 : ans[0]) << newl; return 0; }