Submission #574391

# Submission time Handle Problem Language Result Execution time Memory
574391 2022-06-08T13:11:48 Z wjajjsasqq Distributing Candies (IOI21_candies) C++17
27 / 100
4963 ms 8156 KB
#include "candies.h"
#include <algorithm>
#include <cstdio>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")

const int INF = 1070000000;

const int N = 200008;
int n, a[N], c[N], C, res[N];
long long inc[N];

std::vector<int> distribute_candies(std::vector<int> c_, std::vector<int> l, std::vector<int> r, std::vector<int> v) {
	n = (int)c_.size();
	std::vector<int> ans(n);
	C = c_[0];
	for (int i = 0; i < (int)l.size(); ++i) {
		int ll = l[i], rr = r[i] + 1, d = v[i];
		for (int j = ll; j < rr; ++j) res[j] += d;
		if (d < 0) {
			for (int j = ll; j < rr; ++j) res[j] = res[j] < 0 ? 0 : res[j];
		}
		else {
			for (int j = ll; j < rr; ++j) res[j] = res[j] < C ? res[j] : C;
		}
	}
	for (int j = 0; j < n; ++j) ans[j] = res[j];
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4860 ms 8152 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 Correct 97 ms 4972 KB Output is correct
3 Correct 96 ms 4612 KB Output is correct
4 Correct 4900 ms 8148 KB Output is correct
5 Correct 4963 ms 8148 KB Output is correct
6 Correct 4876 ms 8152 KB Output is correct
7 Correct 4951 ms 8156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -