Submission #448541

# Submission time Handle Problem Language Result Execution time Memory
448541 2021-07-30T13:18:09 Z grt Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13260 KB
#include <bits/stdc++.h>
#define ST first
#define ND second
#define PB push_back

using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;

const int nax = 200 * 1000 + 10;
int n, q;

vi distribute_candies(vi c, vi la, vi ra, vi v) {
	n = (int)c.size();
	q = (int)la.size();
	vi ans(n);
	for(int i = 0; i < n; ++i) ans[i] = 0;
	for(int i = 0; i < q; ++i) {
		for(int j = la[i]; j <= ra[i]; ++j) {
			ans[j] += v[i];
			ans[j] = max(ans[j], 0);
			ans[j] = min(ans[j], c[j]);
		}
	}
	return ans;
}

//int main() {
	//ios_base::sync_with_stdio(0);
	//cin.tie(0);
	//int N, Q;
	//cin >> N >> Q;
	//vi c(N), l(Q), r(Q), v(Q);
	//for(int i = 0; i < N; ++i) {
		//cin >> c[i];
	//}
	//for(int i = 0; i < Q; ++i) {
		//cin >> l[i] >> r[i] >> v[i];
	//}
	//auto ans = distribute_candies(c,l,r,v);
	//for(int x : ans) cout << x << " ";
//}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5073 ms 7336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 239 ms 8016 KB Output is correct
3 Correct 238 ms 5944 KB Output is correct
4 Execution timed out 5077 ms 13260 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 596 ms 5012 KB Output is correct
4 Correct 610 ms 4000 KB Output is correct
5 Execution timed out 5080 ms 10828 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
6 Execution timed out 5073 ms 7336 KB Time limit exceeded
7 Halted 0 ms 0 KB -