# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
554343 | PLML | Pod starim krovovima (COCI20_psk) | C++14 | 1 ms | 304 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
vector<int> a;
int n,i = 0,t,z,cnt = 0;cin >> n;
for(int i = 0;i<n;i++){
cin >> t >> z;
cnt += t;
a.push_back(z);
}
sort(a.begin(),a.end(),greater<int>());
while(cnt>0) cnt -= a[i++];
cout << n - i << endl;
for(int j = 0;j<i-1;j++) cout << a[j] << " ";
cout << cnt + a[i-1] << " ";
for(int j = i;j<n;j++) cout << 0 << " ";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |