답안 #311065

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
311065 2020-10-09T08:20:35 Z tigicha Lottery (CEOI18_lot) C++14
100 / 100
981 ms 12536 KB
#include<bits/stdc++.h>
using namespace std;
int n, l, q, k, t, a[100005], b[100005], mas[100005], aray[100005][105], ans[100005][105];
pair<int, int>ar[100005];
int main(){
	cin>>n>>l;
	for(int i=1; i<=n; i++)
	cin>>a[i];
	cin>>q;
	for(int i=1; i<=q; i++){
		cin>>ar[i].first;
		ar[i].second=i;
	}
	sort(ar+1, ar+q+1);
	k=1;
	for(int i=0; i<=n; i++){
		while(ar[k].first<i && k<=q) 
		k++;
		mas[i]=k;
	}
	for(int i=1; i<=n; i++){
		for(int j=1; j<=n-i; j++){
			b[j]=0;
			if(a[j]!=a[i+j])
			b[j]=1;
		}
		for(int j=1; j<=n-i; j++){
			b[j]+=b[j-1];
			if(j>=l){
				t=b[j]-b[j-l];
				aray[j-l+1][mas[t]]++;
				aray[j+i-l+1][mas[t]]++;
			}
		}
	}
	for(int i=1; i<=q; i++)
	for(int j=1; j<=n-l+1; j++)
	ans[j][ar[i].second]=aray[j][i]+ans[j][ar[i-1].second];
	for(int i=1; i<=q; i++){
	    for(int j=1; j<=n-l+1; j++)
		cout<<ans[j][i]<<" ";
		cout<<endl;
	}
	return 0;
}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:40:6: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   40 |      for(int j=1; j<=n-l+1; j++)
      |      ^~~
lot.cpp:42:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   42 |   cout<<endl;
      |   ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 5 ms 640 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 5 ms 640 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 22 ms 2040 KB Output is correct
14 Correct 18 ms 1536 KB Output is correct
15 Correct 17 ms 1536 KB Output is correct
16 Correct 24 ms 1912 KB Output is correct
17 Correct 21 ms 1792 KB Output is correct
18 Correct 42 ms 1784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 815 ms 8732 KB Output is correct
2 Correct 744 ms 8824 KB Output is correct
3 Correct 548 ms 8824 KB Output is correct
4 Correct 488 ms 8696 KB Output is correct
5 Correct 284 ms 4708 KB Output is correct
6 Correct 457 ms 8312 KB Output is correct
7 Correct 288 ms 4728 KB Output is correct
8 Correct 345 ms 6392 KB Output is correct
9 Correct 530 ms 8572 KB Output is correct
10 Correct 482 ms 8696 KB Output is correct
11 Correct 34 ms 2040 KB Output is correct
12 Correct 316 ms 6264 KB Output is correct
13 Correct 314 ms 5496 KB Output is correct
14 Correct 327 ms 5464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 815 ms 8732 KB Output is correct
2 Correct 744 ms 8824 KB Output is correct
3 Correct 548 ms 8824 KB Output is correct
4 Correct 488 ms 8696 KB Output is correct
5 Correct 284 ms 4708 KB Output is correct
6 Correct 457 ms 8312 KB Output is correct
7 Correct 288 ms 4728 KB Output is correct
8 Correct 345 ms 6392 KB Output is correct
9 Correct 530 ms 8572 KB Output is correct
10 Correct 482 ms 8696 KB Output is correct
11 Correct 34 ms 2040 KB Output is correct
12 Correct 316 ms 6264 KB Output is correct
13 Correct 314 ms 5496 KB Output is correct
14 Correct 327 ms 5464 KB Output is correct
15 Correct 516 ms 8440 KB Output is correct
16 Correct 483 ms 8024 KB Output is correct
17 Correct 507 ms 8824 KB Output is correct
18 Correct 497 ms 8768 KB Output is correct
19 Correct 490 ms 8696 KB Output is correct
20 Correct 492 ms 8824 KB Output is correct
21 Correct 479 ms 8696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 5 ms 640 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 22 ms 2040 KB Output is correct
14 Correct 18 ms 1536 KB Output is correct
15 Correct 17 ms 1536 KB Output is correct
16 Correct 24 ms 1912 KB Output is correct
17 Correct 21 ms 1792 KB Output is correct
18 Correct 42 ms 1784 KB Output is correct
19 Correct 815 ms 8732 KB Output is correct
20 Correct 744 ms 8824 KB Output is correct
21 Correct 548 ms 8824 KB Output is correct
22 Correct 488 ms 8696 KB Output is correct
23 Correct 284 ms 4708 KB Output is correct
24 Correct 457 ms 8312 KB Output is correct
25 Correct 288 ms 4728 KB Output is correct
26 Correct 345 ms 6392 KB Output is correct
27 Correct 530 ms 8572 KB Output is correct
28 Correct 482 ms 8696 KB Output is correct
29 Correct 34 ms 2040 KB Output is correct
30 Correct 316 ms 6264 KB Output is correct
31 Correct 314 ms 5496 KB Output is correct
32 Correct 327 ms 5464 KB Output is correct
33 Correct 516 ms 8440 KB Output is correct
34 Correct 483 ms 8024 KB Output is correct
35 Correct 507 ms 8824 KB Output is correct
36 Correct 497 ms 8768 KB Output is correct
37 Correct 490 ms 8696 KB Output is correct
38 Correct 492 ms 8824 KB Output is correct
39 Correct 479 ms 8696 KB Output is correct
40 Correct 799 ms 9464 KB Output is correct
41 Correct 231 ms 1528 KB Output is correct
42 Correct 511 ms 9464 KB Output is correct
43 Correct 497 ms 8800 KB Output is correct
44 Correct 495 ms 8892 KB Output is correct
45 Correct 981 ms 12404 KB Output is correct
46 Correct 285 ms 1660 KB Output is correct
47 Correct 625 ms 12536 KB Output is correct
48 Correct 584 ms 10556 KB Output is correct
49 Correct 607 ms 11200 KB Output is correct