Submission #260670

#TimeUsernameProblemLanguageResultExecution timeMemory
260670biggLottery (CEOI18_lot)C++14
45 / 100
1100 ms14768 KiB
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2010;
int v[MAXN];
vector<int> intervalos[MAXN];
int marc[MAXN][MAXN];
int n, l, q;
int main(){
	scanf("%d %d", &n, &l);
	for(int i = 0; i < n; i++){
		scanf("%d",&v[i]);
	}
	for(int i = 0; i < n -l + 1; i++){
		for(int j = i; j < i + l; j++){
			intervalos[i].push_back(v[j]);
		}
	}
	for(int i = 0; i < n - l + 1; i++){
		for(int j = 0; j < n - l + 1; j++){
			if(i == j) continue;
			int dist = 0;
			for(int k = 0; k < l; k++){
				if(intervalos[i][k] != intervalos[j][k]) dist++;
			}
			marc[i][dist]++;
		}
		for(int j = 1; j <= l; j++) marc[i][j] += marc[i][j - 1];
	}
	scanf("%d", &q);
	while(q--){
		int k;
		scanf("%d", &k);
		for(int i = 0; i < n - l + 1; i++)printf("%d ",marc[i][k] );
		printf("\n");
	}
}

Compilation message (stderr)

lot.cpp: In function 'int main()':
lot.cpp:9: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:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&v[i]);
   ~~~~~^~~~~~~~~~~~
lot.cpp:29:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &q);
  ~~~~~^~~~~~~~~~
lot.cpp:32:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &k);
   ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...