# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099876 | 2024-10-12T05:42:03 Z | model_code | Mosaic (IOI24_mosaic) | C++17 | 174 ms | 22388 KB |
// correct/arshia_solution.cpp #include "mosaic.h" #include <numeric> #include <vector> using namespace std; const int S = 10; vector<long long> mosaic(vector<int> X, vector<int> Y, vector<int> T, vector<int> B, vector<int> L, vector<int> R) { int N = X.size(), Q = T.size(); vector<long long> C(Q, 0); vector<int> help(N - 1 << 1 | 1, 0); copy(Y.rbegin(), Y.rend(), help.begin()); copy(X.begin() + 1, X.end(), help.begin() + N); for (int s = 0; s < S; s++) { vector<int> sum(N - s << 1, 0); partial_sum(help.begin(), help.end(), sum.begin() + 1); for (int i = 0; i < Q; i++) if (T[i] <= B[i] && L[i] <= R[i]) { if (T[i] == s) C[i] += sum[R[i] - T[i] + N - s] - sum[L[i] - T[i] + N - s - 1], T[i]++; if (L[i] == s) C[i] += sum[L[i] - T[i] + N - s] - sum[L[i] - B[i] + N - s - 1], L[i]++; } if (s == N - 1) return C; vector<int> nxt(N - s - 2 << 1 | 1, 0); for (int i = 0; i < N - s - 1; i++) { nxt[i + N - s - 2] = !help[i + N - s] && !(i ? nxt[i + N - s - 3] : help[N - s - 2]); nxt[N - s - 2 - i] = !help[N - s - i - 2] && !(i ? nxt[N - s - 1 - i] : help[N - s]); } help = nxt; } vector<long long> sum(N - S << 1, 0); partial_sum(help.begin(), help.end(), sum.begin() + 1), partial_sum(sum.begin(), sum.end(), sum.begin()); for (int i = 0; i < Q; i++) if (T[i] <= B[i] && L[i] <= R[i]) C[i] += sum[R[i] - T[i] + N - S] - sum[L[i] - T[i] + N - S - 1] - sum[R[i] - B[i] + N - S - 1] + (L[i] - B[i] + N - S - 2 >= 0 ? sum[L[i] - B[i] + N - S - 2] : 0); return C; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 524 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 1 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 508 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 1 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 173 ms | 19124 KB | Output is correct |
2 | Correct | 165 ms | 17164 KB | Output is correct |
3 | Correct | 162 ms | 18420 KB | Output is correct |
4 | Correct | 174 ms | 18972 KB | Output is correct |
5 | Correct | 128 ms | 15208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 344 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 1 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 508 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 1 ms | 492 KB | Output is correct |
18 | Correct | 94 ms | 11764 KB | Output is correct |
19 | Correct | 101 ms | 10256 KB | Output is correct |
20 | Correct | 90 ms | 10364 KB | Output is correct |
21 | Correct | 114 ms | 10352 KB | Output is correct |
22 | Correct | 101 ms | 11640 KB | Output is correct |
23 | Correct | 94 ms | 11480 KB | Output is correct |
24 | Correct | 88 ms | 9440 KB | Output is correct |
25 | Correct | 95 ms | 11768 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 90 ms | 8656 KB | Output is correct |
2 | Correct | 132 ms | 22060 KB | Output is correct |
3 | Correct | 103 ms | 21220 KB | Output is correct |
4 | Correct | 103 ms | 21248 KB | Output is correct |
5 | Correct | 99 ms | 21604 KB | Output is correct |
6 | Correct | 95 ms | 21956 KB | Output is correct |
7 | Correct | 95 ms | 21960 KB | Output is correct |
8 | Correct | 152 ms | 21956 KB | Output is correct |
9 | Correct | 99 ms | 17164 KB | Output is correct |
10 | Correct | 74 ms | 17092 KB | Output is correct |
11 | Correct | 144 ms | 17096 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 113 ms | 18884 KB | Output is correct |
2 | Correct | 106 ms | 22108 KB | Output is correct |
3 | Correct | 99 ms | 20284 KB | Output is correct |
4 | Correct | 112 ms | 20424 KB | Output is correct |
5 | Correct | 124 ms | 22388 KB | Output is correct |
6 | Correct | 77 ms | 17336 KB | Output is correct |
7 | Correct | 73 ms | 15256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 173 ms | 19124 KB | Output is correct |
2 | Correct | 165 ms | 17164 KB | Output is correct |
3 | Correct | 162 ms | 18420 KB | Output is correct |
4 | Correct | 174 ms | 18972 KB | Output is correct |
5 | Correct | 128 ms | 15208 KB | Output is correct |
6 | Correct | 113 ms | 18884 KB | Output is correct |
7 | Correct | 106 ms | 22108 KB | Output is correct |
8 | Correct | 99 ms | 20284 KB | Output is correct |
9 | Correct | 112 ms | 20424 KB | Output is correct |
10 | Correct | 124 ms | 22388 KB | Output is correct |
11 | Correct | 77 ms | 17336 KB | Output is correct |
12 | Correct | 73 ms | 15256 KB | Output is correct |
13 | Correct | 111 ms | 22120 KB | Output is correct |
14 | Correct | 108 ms | 21944 KB | Output is correct |
15 | Correct | 104 ms | 22104 KB | Output is correct |
16 | Correct | 103 ms | 20396 KB | Output is correct |
17 | Correct | 112 ms | 21448 KB | Output is correct |
18 | Correct | 104 ms | 21968 KB | Output is correct |
19 | Correct | 73 ms | 16300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 524 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 1 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 344 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 508 KB | Output is correct |
17 | Correct | 1 ms | 348 KB | Output is correct |
18 | Correct | 1 ms | 492 KB | Output is correct |
19 | Correct | 173 ms | 19124 KB | Output is correct |
20 | Correct | 165 ms | 17164 KB | Output is correct |
21 | Correct | 162 ms | 18420 KB | Output is correct |
22 | Correct | 174 ms | 18972 KB | Output is correct |
23 | Correct | 128 ms | 15208 KB | Output is correct |
24 | Correct | 94 ms | 11764 KB | Output is correct |
25 | Correct | 101 ms | 10256 KB | Output is correct |
26 | Correct | 90 ms | 10364 KB | Output is correct |
27 | Correct | 114 ms | 10352 KB | Output is correct |
28 | Correct | 101 ms | 11640 KB | Output is correct |
29 | Correct | 94 ms | 11480 KB | Output is correct |
30 | Correct | 88 ms | 9440 KB | Output is correct |
31 | Correct | 95 ms | 11768 KB | Output is correct |
32 | Correct | 90 ms | 8656 KB | Output is correct |
33 | Correct | 132 ms | 22060 KB | Output is correct |
34 | Correct | 103 ms | 21220 KB | Output is correct |
35 | Correct | 103 ms | 21248 KB | Output is correct |
36 | Correct | 99 ms | 21604 KB | Output is correct |
37 | Correct | 95 ms | 21956 KB | Output is correct |
38 | Correct | 95 ms | 21960 KB | Output is correct |
39 | Correct | 152 ms | 21956 KB | Output is correct |
40 | Correct | 99 ms | 17164 KB | Output is correct |
41 | Correct | 74 ms | 17092 KB | Output is correct |
42 | Correct | 144 ms | 17096 KB | Output is correct |
43 | Correct | 113 ms | 18884 KB | Output is correct |
44 | Correct | 106 ms | 22108 KB | Output is correct |
45 | Correct | 99 ms | 20284 KB | Output is correct |
46 | Correct | 112 ms | 20424 KB | Output is correct |
47 | Correct | 124 ms | 22388 KB | Output is correct |
48 | Correct | 77 ms | 17336 KB | Output is correct |
49 | Correct | 73 ms | 15256 KB | Output is correct |
50 | Correct | 111 ms | 22120 KB | Output is correct |
51 | Correct | 108 ms | 21944 KB | Output is correct |
52 | Correct | 104 ms | 22104 KB | Output is correct |
53 | Correct | 103 ms | 20396 KB | Output is correct |
54 | Correct | 112 ms | 21448 KB | Output is correct |
55 | Correct | 104 ms | 21968 KB | Output is correct |
56 | Correct | 73 ms | 16300 KB | Output is correct |
57 | Correct | 118 ms | 21960 KB | Output is correct |
58 | Correct | 112 ms | 21328 KB | Output is correct |
59 | Correct | 121 ms | 21936 KB | Output is correct |
60 | Correct | 126 ms | 21332 KB | Output is correct |
61 | Correct | 145 ms | 21332 KB | Output is correct |
62 | Correct | 121 ms | 21500 KB | Output is correct |
63 | Correct | 91 ms | 17252 KB | Output is correct |
64 | Correct | 104 ms | 14956 KB | Output is correct |