답안 #112404

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
112404 2019-05-19T15:41:30 Z SuperJumbo Lottery (CEOI18_lot) C++14
0 / 100
112 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;
	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:27:5: warning: "/*" within comment [-Wcomment]
     /*for(auto y:ans){
      
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 256 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 112 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 112 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -