Accepted
Code
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t>0){
t--;
int n;
cin >> n;
bitset<50048> bs;
bs[0]=1;
for(int i=0;i<n;i++){
int a;
cin >> a;
if(a<=n){
bs|=(bs<<a);
}
}
for(int i=n;i>=0;i--){
if(bs[i]){cout << i << "\n"; break;}
}
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1234 E. Roy and Maximum Removals
- Contest
- Happy New Year 2026
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2026-01-06 14:45:26
- Judged At
- 2026-01-06 14:45:26
- Judged By
- Score
- 100
- Total Time
- 104ms
- Peak Memory
- 764.0 KiB