Submission #472925

# Submission time Handle Problem Language Result Execution time Memory
472925 2021-09-14T14:51:19 Z oliversommer Distributing Candies (IOI21_candies) C++17
0 / 100
120 ms 12184 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];
		if(right < n - 1) {
			s[right + 1] -= 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[n - 1] = min(s[n - 1], c[n - 1]);

	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 120 ms 12184 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 -