結果
問題 |
No.761 平均値ゲーム
|
ユーザー |
![]() |
提出日時 | 2018-12-09 00:12:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 692 bytes |
コンパイル時間 | 689 ms |
コンパイル使用メモリ | 59,316 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-14 17:52:44 |
合計ジャッジ時間 | 4,750 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 96 WA * 4 |
ソースコード
#include <stdio.h> #include <algorithm> #include <map> using namespace std; map<pair<int, int>, bool> chk; long long A[100100],S[100100]; int N; bool go(int i, int j) { if (i > j) return false; if (i == j) return true; if (chk.count({i,j})) return chk[{i,j}]; bool &r = chk[{i,j}]; long long u = (S[j] - S[i-1]) / (j - i + 1); long long v = (S[j] - S[i-1] + j - i) / (j - i + 1); int p = upper_bound(A, A+N, u) - A; int q = lower_bound(A, A+N, v) - A - 1; if (!go(p, j) || !go(i, q)) r = true; else r = false; return r; } int main() { scanf ("%d",&N); for (int i=1;i<=N;i++){ scanf ("%lld",&A[i]); S[i] = S[i-1] + A[i]; } puts(go(1,N)?"First":"Second"); return 0; }