답안 #574272

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
574272 2022-06-08T09:26:29 Z wjajjsasqq 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 8124 KB
#include "candies.h"
#include <cstdio>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,tune=native")

const int N = 200000;
int n, a[N], c[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();
	for (int i = 0; i < n; ++i) c[i] = c_[i];
	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) a[j] += d;
		if (d > 0) {
			for (int j = ll; j < rr; ++j) a[j] = a[j] < c[j] ? a[j] : c[j];
		} else {
			for (int j = ll; j < rr; ++j) a[j] = a[j] < 0 ? 0 : a[j];
		}
	}
	std::vector<int> ans(n);
	for (int i = 0; i < n; ++i) ans[i] = a[i];
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5041 ms 8120 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 102 ms 5036 KB Output is correct
3 Correct 104 ms 5372 KB Output is correct
4 Execution timed out 5061 ms 8124 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 150 ms 4968 KB Output is correct
4 Correct 149 ms 4264 KB Output is correct
5 Execution timed out 5083 ms 8032 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 5041 ms 8120 KB Time limit exceeded
7 Halted 0 ms 0 KB -