QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#817024 | #9870. Items | Coffins | WA | 1ms | 3620kb | C++14 | 529b | 2024-12-16 19:49:28 | 2024-12-16 19:49:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=55;
int n,m;
int f[N][N*N];
void solve()
{
cin>>n>>m;f[0][0]=1;
for(int i=1;i<=n;i++)
for(int j=0;j<=m;j++)
f[i][j]=0;
for(int i=1;i<=n;i++)
{
int c;cin>>c;
for(int j=1;j<=i;j++)
for(int t=c;t<=m;t++)
f[j][t]|=f[j-1][t-c];
}if(f[n][m])cout<<"Yes\n";
else cout<<"No\n";
}
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t;cin>>t;while(t--)solve();return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
input:
4 5 25 0 0 0 0 5 5 11 4 4 4 5 5 5 0 1 2 3 4 5 5 25 0 1 2 3 4
output:
Yes No No No
result:
ok 4 token(s): yes count is 1, no count is 3
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3620kb
input:
1314 1 0 0 1 0 1 1 1 0 1 1 1 2 0 0 0 2 0 0 1 2 0 0 2 2 0 1 0 2 0 1 1 2 0 1 2 2 0 2 0 2 0 2 1 2 0 2 2 2 1 0 0 2 1 0 1 2 1 0 2 2 1 1 0 2 1 1 1 2 1 1 2 2 1 2 0 2 1 2 1 2 1 2 2 2 2 0 0 2 2 0 1 2 2 0 2 2 2 1 0 2 2 1 1 2 2 1 2 2 2 2 0 2 2 2 1 2 2 2 2 2 3 0 0 2 3 0 1 2 3 0 2 2 3 1 0 2 3 1 1 2 3 1 2 2 3 2 0...
output:
Yes No No Yes Yes No No Yes No No Yes No No No Yes No Yes No No No No No No Yes Yes No Yes No Yes Yes No No No No No No Yes No Yes No No No Yes No No Yes No No Yes Yes No No No Yes No No No Yes No No No Yes No No No Yes No No No Yes No No No Yes No No No Yes No No No Yes No No No Yes No No No Yes No...
result:
wrong answer expected YES, found NO [6th token]