답안 #826891

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
826891 2023-08-16T06:01:54 Z Sohsoh84 사탕 분배 (IOI21_candies) C++17
100 / 100
4761 ms 7420 KB
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx")

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

using namespace std;

const int MAXN = 2e5;
const int T = 2000;

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();
	vector<int> A(MAXN, 0);
	A.shrink_to_fit();
	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]);
			for (int j = tl; j <= tr; j++) {
				A[j] = A[j] + v[i];
				A[j] = (A[j] >= c[j] ? c[j] : A[j]);	
				A[j] = (A[j] >= 0 ? A[j] : 0);
			}
		}
	}

	A.resize(n);
	return A;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1108 KB Output is correct
2 Correct 1 ms 1108 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 2 ms 1108 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1716 ms 7364 KB Output is correct
2 Correct 1739 ms 7364 KB Output is correct
3 Correct 1713 ms 7368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1108 KB Output is correct
2 Correct 79 ms 5736 KB Output is correct
3 Correct 53 ms 3896 KB Output is correct
4 Correct 1741 ms 7404 KB Output is correct
5 Correct 1716 ms 7364 KB Output is correct
6 Correct 1757 ms 7368 KB Output is correct
7 Correct 1738 ms 7372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1108 KB Output is correct
2 Correct 1 ms 1108 KB Output is correct
3 Correct 106 ms 5816 KB Output is correct
4 Correct 80 ms 2808 KB Output is correct
5 Correct 4746 ms 7420 KB Output is correct
6 Correct 4748 ms 7372 KB Output is correct
7 Correct 4745 ms 7372 KB Output is correct
8 Correct 4758 ms 7408 KB Output is correct
9 Correct 4761 ms 7372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1108 KB Output is correct
2 Correct 1 ms 1108 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 2 ms 1108 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 1716 ms 7364 KB Output is correct
7 Correct 1739 ms 7364 KB Output is correct
8 Correct 1713 ms 7368 KB Output is correct
9 Correct 1 ms 1108 KB Output is correct
10 Correct 79 ms 5736 KB Output is correct
11 Correct 53 ms 3896 KB Output is correct
12 Correct 1741 ms 7404 KB Output is correct
13 Correct 1716 ms 7364 KB Output is correct
14 Correct 1757 ms 7368 KB Output is correct
15 Correct 1738 ms 7372 KB Output is correct
16 Correct 1 ms 1108 KB Output is correct
17 Correct 1 ms 1108 KB Output is correct
18 Correct 106 ms 5816 KB Output is correct
19 Correct 80 ms 2808 KB Output is correct
20 Correct 4746 ms 7420 KB Output is correct
21 Correct 4748 ms 7372 KB Output is correct
22 Correct 4745 ms 7372 KB Output is correct
23 Correct 4758 ms 7408 KB Output is correct
24 Correct 4761 ms 7372 KB Output is correct
25 Correct 1 ms 1108 KB Output is correct
26 Correct 50 ms 2716 KB Output is correct
27 Correct 78 ms 5812 KB Output is correct
28 Correct 1726 ms 7404 KB Output is correct
29 Correct 1717 ms 7368 KB Output is correct
30 Correct 1719 ms 7368 KB Output is correct
31 Correct 1703 ms 7408 KB Output is correct
32 Correct 1710 ms 7372 KB Output is correct