Submission #259910

# Submission time Handle Problem Language Result Execution time Memory
259910 2020-08-08T19:29:18 Z peuch Lottery (CEOI18_lot) C++17
0 / 100
1 ms 384 KB
#include<bits/stdc++.h>
using namespace std;

const int MAXN = 2010;

int n, l, q;
int v[MAXN];

int intr[MAXN][MAXN];
map<int, vector<int> > marc;

int eql[MAXN][MAXN];

int ans[MAXN][MAXN];

int main(){
	scanf("%d %d", &n, &l);
	for(int i = 1; i <= n; i++)
		scanf("%d", &v[i]);
	for(int i = 1; i <= n - l + 1; i++){
		for(int j = 0; j < l; j++){
			intr[i][j + 1] = v[i + j];
			printf("%d ", intr[i][j + 1]);
		}
		printf("\n");
	}
	for(int i = 1; i <= l; i++){
		marc.clear();
		for(int j = 1; j <= n - l + 1; j++)
			marc[intr[j][i]].push_back(j);
		for(int j = 1; j <= n - l + 1; j++)
			for(int k = 0; k < marc[intr[j][i]].size(); k++)
				eql[j][marc[intr[j][i]][k]]++;	
	}
	for(int i = 1; i <= n - l + 1; i++)
		for(int j = 1; j <= n - l + 1; j++){
			if(j == i) continue;
			ans[i][l - eql[i][j]]++;
		}
	for(int i = 1; i <= n - l + 1; i++)
		for(int j = 1; j <= l; j++)
			ans[i][j] += ans[i][j - 1];

	scanf("%d", &q);
	for(int i = 1; i <= q; i++){
		int k;
		scanf("%d", &k);
		for(int i = 1; i <= n - l + 1; i++)
			printf("%d ", ans[i][k]);
		printf("\n");
	}
}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:32:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int k = 0; k < marc[intr[j][i]].size(); k++)
                   ~~^~~~~~~~~~~~~~~~~~~~~~~~~
lot.cpp:17: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:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &v[i]);
   ~~~~~^~~~~~~~~~~~~
lot.cpp:44:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &q);
  ~~~~~^~~~~~~~~~
lot.cpp:47:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &k);
   ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 288 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 288 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -