QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#212225 | #5475. Make a Loop | RedreamMer | WA | 3ms | 11788kb | C++14 | 1.1kb | 2023-10-13 12:29:10 | 2023-10-13 12:29:11 |
Judging History
answer
// #pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define PB emplace_back
// #define int long long
#define ll long long
#define vi vector<int>
#define siz(a) ((int) ((a).size()))
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
void print(vi n) {rep(i, 0, siz(n) - 1) cerr << n[i] << " \n"[i == siz(n) - 1];}
const int N = 1e6;
int T, a, f[N + 5][2];
signed main() {
// freopen("track.in", "r", stdin);
// freopen("track.out", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
for(cin >> T; T--; ) {
cin >> a;
memset(f, 0, sizeof(f));
f[0][0] = 1;
int x, sum = 0;
rep(i, 1, a) {
cin >> x;
assert(x);
sum += x;
per(j, sum, x) rep(k, 0, 1) f[j][k] = min(4, f[j][k] + f[j - x][k ^ 1]);
}
bool is = !(sum & 1) && f[sum / 2][0] >= 4;
is ? cout << "Yes\n" : cout << "No\n";
}
return cerr << endl << 1.0 * clock() / CLOCKS_PER_SEC << endl, 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 11788kb
input:
4 1 1 1 1
output:
No No No No
result:
wrong answer 1st lines differ - expected: 'Yes', found: 'No'