Submission #997078

# Submission time Handle Problem Language Result Execution time Memory
997078 2024-06-11T17:15:03 Z 0npata Distributing Candies (IOI21_candies) C++17
8 / 100
78 ms 13652 KB
#include "candies.h"

using namespace std;
#include<bits/stdc++.h>
#define vec vector

std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
                                    std::vector<int> r, std::vector<int> v) {
	int n = c.size();
	int q = l.size();

	vec<long long> add(n+1);
	vec<int> ans(n);

	for(int i = 0; i<q; i++) {
		add[l[i]] += v[i];
		add[r[i]+1] += -v[i];
	}

	long long cur = 0;
	for(int i = 0; i<n; i++) {
		cur += add[i];
		ans[i] = min(cur, (long long) c[i]);
	}


	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 78 ms 13652 KB Output is correct
2 Correct 67 ms 12884 KB Output is correct
3 Correct 69 ms 12884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -