結果
問題 |
No.1109 調の判定
|
ユーザー |
![]() |
提出日時 | 2020-07-10 21:54:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,802 bytes |
コンパイル時間 | 1,011 ms |
コンパイル使用メモリ | 112,892 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 08:59:18 |
合計ジャッジ時間 | 2,215 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <vector> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <queue> #include <ctime> #include <cassert> #include <complex> #include <string> #include <cstring> #include <chrono> #include <random> #include <queue> #include <bitset> #include <stack> #include <functional> #ifdef LOCAL #define eprintf(...) fprintf(stderr, __VA_ARGS__) #else #define eprintf(...) 42 #endif #define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i) #define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__) #define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i) #define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__) #define all(x) (x).begin(), (x).end() template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } // template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair <int,int> P; typedef long double ld; int main (void) { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> t(n); rep (i, t.size()) cin >> t[i]; vector<int> ok; rep (i, 12) { bool ye = true; for (int j : t) { bool y3 = false; for (int k : {0, 2, 4, 5, 7, 9, 11}) { if ((i + k) % 12 == j) y3 = true; } ye &= y3; } if (ye) ok.push_back(i); } if (ok.size() != 1) cout << "-1\n"; else cout << ok[0] << "\n"; return 0; }