結果

問題 No.761 平均値ゲーム
ユーザー cotton_fn_
提出日時 2019-07-01 20:57:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 1,314 bytes
コンパイル時間 1,076 ms
コンパイル使用メモリ 109,396 KB
最終ジャッジ日時 2025-01-07 05:48:42
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘bool f(i64, i64)’:
main.cpp:49:13: warning: ‘m’ may be used uninitialized [-Wmaybe-uninitialized]
   49 |   return (!f(l, m)) || (!f(m, r));
      |            ~^~~~~~
main.cpp:44:7: note: ‘m’ was declared here
   44 |   i64 m;
      |       ^

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x)
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0)
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs
i64 n;
vector<i64> a;
// [l, r)
bool f(i64 l, i64 r) {
i64 k = r - l;
if (k == 1) return true;
if (k == 0) return false;
i64 sum = 0;
for (i64 i = l; i < r; ++i) sum += a[i];
i64 m;
for (i64 i = l; i < r; ++i) {
m = i;
if (k * a[i] >= sum) break;
}
return (!f(l, m)) || (!f(m, r));
}
int main() {
cin >> n;
read_n(a, n);
bool win = f(0, n);
cout << (win ? "First\n" : "Second\n");
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0