# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
202356 | EmmanuelAC | Pod starim krovovima (COCI20_psk) | C++14 | 8 ms | 376 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>
using namespace std;
#define ll long long
ll V[1001],
C[1001],
S[1001];
int main(){
int N; cin >> N;
ll tv = 0;
for(int i=0; i<N; i++){
cin >> V[i] >> C[i];
tv += V[i];
}
int sol = N;
while(tv > 0){
sol --;
int ind = 0, mx = -1;
for(int i=0; i<N; i++){
if(C[i] > mx && S[i] == 0)
mx = C[i], ind = i;
}
S[ind] = min(tv, C[ind]);
tv -= S[ind];
}
cout << sol << "\n";
for(int i=0; i<N; i++)
cout << S[i] << " ";
cout << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |