Submission #249694

# Submission time Handle Problem Language Result Execution time Memory
249694 2020-07-15T14:49:10 Z dvdg6566 Pod starim krovovima (COCI20_psk) C++14
0 / 50
2 ms 384 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end() 
#define SZ(x) (ll)x.size()
#define f first
#define s second
const ll MAXN=300001;
const ll MAXK=1000001;
const ll INF = 1e9;
const ll MOD = 1e9+7;

int out[MAXN];
vpi V;
int N,X,a,b;

int main(){
	cin>>N;
	for(int i=1;i<=N;++i){
		cin>>a>>b;
		X+=a;
		V.pb(b,i);
	}
	sort(ALL(V));
	while(X){
		pi t=V.back();V.pop_back();
		out[t.s]=min(t.f,X);
		X-=out[t.s];
	}
	for(int i=1;i<=N;++i)cout<<out[i]<<' ';
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Incorrect 0 ms 384 KB Output isn't correct
4 Incorrect 1 ms 256 KB Output isn't correct
5 Incorrect 1 ms 384 KB Output isn't correct
6 Incorrect 0 ms 384 KB Output isn't correct
7 Incorrect 0 ms 384 KB Output isn't correct
8 Incorrect 1 ms 384 KB Output isn't correct
9 Incorrect 1 ms 384 KB Output isn't correct
10 Incorrect 2 ms 384 KB Output isn't correct