Submission #435507

# Submission time Handle Problem Language Result Execution time Memory
435507 2021-06-23T11:43:35 Z grt Distributing Candies (IOI21_candies) C++17
0 / 100
102 ms 8032 KB
#include <bits/stdc++.h>
#define ST first
#define ND second
#define PB push_back

using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;

int n, q;

vector<ll> distribute_candies(vi c, vi l, vi r, vi v) {
	n = (int)c.size();
	q = (int)l.size();
	vector<ll> ans(n);
	for(int i = 0; i < q; ++i) {
		ans[l[i]] += v[i];
		if(r[i] + 1 < n) ans[r[i] + 1] -= v[i];
	}
	for(int i = 1; i < n; ++i) {
		ans[i] += ans[i - 1];
	}
	for(int i = 0; i < n; ++i) {
		ans[i] = min(ans[i], (ll)c[i]);
	}
	return ans;
}

//int main() {
	//ios_base::sync_with_stdio(0);
	//cin.tie(0);
	//vector<ll> w = distribute_candies({10, 15, 13}, {0, 0}, {2, 1}, {20, -11});
	//for(int x : w) {
		//cout << x << " ";
	//}
//}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 102 ms 8032 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 256 KB Output isn't correct
2 Halted 0 ms 0 KB -