Submission #810711

#TimeUsernameProblemLanguageResultExecution timeMemory
810711RecursiveCoHacker (BOI15_hac)C++14
0 / 100
1 ms320 KiB
// CF template, version 3.0 #include <bits/stdc++.h> using namespace std; #define improvePerformance ios_base::sync_with_stdio(false); cin.tie(0) #define getTest int t; cin >> t #define eachTest for (int _var=0;_var<t;_var++) #define get(name) int (name); cin >> (name) #define out(o) cout << (o) #define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); } #define sortl(name) sort((name).begin(), (name).end()) #define rev(name) reverse((name).begin(), (name).end()) #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++) #define decision(b) if (b){out("YES");}else{out("NO");} #define int long long int signed main() { improvePerformance; get(n); getList(n, nums); int sz = (n + 1) / 2; int ans = 0; int pref = 0; vector<int> p; forto(n, i) { pref += nums[i]; p.push_back(pref); } forto(n, i) { int left, right; if (i >= sz) { left = p[i] - (i == sz? 0: p[i - sz - 1]); } else { left = p[i] + p[n - 1] - p[n - 1 - (sz - i - 1)]; } if (i <= n - sz) { right = p[i + sz - 1] - (i? p[i - 1]: 0); } else { right = p[n - 1] - p[i - 1] + p[sz - (n - i) - 1]; } ans = max(ans, min(left, right)); } out(ans); }

Compilation message (stderr)

hac.cpp: In function 'int main()':
hac.cpp:10:23: warning: unnecessary parentheses in declaration of 'n' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
hac.cpp:23:5: note: in expansion of macro 'get'
   23 |     get(n);
      |     ^~~
hac.cpp:12:40: warning: unnecessary parentheses in declaration of 'nums' [-Wparentheses]
   12 | #define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); }
      |                                        ^
hac.cpp:24:5: note: in expansion of macro 'getList'
   24 |     getList(n, nums);
      |     ^~~~~~~
hac.cpp:10:23: warning: unnecessary parentheses in declaration of 'a' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
hac.cpp:12:76: note: in expansion of macro 'get'
   12 | #define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); }
      |                                                                            ^~~
hac.cpp:24:5: note: in expansion of macro 'getList'
   24 |     getList(n, nums);
      |     ^~~~~~~
hac.cpp:15:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
      |                                   ^
hac.cpp:29:5: note: in expansion of macro 'forto'
   29 |     forto(n, i) {
      |     ^~~~~
hac.cpp:15:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
      |                                   ^
hac.cpp:33:5: note: in expansion of macro 'forto'
   33 |     forto(n, i) {
      |     ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...