제출 #259910

#제출 시각아이디문제언어결과실행 시간메모리
259910peuchLottery (CEOI18_lot)C++17
0 / 100
1 ms384 KiB
#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");
	}
}

컴파일 시 표준 에러 (stderr) 메시지

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 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...