Submission #112402

# Submission time Handle Problem Language Result Execution time Memory
112402 2019-05-19T15:30:49 Z SuperJumbo Lottery (CEOI18_lot) C++14
45 / 100
3000 ms 632 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;
	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])break;
					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);
         ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 404 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 18 ms 372 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 10 ms 384 KB Output is correct
11 Correct 7 ms 384 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 404 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 18 ms 372 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 10 ms 384 KB Output is correct
11 Correct 7 ms 384 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
13 Correct 843 ms 476 KB Output is correct
14 Correct 245 ms 632 KB Output is correct
15 Correct 134 ms 512 KB Output is correct
16 Correct 443 ms 632 KB Output is correct
17 Correct 239 ms 632 KB Output is correct
18 Correct 204 ms 540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3025 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3025 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 404 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 18 ms 372 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 10 ms 384 KB Output is correct
11 Correct 7 ms 384 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
13 Correct 843 ms 476 KB Output is correct
14 Correct 245 ms 632 KB Output is correct
15 Correct 134 ms 512 KB Output is correct
16 Correct 443 ms 632 KB Output is correct
17 Correct 239 ms 632 KB Output is correct
18 Correct 204 ms 540 KB Output is correct
19 Execution timed out 3025 ms 512 KB Time limit exceeded
20 Halted 0 ms 0 KB -