QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#50691#4377. BackpackchenshigeWA 247ms3936kbC++629b2022-09-28 17:11:332022-09-28 17:11:37

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-28 17:11:37]
  • 评测
  • 测评结果:WA
  • 用时:247ms
  • 内存:3936kb
  • [2022-09-28 17:11:33]
  • 提交

answer

// Nothing is Given, Everything is Earned.
#include<bits/stdc++.h>
using namespace std;

static const int N=1024;
int n,m,a[N],b[N];
bitset<N> f[2][N];
int main()
{
   int T; cin>>T;
   while(T--)
   {
      scanf("%d%d",&n,&m);
      for(int i=1;i<=n;i++) scanf("%d%d",a+i,b+i);
      f[0][0][0]=1;
      for(int i=1;i<=n;i++)
      {
         for(int j=0;j<1024;j++)
            f[1][j]=(f[0][j]|f[0][j^b[i]]<<a[i]);
         swap(f[0],f[1]);
      }
      int ans=-1;
      for(int i=1023;~i;i--)
      {
         if(f[0][i][m]) ans=max(ans,i);
      }
      cout<<ans<<endl;
   }
   return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 247ms
memory: 3936kb

input:

10
1023 401
179 441
416 951
420 984
1013 984
683 914
407 984
96 523
374 190
974 190
739 441
518 523
194 984
415 523
149 441
235 984
809 441
469 441
436 919
437 919
7 919
818 984
962 190
37 919
371 523
417 914
431 914
213 190
340 441
254 919
223 951
123 190
339 951
322 441
218 441
284 919
533 190
187...

output:

1021
1023
1023
1023
1023
1023
1023
1023
1023
1023

result:

wrong answer 2nd lines differ - expected: '1011', found: '1023'