QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#188815 | #7501. Simple Game | zhoukangyang# | WA | 19ms | 5704kb | C++11 | 955b | 2023-09-26 14:41:56 | 2023-09-26 14:41:56 |
Judging History
answer
#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define vi vector < int >
#define sz(a) ((int) (a).size())
#define ll long long
#define ull unsigned long long
#define me(a, x) memset(a, x, sizeof(a))
using namespace std;
const int N = 1 << 20;
int n, a[2][N];
void Main() {
cin >> n;
L(o, 0, 1) {
L(i, 1, n) {
cin >> a[o][i];
}
}
ll ans = 0;
ll sum = 0;
L(o, 0, 1) L(i, 1, n / 2) sum += a[o][i];
ans = sum, sum = 0;
L(i, 1, n) sum += a[0][i];
ans = max(ans, sum), sum = 0;
if(n > 1) {
L(o, 0, 1) L(i, 1, n / 2 + 1) sum += a[o][i];
}
ans = min(ans, sum);
cout << ans << '\n';
}
int main() {
ios :: sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int t; cin >> t; while(t--) Main();
return 0;
}
/*
4
2
1 4
2 1
3
1 1 4
5 1 4
4
1 9 4 9
1 0 0 1
7
3 1 4 1 5 9 2
6 5 3 5 8 9 8
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5696kb
input:
4 2 1 4 2 1 3 1 1 4 5 1 4 4 1 9 4 9 1 0 0 1 7 3 1 4 1 5 9 2 6 5 3 5 8 9 8
output:
5 6 15 25
result:
ok 4 number(s): "5 6 15 25"
Test #2:
score: -100
Wrong Answer
time: 19ms
memory: 5704kb
input:
42433 3 417100972 410793626 16460156 310855598 294966258 483255444 1 957745962 947824037 1 445126120 888003539 1 580400325 275543008 1 754900842 891210463 10 998208800 656500425 488610806 666154179 263153117 196838149 441444097 6047510 848944483 189661679 599149426 756456402 979588669 522525295 6566...
output:
844354754 0 0 0 0 6587041421 5590449872 0 669469759 5159364163 0 0 1357091819 1618273431 0 1529438455 1869646563 7408247323 1335203346 917908198 2606803111 736868540 3235890337 989833401 0 0 1035529151 1902546245 0 1385229202 0 1839806029 925204119 2441791881 1317479131 3501178820 0 1055218317 0 0 7...
result:
wrong answer 2nd numbers differ - expected: '957745962', found: '0'