結果
問題 | No.761 平均値ゲーム |
ユーザー | shimarut |
提出日時 | 2021-05-08 18:00:48 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 65 ms / 2,000 ms |
コード長 | 2,919 bytes |
コンパイル時間 | 3,074 ms |
コンパイル使用メモリ | 193,400 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-09-16 23:32:41 |
合計ジャッジ時間 | 7,920 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 2 ms
5,376 KB |
testcase_14 | AC | 1 ms
5,376 KB |
testcase_15 | AC | 1 ms
5,376 KB |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | AC | 1 ms
5,376 KB |
testcase_18 | AC | 1 ms
5,376 KB |
testcase_19 | AC | 2 ms
5,376 KB |
testcase_20 | AC | 1 ms
5,376 KB |
testcase_21 | AC | 2 ms
5,376 KB |
testcase_22 | AC | 2 ms
5,376 KB |
testcase_23 | AC | 1 ms
5,376 KB |
testcase_24 | AC | 1 ms
5,376 KB |
testcase_25 | AC | 2 ms
5,376 KB |
testcase_26 | AC | 1 ms
5,376 KB |
testcase_27 | AC | 2 ms
5,376 KB |
testcase_28 | AC | 1 ms
5,376 KB |
testcase_29 | AC | 2 ms
5,376 KB |
testcase_30 | AC | 2 ms
5,376 KB |
testcase_31 | AC | 1 ms
5,376 KB |
testcase_32 | AC | 2 ms
5,376 KB |
testcase_33 | AC | 43 ms
5,448 KB |
testcase_34 | AC | 49 ms
5,712 KB |
testcase_35 | AC | 6 ms
5,376 KB |
testcase_36 | AC | 28 ms
5,376 KB |
testcase_37 | AC | 41 ms
5,456 KB |
testcase_38 | AC | 40 ms
5,584 KB |
testcase_39 | AC | 52 ms
5,712 KB |
testcase_40 | AC | 51 ms
5,580 KB |
testcase_41 | AC | 48 ms
5,580 KB |
testcase_42 | AC | 53 ms
5,708 KB |
testcase_43 | AC | 11 ms
5,376 KB |
testcase_44 | AC | 34 ms
5,376 KB |
testcase_45 | AC | 47 ms
5,584 KB |
testcase_46 | AC | 25 ms
5,376 KB |
testcase_47 | AC | 27 ms
5,376 KB |
testcase_48 | AC | 5 ms
5,376 KB |
testcase_49 | AC | 52 ms
5,580 KB |
testcase_50 | AC | 8 ms
5,376 KB |
testcase_51 | AC | 5 ms
5,376 KB |
testcase_52 | AC | 6 ms
5,376 KB |
testcase_53 | AC | 54 ms
5,580 KB |
testcase_54 | AC | 32 ms
5,376 KB |
testcase_55 | AC | 55 ms
5,584 KB |
testcase_56 | AC | 18 ms
5,376 KB |
testcase_57 | AC | 56 ms
5,708 KB |
testcase_58 | AC | 10 ms
5,376 KB |
testcase_59 | AC | 50 ms
5,704 KB |
testcase_60 | AC | 17 ms
5,376 KB |
testcase_61 | AC | 58 ms
5,584 KB |
testcase_62 | AC | 56 ms
5,584 KB |
testcase_63 | AC | 13 ms
5,376 KB |
testcase_64 | AC | 51 ms
5,448 KB |
testcase_65 | AC | 23 ms
5,376 KB |
testcase_66 | AC | 5 ms
5,376 KB |
testcase_67 | AC | 18 ms
5,376 KB |
testcase_68 | AC | 8 ms
5,376 KB |
testcase_69 | AC | 46 ms
5,580 KB |
testcase_70 | AC | 30 ms
5,376 KB |
testcase_71 | AC | 13 ms
5,376 KB |
testcase_72 | AC | 7 ms
5,376 KB |
testcase_73 | AC | 19 ms
5,376 KB |
testcase_74 | AC | 12 ms
5,376 KB |
testcase_75 | AC | 25 ms
5,376 KB |
testcase_76 | AC | 17 ms
5,376 KB |
testcase_77 | AC | 43 ms
5,580 KB |
testcase_78 | AC | 29 ms
5,376 KB |
testcase_79 | AC | 11 ms
5,376 KB |
testcase_80 | AC | 10 ms
5,376 KB |
testcase_81 | AC | 8 ms
5,376 KB |
testcase_82 | AC | 36 ms
5,376 KB |
testcase_83 | AC | 65 ms
5,708 KB |
testcase_84 | AC | 61 ms
5,836 KB |
testcase_85 | AC | 61 ms
5,708 KB |
testcase_86 | AC | 63 ms
5,964 KB |
testcase_87 | AC | 61 ms
5,836 KB |
testcase_88 | AC | 60 ms
5,712 KB |
testcase_89 | AC | 62 ms
5,708 KB |
testcase_90 | AC | 60 ms
5,836 KB |
testcase_91 | AC | 59 ms
5,832 KB |
testcase_92 | AC | 59 ms
5,836 KB |
testcase_93 | AC | 2 ms
5,376 KB |
testcase_94 | AC | 1 ms
5,376 KB |
testcase_95 | AC | 55 ms
5,712 KB |
testcase_96 | AC | 58 ms
5,836 KB |
testcase_97 | AC | 59 ms
5,836 KB |
testcase_98 | AC | 42 ms
6,940 KB |
testcase_99 | AC | 59 ms
6,940 KB |
ソースコード
#pragma region #define _USE_MATH_DEFINES #include <iostream> #include <string> #include <algorithm> #include <cmath> #include <cstdlib> #include <vector> #include <map> #include <queue> #include <stack> #include <set> #include <list> #include <iomanip> #include <cstdint> #include <bitset> #include <sstream> #include <regex> #include <fstream> #include <array> #include <atcoder/all> using namespace atcoder; using mint = modint1000000007; //using mint = modint998244353; //using mint = modint; using namespace std; typedef long long ll; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using pint = pair<int, int>; using pll = pair<ll, ll>; using vpint = vector<pint>; using vvpint = vector<vpint>; using vmint = vector<mint>; using vvmint = vector<vmint>; //#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i)) #define rep(i, e) for (int(i) = 0; (i) < (e); ++(i)) #define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i)) #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #pragma region GCD ll gcd(ll a, ll b) { if (b == 0)return a; return gcd(b, a % b); } #pragma endregion #pragma region LCM ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } #pragma endregion #pragma region chmin template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } #pragma endregion #pragma region chmax template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } #pragma endregion #pragma region グリッド内チェック bool out(int x, int y, int h, int w) { if (x < 0 || h <= x || y < 0 || w <= y)return true; else return false; } #pragma endregion #pragma region Dijkstra vl dijkstra(vector<vector<pair<int, ll>>> v, int s) { ll INF = 1e18; int MAX = 1e6; vl res(MAX, INF); priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> q; q.push({ 0,s }); while (!q.empty()) { int now; ll d; tie(d, now) = q.top(); q.pop(); if (!chmin(res[now], d))continue; for (auto p : v[now]) { int next; ll c; tie(next, c) = p; if (res[next] <= res[now] + c)continue; q.push({ res[now] + c,next }); } } return res; } #pragma endregion #pragma endregion vector<double> a, s; map<pint, int> dp; int dfs(int l, int r, int t) { if (r - l < 1)return 0; if (r - l == 1)return t; if (dp[{l, r}])return dp[{l, r}]; if (a[l] == a[r - 1])return t; ll ave = ceil((s[r] - s[l]) / (r - l)); int m = lower_bound(all(a), ave) - a.begin(); if (m == l)return dp[{l, r}] = t; int nt = t % 2 + 1; if (dfs(l, m, nt) == t || dfs(m, r, nt) == t)return dp[{l, r}] = t; else return nt; } int main() { int n; cin >> n; rep(i, n) { double x; cin >> x; a.push_back(x); } s.push_back(0); rep(i, n)s.push_back(s[i] + a[i]); int res = dfs(0, n, 1); if (res == 1)cout << "First" << endl; else cout << "Second" << endl; }