# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
437400 | 2021-06-26T09:31:17 Z | drkarlicio2107 | Lottery (CEOI18_lot) | C++14 | 884 ms | 12112 KB |
#include <bits/stdc++.h> using namespace std; int ans [110][10010]; int l[10010]; vector < pair <int, int> > qr; int prvi_veci [10010]; int ans2 [110][10010]; int main(){ int n, d; cin >> n >> d; for (int i=0; i<n; i++) cin >> l[i]; int q; cin >> q; for (int i=0; i<q; i++){ int k; cin >> k; qr.push_back (make_pair(k, i)); } for (int i=0; i<n+10; i++) prvi_veci[i]=-1; sort (qr.begin(), qr.end()); int last=-1; for (int i=0; i<qr.size(); i++){ for (int j=qr[i].first; j>last; j--) prvi_veci [j]=i; last=qr [i].first; } for (int i=1; i<n-d+1; i++) { int l1=0; int r1=d-1; int l2=i; int r2=i+d-1; int met=0; for (int j=0; j<d; j++) { if (l[l1+j]!=l[l2+j]) met++; } int pos=prvi_veci[met]; if (pos!=-1) ans [pos][l2]+=1; if (pos!=-1) ans [pos][l1]+=1; while (r2!=n-1){ if (l[l1]!=l[l2]) met--; if (l[r1+1]!=l[r2+1]) met++; l1++; r1++; l2++; r2++; int pos=prvi_veci[met]; if (pos!=-1) ans [pos][l2]+=1; if (pos!=-1) ans [pos][l1]+=1; } } for (int j=0; j<n-d+1; j++){ int sol=ans [0][j]; for (int i=1; i<q; i++){ sol+=ans [i][j]; ans [i][j]=sol; } } for (int i=0; i<q; i++) { int x=i; int y=qr[i].second; for (int j=0; j<n-d+1; j++) ans2 [y][j]=ans[x][j]; } for (int i=0; i<q; i++) { for (int j=0; j<n-d+1; j++) cout << ans2 [i][j] << " "; cout << endl; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 460 KB | Output is correct |
3 | Correct | 1 ms | 460 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 284 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 | 460 KB | Output is correct |
9 | Correct | 1 ms | 460 KB | Output is correct |
10 | Correct | 2 ms | 460 KB | Output is correct |
11 | Correct | 2 ms | 460 KB | Output is correct |
12 | Correct | 2 ms | 460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 460 KB | Output is correct |
3 | Correct | 1 ms | 460 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 284 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 | 460 KB | Output is correct |
9 | Correct | 1 ms | 460 KB | Output is correct |
10 | Correct | 2 ms | 460 KB | Output is correct |
11 | Correct | 2 ms | 460 KB | Output is correct |
12 | Correct | 2 ms | 460 KB | Output is correct |
13 | Correct | 16 ms | 448 KB | Output is correct |
14 | Correct | 11 ms | 716 KB | Output is correct |
15 | Correct | 5 ms | 460 KB | Output is correct |
16 | Correct | 9 ms | 832 KB | Output is correct |
17 | Correct | 8 ms | 784 KB | Output is correct |
18 | Correct | 8 ms | 716 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 385 ms | 400 KB | Output is correct |
2 | Correct | 591 ms | 416 KB | Output is correct |
3 | Correct | 144 ms | 452 KB | Output is correct |
4 | Correct | 85 ms | 404 KB | Output is correct |
5 | Correct | 50 ms | 380 KB | Output is correct |
6 | Correct | 81 ms | 460 KB | Output is correct |
7 | Correct | 101 ms | 384 KB | Output is correct |
8 | Correct | 172 ms | 392 KB | Output is correct |
9 | Correct | 91 ms | 424 KB | Output is correct |
10 | Correct | 89 ms | 416 KB | Output is correct |
11 | Correct | 13 ms | 332 KB | Output is correct |
12 | Correct | 76 ms | 376 KB | Output is correct |
13 | Correct | 60 ms | 360 KB | Output is correct |
14 | Correct | 76 ms | 372 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 385 ms | 400 KB | Output is correct |
2 | Correct | 591 ms | 416 KB | Output is correct |
3 | Correct | 144 ms | 452 KB | Output is correct |
4 | Correct | 85 ms | 404 KB | Output is correct |
5 | Correct | 50 ms | 380 KB | Output is correct |
6 | Correct | 81 ms | 460 KB | Output is correct |
7 | Correct | 101 ms | 384 KB | Output is correct |
8 | Correct | 172 ms | 392 KB | Output is correct |
9 | Correct | 91 ms | 424 KB | Output is correct |
10 | Correct | 89 ms | 416 KB | Output is correct |
11 | Correct | 13 ms | 332 KB | Output is correct |
12 | Correct | 76 ms | 376 KB | Output is correct |
13 | Correct | 60 ms | 360 KB | Output is correct |
14 | Correct | 76 ms | 372 KB | Output is correct |
15 | Correct | 327 ms | 400 KB | Output is correct |
16 | Correct | 76 ms | 452 KB | Output is correct |
17 | Correct | 117 ms | 412 KB | Output is correct |
18 | Correct | 83 ms | 524 KB | Output is correct |
19 | Correct | 81 ms | 452 KB | Output is correct |
20 | Correct | 84 ms | 408 KB | Output is correct |
21 | Correct | 88 ms | 412 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 460 KB | Output is correct |
3 | Correct | 1 ms | 460 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 284 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 | 460 KB | Output is correct |
9 | Correct | 1 ms | 460 KB | Output is correct |
10 | Correct | 2 ms | 460 KB | Output is correct |
11 | Correct | 2 ms | 460 KB | Output is correct |
12 | Correct | 2 ms | 460 KB | Output is correct |
13 | Correct | 16 ms | 448 KB | Output is correct |
14 | Correct | 11 ms | 716 KB | Output is correct |
15 | Correct | 5 ms | 460 KB | Output is correct |
16 | Correct | 9 ms | 832 KB | Output is correct |
17 | Correct | 8 ms | 784 KB | Output is correct |
18 | Correct | 8 ms | 716 KB | Output is correct |
19 | Correct | 385 ms | 400 KB | Output is correct |
20 | Correct | 591 ms | 416 KB | Output is correct |
21 | Correct | 144 ms | 452 KB | Output is correct |
22 | Correct | 85 ms | 404 KB | Output is correct |
23 | Correct | 50 ms | 380 KB | Output is correct |
24 | Correct | 81 ms | 460 KB | Output is correct |
25 | Correct | 101 ms | 384 KB | Output is correct |
26 | Correct | 172 ms | 392 KB | Output is correct |
27 | Correct | 91 ms | 424 KB | Output is correct |
28 | Correct | 89 ms | 416 KB | Output is correct |
29 | Correct | 13 ms | 332 KB | Output is correct |
30 | Correct | 76 ms | 376 KB | Output is correct |
31 | Correct | 60 ms | 360 KB | Output is correct |
32 | Correct | 76 ms | 372 KB | Output is correct |
33 | Correct | 327 ms | 400 KB | Output is correct |
34 | Correct | 76 ms | 452 KB | Output is correct |
35 | Correct | 117 ms | 412 KB | Output is correct |
36 | Correct | 83 ms | 524 KB | Output is correct |
37 | Correct | 81 ms | 452 KB | Output is correct |
38 | Correct | 84 ms | 408 KB | Output is correct |
39 | Correct | 88 ms | 412 KB | Output is correct |
40 | Correct | 776 ms | 2652 KB | Output is correct |
41 | Correct | 14 ms | 844 KB | Output is correct |
42 | Correct | 143 ms | 2720 KB | Output is correct |
43 | Correct | 134 ms | 2380 KB | Output is correct |
44 | Correct | 118 ms | 2428 KB | Output is correct |
45 | Correct | 884 ms | 11900 KB | Output is correct |
46 | Correct | 23 ms | 2380 KB | Output is correct |
47 | Correct | 418 ms | 12112 KB | Output is correct |
48 | Correct | 194 ms | 10432 KB | Output is correct |
49 | Correct | 204 ms | 10996 KB | Output is correct |