Submission #472693

# Submission time Handle Problem Language Result Execution time Memory
472693 2021-09-14T08:01:16 Z oliversommer Distributing Candies (IOI21_candies) C++17
0 / 100
124 ms 7244 KB
#include "candies.h"

#include <algorithm>
#include <vector>

using namespace std;

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<int> s(n);

	for (int j = 0; j < q; ++j) {
		int left = l[j];
		int right = r[j];
		s[left] = min(s[left] + v[j], c[left]);
		s[right] = max(s[right] - v[j], 0);
	}

	for(int i = 1; i < n; ++i) {
		s[i] += s[i - 1];
		s[i] = min(s[i], c[i]);
	}
	s[0] = min(s[0], c[0]);

	return s;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 124 ms 7244 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 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -