# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
504556 | 2022-01-10T06:28:50 Z | ToroTN | Lottery (CEOI18_lot) | C++14 | 1067 ms | 8256 KB |
#include<bits/stdc++.h> using namespace std; int n,a[10005],m,t,num[105],idx[10005],ans[105][10005],qs[10005]; vector<pair<int,int> > v; int query(int l,int r) { return qs[r]-qs[l-1]; } int main() { scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) { scanf("%d",&a[i]); } scanf("%d",&t); for(int i=1;i<=t;i++) { scanf("%d",&num[i]); v.push_back({num[i],i}); } sort(v.begin(),v.end()); for(int i=0;i<v.size();i++) { idx[v[i].first]=i+1; } for(int i=10000;i>=1;i--) { if(i>v[v.size()-1].first) { idx[i]=v.size()+1; }else { if(idx[i]==0) { idx[i]=idx[i+1]; } } } idx[0]=1; for(int i=-n;i<=n;i++) { if(i!=0) { for(int j=max(1-i,1);j<=min(n-i,n);j++) { if(a[j]!=a[j+i]) { qs[j]=1; }else { qs[j]=0; } qs[j]+=qs[j-1]; } for(int j=max(max(1-i,1),max(2-m,2-m-i));j<=min(min(n-i,n),min(n-m+1,n-m+1-i));j++) { ++ans[idx[query(j,j+m-1)]][j]; } } } for(int i=1;i<=t;i++) { for(int j=1;j<=n-m+1;j++) { ans[i][j]+=ans[i-1][j]; } } for(int i=1;i<=t;i++) { for(int j=1;j<=n-m+1;j++) { printf("%d ",ans[idx[num[i]]][j]); } printf("\n"); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 0 ms | 332 KB | Output is correct |
5 | Correct | 0 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 | 2 ms | 332 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 | 0 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 0 ms | 332 KB | Output is correct |
5 | Correct | 0 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 | 2 ms | 332 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 | 41 ms | 400 KB | Output is correct |
14 | Correct | 26 ms | 580 KB | Output is correct |
15 | Correct | 24 ms | 488 KB | Output is correct |
16 | Correct | 36 ms | 580 KB | Output is correct |
17 | Correct | 35 ms | 620 KB | Output is correct |
18 | Correct | 35 ms | 556 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 976 ms | 560 KB | Output is correct |
2 | Correct | 947 ms | 600 KB | Output is correct |
3 | Correct | 980 ms | 480 KB | Output is correct |
4 | Correct | 937 ms | 396 KB | Output is correct |
5 | Correct | 430 ms | 420 KB | Output is correct |
6 | Correct | 876 ms | 552 KB | Output is correct |
7 | Correct | 421 ms | 416 KB | Output is correct |
8 | Correct | 641 ms | 540 KB | Output is correct |
9 | Correct | 956 ms | 444 KB | Output is correct |
10 | Correct | 958 ms | 476 KB | Output is correct |
11 | Correct | 52 ms | 376 KB | Output is correct |
12 | Correct | 550 ms | 436 KB | Output is correct |
13 | Correct | 512 ms | 432 KB | Output is correct |
14 | Correct | 518 ms | 396 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 976 ms | 560 KB | Output is correct |
2 | Correct | 947 ms | 600 KB | Output is correct |
3 | Correct | 980 ms | 480 KB | Output is correct |
4 | Correct | 937 ms | 396 KB | Output is correct |
5 | Correct | 430 ms | 420 KB | Output is correct |
6 | Correct | 876 ms | 552 KB | Output is correct |
7 | Correct | 421 ms | 416 KB | Output is correct |
8 | Correct | 641 ms | 540 KB | Output is correct |
9 | Correct | 956 ms | 444 KB | Output is correct |
10 | Correct | 958 ms | 476 KB | Output is correct |
11 | Correct | 52 ms | 376 KB | Output is correct |
12 | Correct | 550 ms | 436 KB | Output is correct |
13 | Correct | 512 ms | 432 KB | Output is correct |
14 | Correct | 518 ms | 396 KB | Output is correct |
15 | Correct | 941 ms | 476 KB | Output is correct |
16 | Correct | 837 ms | 472 KB | Output is correct |
17 | Correct | 976 ms | 596 KB | Output is correct |
18 | Correct | 945 ms | 412 KB | Output is correct |
19 | Correct | 949 ms | 472 KB | Output is correct |
20 | Correct | 936 ms | 436 KB | Output is correct |
21 | Correct | 957 ms | 564 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 0 ms | 332 KB | Output is correct |
5 | Correct | 0 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 | 2 ms | 332 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 | 41 ms | 400 KB | Output is correct |
14 | Correct | 26 ms | 580 KB | Output is correct |
15 | Correct | 24 ms | 488 KB | Output is correct |
16 | Correct | 36 ms | 580 KB | Output is correct |
17 | Correct | 35 ms | 620 KB | Output is correct |
18 | Correct | 35 ms | 556 KB | Output is correct |
19 | Correct | 976 ms | 560 KB | Output is correct |
20 | Correct | 947 ms | 600 KB | Output is correct |
21 | Correct | 980 ms | 480 KB | Output is correct |
22 | Correct | 937 ms | 396 KB | Output is correct |
23 | Correct | 430 ms | 420 KB | Output is correct |
24 | Correct | 876 ms | 552 KB | Output is correct |
25 | Correct | 421 ms | 416 KB | Output is correct |
26 | Correct | 641 ms | 540 KB | Output is correct |
27 | Correct | 956 ms | 444 KB | Output is correct |
28 | Correct | 958 ms | 476 KB | Output is correct |
29 | Correct | 52 ms | 376 KB | Output is correct |
30 | Correct | 550 ms | 436 KB | Output is correct |
31 | Correct | 512 ms | 432 KB | Output is correct |
32 | Correct | 518 ms | 396 KB | Output is correct |
33 | Correct | 941 ms | 476 KB | Output is correct |
34 | Correct | 837 ms | 472 KB | Output is correct |
35 | Correct | 976 ms | 596 KB | Output is correct |
36 | Correct | 945 ms | 412 KB | Output is correct |
37 | Correct | 949 ms | 472 KB | Output is correct |
38 | Correct | 936 ms | 436 KB | Output is correct |
39 | Correct | 957 ms | 564 KB | Output is correct |
40 | Correct | 991 ms | 2028 KB | Output is correct |
41 | Correct | 313 ms | 544 KB | Output is correct |
42 | Correct | 1010 ms | 1992 KB | Output is correct |
43 | Correct | 967 ms | 1528 KB | Output is correct |
44 | Correct | 964 ms | 1628 KB | Output is correct |
45 | Correct | 1026 ms | 8132 KB | Output is correct |
46 | Correct | 289 ms | 1408 KB | Output is correct |
47 | Correct | 1067 ms | 8256 KB | Output is correct |
48 | Correct | 920 ms | 6468 KB | Output is correct |
49 | Correct | 997 ms | 7072 KB | Output is correct |