Submission #844628

# Submission time Handle Problem Language Result Execution time Memory
844628 2023-09-05T15:02:02 Z vjudge1 Pod starim krovovima (COCI20_psk) C++17
36 / 50
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
int N;cin>>N;
vector<ll> T(N),Z(N);
for(int i=0;i<N;i++)cin>>T[i]>>Z[i];
ll m = accumulate(T.begin(),T.end(),0);
sort(Z.begin(),Z.end(),greater<ll>());
bool flag = true;
for(int i=0;i<N;i++){
	ll dec = min(Z[i],m);
	Z[i]=dec;
	m-=dec;
	if(m==0 && flag){cout<<N-i-1<<endl;flag=false;}
}
for(auto &i:Z)cout<<i<<" ";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Partially correct 0 ms 348 KB Output is partially correct
6 Partially correct 0 ms 348 KB Output is partially correct
7 Partially correct 0 ms 348 KB Output is partially correct
8 Partially correct 1 ms 348 KB Output is partially correct
9 Incorrect 1 ms 348 KB Output isn't correct
10 Incorrect 1 ms 348 KB Output isn't correct