Untitled
user_2485637
plain_text
2 years ago
678 B
8
Indexable
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int c ;
cin>>c;
int n;
cin>>n;
multiset<long long>ms;
for(int i=0;i<n;i++){
long long a1;
cin>>a1;
long long w1;
cin>>w1;
if(c>0){
ms.insert((a1+w1));
c--;
cout<<1<<" ";
}
else if(a1>=*ms.begin()){
cout<<1<<" ";
ms.erase(*ms.begin());
ms.insert((a1+w1));
}
else{
cout<<0<<" ";
}
}
return 0;
}Editor is loading...
Leave a Comment