QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#793421 | #9588. 可重集合 | jiangzhihui# | TL | 1ms | 3956kb | C++14 | 550b | 2024-11-29 19:42:20 | 2024-11-29 19:42:20 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int M=5e5+5;
bitset<M> f;
multiset<int> st;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
while(n--){
int opt,x;
cin>>opt>>x;
if(opt==1){
st.insert(x);
}else{
auto t=st.find(x);
st.erase(t);
}
f&=0;
f.set(0,1);
for(auto v:st){
f|=f<<v;
}
cout<<f.count()-1<<'\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3956kb
input:
4 1 100 1 999 1 10 2 100
output:
1 3 7 3
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3728kb
input:
7 1 1 1 2 1 1 1 4 1 5 2 1 2 4
output:
1 3 4 8 13 12 7
result:
ok 7 lines
Test #3:
score: -100
Time Limit Exceeded
input:
5000 1 132200 2 132200 1 304115 1 119865 1 7246 1 23773 1 6583 2 6583 2 119865 1 13380 1 38501 2 7246 1 115933 2 115933 1 52649 1 48334 1 2824 1 9919 2 2824 1 9007 1 309 2 304115 1 41830 2 9919 1 153380 1 100177 1 2775 2 13380 1 2913 1 16644 1 1437 2 9007 2 309 1 10921 1 1853 1 170 2 23773 1 561 1 2...