QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#277869#4377. BackpackchunzhifengWA 228ms3724kbC++14726b2023-12-07 01:13:452023-12-07 01:13:46

Judging History

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

  • [2023-12-07 01:13:46]
  • 评测
  • 测评结果:WA
  • 用时:228ms
  • 内存:3724kb
  • [2023-12-07 01:13:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define endl "\n"
#define PII pair<int,int>
const ll INF=0x3f3f3f3f;//3f3f3f3f;
const int mod=1e9+7;
const int N=2e6+5;
bitset<1035>f[2][1035];
void solve(){
	int n,m; cin>>n>>m;
	for(int i=1;i<2055;i++) f[0][i].reset();
	f[0][0][0]=1;
	int cur=1,lst=0;
	for(int i=1;i<=n;i++){
		int v,w; cin>>v>>w;
		for(int j=0;j<1024;j++) f[cur][j]=f[lst][j];
		for(int j=0;j<1024;j++){
			f[cur][j]|=f[lst][j^w]<<v;
		} swap(lst,cur);
	}
	int ans=1023;
	while(ans>=0&&!f[lst][ans][m]) ans--;
	cout<<ans<<endl;
}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int T=1; cin>>T;
    while(T--) solve();
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 228ms
memory: 3724kb

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
1011
1017
1023
1023
1023
1023
1023
1023
577

result:

wrong answer 3rd lines differ - expected: '-1', found: '1017'