Submission #472707

# Submission time Handle Problem Language Result Execution time Memory
472707 2021-09-14T08:13:11 Z oliversommer Distributing Candies (IOI21_candies) C++17
0 / 100
130 ms 8088 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] = min(s[i], c[i]);
	}
	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 130 ms 8088 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 -