# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
230365 | 2020-05-09T17:22:23 Z | DodgeBallMan | Lottery (CEOI18_lot) | C++14 | 1259 ms | 8440 KB |
#include <bits/stdc++.h> #define pii pair<int, int> #define x first #define y second using namespace std; const int N = 1e4 + 10; int n, l, q, a[N], qu[110], ans[110][N]; vector<int> coord; int main() { scanf("%d %d",&n,&l); for( int i = 1 ; i <= n ; i++ ) scanf("%d",&a[i]); scanf("%d",&q); for( int i = 1 ; i <= q ; i++ ) { scanf("%d",&qu[i]); coord.emplace_back( qu[i] ); } sort( coord.begin(), coord.end() ); for( int d = 1 ; d <= n - l ; d++ ) { int p1 = 1, p2, cnt = 0; p2 = p1 + d; for( p1 = 1 ; p1 <= l ; p1++, p2++ ) { //printf("%d %d\n",p1,p2); if( a[p1] != a[p2] ) cnt++; } //printf("wtf %d %d %d\n",p1,p2,cnt); int idx = lower_bound( coord.begin(), coord.end(), cnt ) - coord.begin(); ans[idx][1]++, ans[idx][1+d]++; while( p2 <= n ) { if( a[p1-l] != a[p2-l] ) cnt--; if( a[p1] != a[p2] ) cnt++; idx = lower_bound( coord.begin(), coord.end(), cnt ) - coord.begin(); ans[idx][p1-l+1]++, ans[idx][p2-l+1]++; p1++, p2++; } } for( int i = 1 ; i < q ; i++ ) for( int j = 1 ; j <= n ; j++ ) ans[i][j] += ans[i-1][j]; for( int i = 1 ; i <= q ; i++ ) { int idx = lower_bound( coord.begin(), coord.end(), qu[i] ) - coord.begin(); for( int j = 1 ; j <= n - l + 1 ; j++ ) printf("%d ",ans[idx][j]); printf("\n"); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 512 KB | Output is correct |
13 | Correct | 19 ms | 384 KB | Output is correct |
14 | Correct | 14 ms | 640 KB | Output is correct |
15 | Correct | 12 ms | 512 KB | Output is correct |
16 | Correct | 21 ms | 640 KB | Output is correct |
17 | Correct | 18 ms | 640 KB | Output is correct |
18 | Correct | 19 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 489 ms | 504 KB | Output is correct |
2 | Correct | 529 ms | 504 KB | Output is correct |
3 | Correct | 250 ms | 512 KB | Output is correct |
4 | Correct | 172 ms | 632 KB | Output is correct |
5 | Correct | 70 ms | 512 KB | Output is correct |
6 | Correct | 159 ms | 640 KB | Output is correct |
7 | Correct | 62 ms | 512 KB | Output is correct |
8 | Correct | 94 ms | 512 KB | Output is correct |
9 | Correct | 157 ms | 632 KB | Output is correct |
10 | Correct | 187 ms | 632 KB | Output is correct |
11 | Correct | 21 ms | 384 KB | Output is correct |
12 | Correct | 134 ms | 512 KB | Output is correct |
13 | Correct | 95 ms | 512 KB | Output is correct |
14 | Correct | 102 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 489 ms | 504 KB | Output is correct |
2 | Correct | 529 ms | 504 KB | Output is correct |
3 | Correct | 250 ms | 512 KB | Output is correct |
4 | Correct | 172 ms | 632 KB | Output is correct |
5 | Correct | 70 ms | 512 KB | Output is correct |
6 | Correct | 159 ms | 640 KB | Output is correct |
7 | Correct | 62 ms | 512 KB | Output is correct |
8 | Correct | 94 ms | 512 KB | Output is correct |
9 | Correct | 157 ms | 632 KB | Output is correct |
10 | Correct | 187 ms | 632 KB | Output is correct |
11 | Correct | 21 ms | 384 KB | Output is correct |
12 | Correct | 134 ms | 512 KB | Output is correct |
13 | Correct | 95 ms | 512 KB | Output is correct |
14 | Correct | 102 ms | 512 KB | Output is correct |
15 | Correct | 269 ms | 512 KB | Output is correct |
16 | Correct | 151 ms | 512 KB | Output is correct |
17 | Correct | 194 ms | 632 KB | Output is correct |
18 | Correct | 177 ms | 512 KB | Output is correct |
19 | Correct | 179 ms | 632 KB | Output is correct |
20 | Correct | 190 ms | 608 KB | Output is correct |
21 | Correct | 182 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 512 KB | Output is correct |
13 | Correct | 19 ms | 384 KB | Output is correct |
14 | Correct | 14 ms | 640 KB | Output is correct |
15 | Correct | 12 ms | 512 KB | Output is correct |
16 | Correct | 21 ms | 640 KB | Output is correct |
17 | Correct | 18 ms | 640 KB | Output is correct |
18 | Correct | 19 ms | 640 KB | Output is correct |
19 | Correct | 489 ms | 504 KB | Output is correct |
20 | Correct | 529 ms | 504 KB | Output is correct |
21 | Correct | 250 ms | 512 KB | Output is correct |
22 | Correct | 172 ms | 632 KB | Output is correct |
23 | Correct | 70 ms | 512 KB | Output is correct |
24 | Correct | 159 ms | 640 KB | Output is correct |
25 | Correct | 62 ms | 512 KB | Output is correct |
26 | Correct | 94 ms | 512 KB | Output is correct |
27 | Correct | 157 ms | 632 KB | Output is correct |
28 | Correct | 187 ms | 632 KB | Output is correct |
29 | Correct | 21 ms | 384 KB | Output is correct |
30 | Correct | 134 ms | 512 KB | Output is correct |
31 | Correct | 95 ms | 512 KB | Output is correct |
32 | Correct | 102 ms | 512 KB | Output is correct |
33 | Correct | 269 ms | 512 KB | Output is correct |
34 | Correct | 151 ms | 512 KB | Output is correct |
35 | Correct | 194 ms | 632 KB | Output is correct |
36 | Correct | 177 ms | 512 KB | Output is correct |
37 | Correct | 179 ms | 632 KB | Output is correct |
38 | Correct | 190 ms | 608 KB | Output is correct |
39 | Correct | 182 ms | 512 KB | Output is correct |
40 | Correct | 1000 ms | 1936 KB | Output is correct |
41 | Correct | 18 ms | 1280 KB | Output is correct |
42 | Correct | 418 ms | 2044 KB | Output is correct |
43 | Correct | 367 ms | 1912 KB | Output is correct |
44 | Correct | 371 ms | 1784 KB | Output is correct |
45 | Correct | 1259 ms | 8360 KB | Output is correct |
46 | Correct | 28 ms | 4608 KB | Output is correct |
47 | Correct | 668 ms | 8440 KB | Output is correct |
48 | Correct | 605 ms | 6648 KB | Output is correct |
49 | Correct | 595 ms | 7308 KB | Output is correct |