Submission #798827

# Submission time Handle Problem Language Result Execution time Memory
798827 2023-07-31T04:52:01 Z khshg Distributing Candies (IOI21_candies) C++17
8 / 100
85 ms 12884 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back

vector<int> distribute_candies(vector<int> C, vector<int> L, vector<int> R, vector<int> V) {
	int Q = (int)L.size(), N = (int)C.size();
	vector<int> ans0(N);
	vector<long long> ans(N);
	for(int i = 0; i < Q; ++i) {
		ans[L[i]] += V[i];
		if(R[i] + 1 < N) ans[R[i] + 1] -= V[i];
	}
	for(int i = 1; i < N; ++i) {
		ans[i] += ans[i - 1];
	}
	for(int i = 0; i < N; ++i) {
		ans[i] = min(ans[i], (long long)C[i]);
		ans0[i] = (int)ans[i];
	}
	return ans0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 85 ms 11360 KB Output is correct
2 Correct 78 ms 12884 KB Output is correct
3 Correct 78 ms 12760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -