답안 #112401

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
112401 2019-05-19T15:29:06 Z SuperJumbo Lottery (CEOI18_lot) C++14
25 / 100
3000 ms 512 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,l;
	scanf("%d %d",&n,&l);
	vector<int> a(n);
	for(int i = 0;i<n;i++)scanf("%d",&a[i]);
	int q;scanf("%d",&q);		
	vector<int> queries;
	unordered_map<int,vector<int>> ans;
	for(int i = 0;i<q;i++){
		int x;scanf("%d",&x);
		queries.push_back(x);
		ans[l-x] = vector<int> (n-l+1,1);
	}
	vector<int> v(n);
	vector<int> sum(n,0),first(n,0);
	for(int i = 0;i<n;i++){
		int u = i - l;
		if(i>=l){
			for(int j = u+1,x = 0;j<n;x++,j++)
				sum[x]-=(a[u] != a[j]);
		}
		for(int j = i+1,x = 0;j<n;x++,j++){
			sum[x]+=(a[i] != a[j]);
			if(i>=l-1){
				for(auto y:ans){
					if(l-y.first<sum[x])continue;
					ans[y.first][u+1]++;
					ans[y.first][u+2+x]++;
				}
			}

		}
	}
	for(auto u : queries){
		for(auto v:ans[l-u])
			printf("%d ",v-1);
		printf("\n");
	}



}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:5:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&l);
  ~~~~~^~~~~~~~~~~~~~~
lot.cpp:7:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 0;i<n;i++)scanf("%d",&a[i]);
                        ~~~~~^~~~~~~~~~~~
lot.cpp:8:13: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int q;scanf("%d",&q);  
        ~~~~~^~~~~~~~~
lot.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int x;scanf("%d",&x);
         ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 17 ms 376 KB Output is correct
9 Correct 15 ms 384 KB Output is correct
10 Correct 56 ms 476 KB Output is correct
11 Correct 29 ms 384 KB Output is correct
12 Correct 41 ms 420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 17 ms 376 KB Output is correct
9 Correct 15 ms 384 KB Output is correct
10 Correct 56 ms 476 KB Output is correct
11 Correct 29 ms 384 KB Output is correct
12 Correct 41 ms 420 KB Output is correct
13 Correct 2643 ms 448 KB Output is correct
14 Execution timed out 3022 ms 512 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3028 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3028 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 17 ms 376 KB Output is correct
9 Correct 15 ms 384 KB Output is correct
10 Correct 56 ms 476 KB Output is correct
11 Correct 29 ms 384 KB Output is correct
12 Correct 41 ms 420 KB Output is correct
13 Correct 2643 ms 448 KB Output is correct
14 Execution timed out 3022 ms 512 KB Time limit exceeded
15 Halted 0 ms 0 KB -