Submission #435888

# Submission time Handle Problem Language Result Execution time Memory
435888 2021-06-23T21:40:34 Z paisie Distributing Candies (IOI21_candies) C++17
0 / 100
154 ms 10128 KB
#include<bits/stdc++.h>
using namespace std;
#define pb push_back

#define ll long long
vector<int> distribute_candies(vector <int> c, vector<int> l, vector <int>r, vector<int> v){
	int n = c.size();
	int q = l.size();
	
	vector <ll> pre(n+1, 0);
	vector <int> ans(n, 0);
	
	for(int i=0; i<q; i++){
		pre[l[i]]+=v[i];
		pre[r[i]+1]-=v[i];
	}
	
	for(auto it:pre)cout<<it<<" ";
	cout<<endl;
	
	
	for(int i=0; i<n; i++){
		if(i>0)pre[i] +=pre[i-1];
		ans[i] = min(pre[i], 1LL*c[i]);
	}
	
	return ans;
 }
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 154 ms 10128 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -