QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#438367 | #5475. Make a Loop | grass8cow# | WA | 1ms | 4140kb | C++17 | 393b | 2024-06-10 16:43:12 | 2024-06-10 16:43:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,a[110];
const int V=1e6;
bitset<501000>f[110];
int main(){
scanf("%d",&n);int h=0;
for(int i=1;i<=n;i++)scanf("%d",&a[i]),h+=a[i];
f[0][0]=1;
int t=(n/4)*2;
for(int i=1;i<=n;i++)
for(int j=min(i-1,t);j>=0;j--)f[j+1]|=(f[j]<<a[i]);
if(!(h&1)&&f[t][h/2])puts("Yes");else puts("No");
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 4140kb
input:
4 1 1 1 1
output:
Yes
result:
ok single line: 'Yes'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
6 1 3 1 3 1 3
output:
Yes
result:
ok single line: 'Yes'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 4052kb
input:
6 2 2 1 1 1 1
output:
Yes
result:
wrong answer 1st lines differ - expected: 'No', found: 'Yes'