Submission #587129

# Submission time Handle Problem Language Result Execution time Memory
587129 2022-07-01T11:09:31 Z AkramElOmrani Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13312 KB
#include "candies.h"
#include <bits/stdc++.h>

#define ll long long

using namespace std;


void process(int& v, int a, int mx) {
	ll res = v; res += a;
	res = max(res, 0LL);
	res = min(res, (ll)mx);
	v = res;
}

vector<int> distribute_candies(vector<int> c,
		vector<int> l,
		vector<int> r,
		vector<int> v) {

	int n = c.size();
	vector<int> s(n);
	int q = l.size();

	for(int i = 0; i < q; ++i) {
		for(int j = l[i]; j <= r[i]; ++j) {
			process(s[j], v[i], c[j]);
		}
	}

	return s;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 4 ms 368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5052 ms 12076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 203 ms 8032 KB Output is correct
3 Correct 196 ms 6016 KB Output is correct
4 Execution timed out 5044 ms 13312 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 499 ms 7628 KB Output is correct
4 Correct 498 ms 4004 KB Output is correct
5 Execution timed out 5066 ms 10848 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 4 ms 368 KB Output is correct
6 Execution timed out 5052 ms 12076 KB Time limit exceeded
7 Halted 0 ms 0 KB -