# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
500550 | 2021-12-31T10:38:34 Z | RambaXGorilla | Lottery (CEOI18_lot) | C++17 | 594 ms | 8336 KB |
#include<cstdio> #include<algorithm> using namespace std; int N, L, Q; int draws[10010]; int quers[110]; int dists[20010] = {}; int nums[10010] = {}; int sims[110][10010]; int main(){ scanf("%d%d",&N,&L); for(int i = 0;i < N;i++){ scanf("%d",&draws[i]); } scanf("%d",&Q); for(int i = 0;i < Q;i++){ scanf("%d",&quers[i]); } for(int j = 1;j < N - L + 1;j++){ int dist = 0; for(int i = 0;i < L;i++){ dist += draws[i] != draws[i + j]; } dists[j + 10000] = dist; nums[dist]++; } for(int i = 1;i < L + 1;i++){ nums[i] += nums[i - 1]; } for(int j = 0;j < N - L + 1;j++){ for(int i = 0;i < Q;i++){ sims[i][j] = nums[quers[i]]; } if(j == N - L){ break; } fill(nums, nums + 10010, 0); int dist = 0; for(int i = 0;i < L;i++){ dist += draws[i] != draws[i + j + 1]; } dists[-j - 1 + 10000] = dist; nums[dist]++; for(int i = -j;i < N - L - j;i++){ if(!i){ continue; } dists[i + 10000] -= draws[j] != draws[i + j]; dists[i + 10000] += draws[j + L] != draws[i + j + L]; nums[dists[i + 10000]]++; } for(int i = 1;i < L + 1;i++){ nums[i] += nums[i - 1]; } } for(int i = 0;i < Q;i++){ for(int j = 0;j < N - L + 1;j++){ printf("%d ",sims[i][j]); } printf("\n"); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 288 KB | Output is correct |
2 | Correct | 0 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 420 KB | Output is correct |
4 | Correct | 1 ms | 284 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 2 ms | 460 KB | Output is correct |
11 | Correct | 1 ms | 460 KB | Output is correct |
12 | Correct | 2 ms | 460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 288 KB | Output is correct |
2 | Correct | 0 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 420 KB | Output is correct |
4 | Correct | 1 ms | 284 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 2 ms | 460 KB | Output is correct |
11 | Correct | 1 ms | 460 KB | Output is correct |
12 | Correct | 2 ms | 460 KB | Output is correct |
13 | Correct | 22 ms | 408 KB | Output is correct |
14 | Correct | 16 ms | 588 KB | Output is correct |
15 | Correct | 17 ms | 416 KB | Output is correct |
16 | Correct | 22 ms | 664 KB | Output is correct |
17 | Correct | 20 ms | 544 KB | Output is correct |
18 | Correct | 21 ms | 564 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 510 ms | 460 KB | Output is correct |
2 | Correct | 526 ms | 428 KB | Output is correct |
3 | Correct | 501 ms | 476 KB | Output is correct |
4 | Correct | 492 ms | 520 KB | Output is correct |
5 | Correct | 232 ms | 428 KB | Output is correct |
6 | Correct | 456 ms | 580 KB | Output is correct |
7 | Correct | 227 ms | 440 KB | Output is correct |
8 | Correct | 340 ms | 576 KB | Output is correct |
9 | Correct | 492 ms | 560 KB | Output is correct |
10 | Correct | 493 ms | 580 KB | Output is correct |
11 | Correct | 33 ms | 368 KB | Output is correct |
12 | Correct | 304 ms | 756 KB | Output is correct |
13 | Correct | 276 ms | 508 KB | Output is correct |
14 | Correct | 266 ms | 484 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 510 ms | 460 KB | Output is correct |
2 | Correct | 526 ms | 428 KB | Output is correct |
3 | Correct | 501 ms | 476 KB | Output is correct |
4 | Correct | 492 ms | 520 KB | Output is correct |
5 | Correct | 232 ms | 428 KB | Output is correct |
6 | Correct | 456 ms | 580 KB | Output is correct |
7 | Correct | 227 ms | 440 KB | Output is correct |
8 | Correct | 340 ms | 576 KB | Output is correct |
9 | Correct | 492 ms | 560 KB | Output is correct |
10 | Correct | 493 ms | 580 KB | Output is correct |
11 | Correct | 33 ms | 368 KB | Output is correct |
12 | Correct | 304 ms | 756 KB | Output is correct |
13 | Correct | 276 ms | 508 KB | Output is correct |
14 | Correct | 266 ms | 484 KB | Output is correct |
15 | Correct | 485 ms | 472 KB | Output is correct |
16 | Correct | 439 ms | 672 KB | Output is correct |
17 | Correct | 522 ms | 556 KB | Output is correct |
18 | Correct | 538 ms | 772 KB | Output is correct |
19 | Correct | 496 ms | 460 KB | Output is correct |
20 | Correct | 514 ms | 612 KB | Output is correct |
21 | Correct | 491 ms | 552 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 288 KB | Output is correct |
2 | Correct | 0 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 420 KB | Output is correct |
4 | Correct | 1 ms | 284 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 2 ms | 460 KB | Output is correct |
11 | Correct | 1 ms | 460 KB | Output is correct |
12 | Correct | 2 ms | 460 KB | Output is correct |
13 | Correct | 22 ms | 408 KB | Output is correct |
14 | Correct | 16 ms | 588 KB | Output is correct |
15 | Correct | 17 ms | 416 KB | Output is correct |
16 | Correct | 22 ms | 664 KB | Output is correct |
17 | Correct | 20 ms | 544 KB | Output is correct |
18 | Correct | 21 ms | 564 KB | Output is correct |
19 | Correct | 510 ms | 460 KB | Output is correct |
20 | Correct | 526 ms | 428 KB | Output is correct |
21 | Correct | 501 ms | 476 KB | Output is correct |
22 | Correct | 492 ms | 520 KB | Output is correct |
23 | Correct | 232 ms | 428 KB | Output is correct |
24 | Correct | 456 ms | 580 KB | Output is correct |
25 | Correct | 227 ms | 440 KB | Output is correct |
26 | Correct | 340 ms | 576 KB | Output is correct |
27 | Correct | 492 ms | 560 KB | Output is correct |
28 | Correct | 493 ms | 580 KB | Output is correct |
29 | Correct | 33 ms | 368 KB | Output is correct |
30 | Correct | 304 ms | 756 KB | Output is correct |
31 | Correct | 276 ms | 508 KB | Output is correct |
32 | Correct | 266 ms | 484 KB | Output is correct |
33 | Correct | 485 ms | 472 KB | Output is correct |
34 | Correct | 439 ms | 672 KB | Output is correct |
35 | Correct | 522 ms | 556 KB | Output is correct |
36 | Correct | 538 ms | 772 KB | Output is correct |
37 | Correct | 496 ms | 460 KB | Output is correct |
38 | Correct | 514 ms | 612 KB | Output is correct |
39 | Correct | 491 ms | 552 KB | Output is correct |
40 | Correct | 520 ms | 1980 KB | Output is correct |
41 | Correct | 50 ms | 656 KB | Output is correct |
42 | Correct | 513 ms | 2024 KB | Output is correct |
43 | Correct | 509 ms | 1656 KB | Output is correct |
44 | Correct | 499 ms | 1728 KB | Output is correct |
45 | Correct | 594 ms | 8188 KB | Output is correct |
46 | Correct | 51 ms | 1572 KB | Output is correct |
47 | Correct | 570 ms | 8336 KB | Output is correct |
48 | Correct | 547 ms | 6500 KB | Output is correct |
49 | Correct | 566 ms | 7132 KB | Output is correct |