답안 #826860

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
826860 2023-08-16T05:31:46 Z Sohsoh84 사탕 분배 (IOI21_candies) C++17
38 / 100
5000 ms 9020 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;
const int T = 1000;

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 s = 0; s < MAXN; s += T) {
		int fl = s, fr = s + T - 1;

		for (int i = 0; i < q; i++) {
			int tl = (fl > l[i] ? fl : l[i]);
			int tr = (fr < r[i] ? fr : r[i]);
			if (v[i] >= 0) {
				for (int j = tl; j <= tr; j++) {
					A[j] = (A[j] + v[i] >= c[j] ? c[j] : A[j] + v[i]);	
				}
			} else {
				for (int j = tl; j <= tr; 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2985 ms 8416 KB Output is correct
2 Correct 2974 ms 8520 KB Output is correct
3 Correct 2979 ms 8408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 310 ms 4976 KB Output is correct
3 Correct 64 ms 4628 KB Output is correct
4 Correct 2920 ms 8396 KB Output is correct
5 Correct 2943 ms 8992 KB Output is correct
6 Correct 2924 ms 8980 KB Output is correct
7 Correct 2670 ms 9020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 359 ms 5032 KB Output is correct
4 Correct 114 ms 3844 KB Output is correct
5 Execution timed out 5088 ms 7308 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 2985 ms 8416 KB Output is correct
7 Correct 2974 ms 8520 KB Output is correct
8 Correct 2979 ms 8408 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 310 ms 4976 KB Output is correct
11 Correct 64 ms 4628 KB Output is correct
12 Correct 2920 ms 8396 KB Output is correct
13 Correct 2943 ms 8992 KB Output is correct
14 Correct 2924 ms 8980 KB Output is correct
15 Correct 2670 ms 9020 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 359 ms 5032 KB Output is correct
19 Correct 114 ms 3844 KB Output is correct
20 Execution timed out 5088 ms 7308 KB Time limit exceeded
21 Halted 0 ms 0 KB -