Submission #472733

# Submission time Handle Problem Language Result Execution time Memory
472733 2021-09-14T08:54:39 Z oliversommer Distributing Candies (IOI21_candies) C++17
0 / 100
129 ms 7340 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] += v[j];
		s[right] -= v[j];
	}

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

	return s;
}
# 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 Incorrect 129 ms 7340 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 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -