Submission #826847

# Submission time Handle Problem Language Result Execution time Memory
826847 2023-08-16T05:26:22 Z Sohsoh84 Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 7296 KB
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")

#include "candies.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 2e5;

int A[MAXN];

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
    	int q = l.size(), n = c.size();
	for (int i = 0; i < q; i++) {
		if (v[i] >= 0) {
			for (int j = l[i]; j <= r[i]; j++) {
				A[j] = (A[j] + v[i] >= c[j] ? c[j] : A[j] + v[i]);	
			}
		} else {
			for (int j = l[i]; j <= r[i]; j++) {
				A[j] = (A[j] + v[i] >= 0 ? A[j] + v[i] : 0);
			}
		}
	}

	vector<int> ans;
	for (int i = 0; i < n; i++) ans.push_back(A[i]);
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5075 ms 7276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 138 ms 4964 KB Output is correct
3 Correct 129 ms 4720 KB Output is correct
4 Execution timed out 5036 ms 7296 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 333 ms 5036 KB Output is correct
4 Correct 385 ms 3836 KB Output is correct
5 Execution timed out 5060 ms 7292 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Execution timed out 5075 ms 7276 KB Time limit exceeded
7 Halted 0 ms 0 KB -