답안 #259918

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
259918 2020-08-08T19:40:07 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 freq[MAXN];
map<queue<int>, int> code;
int cnt;

int main(){
	scanf("%d %d", &n, &l);
	for(int i = 1; i <= n; i++)
		scanf("%d", &v[i]);

	int fim = 1;
	queue<int> aux;
	vector<int> values;
	while(fim < l){
		aux.push(v[fim]);
		fim++;
	}
	while(fim <= n){
		aux.push(v[fim]);
		fim++;
		if(code[aux] == 0) code[aux] = ++cnt;
		freq[code[aux]]++;
		values.push_back(code[aux]);
		aux.pop();
	}
	scanf("%d", &q);
	for(int i = 1; i <= q; i++){
		int k;
		scanf("%d", &k);
		for(int i = 0; i < values.size(); i++)
			printf("%d ", freq[values[i]] - 1);
		printf("\n");
	}
}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:37:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < values.size(); i++)
                  ~~^~~~~~~~~~~~~~~
lot.cpp:14: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:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &v[i]);
   ~~~~~^~~~~~~~~~~~~
lot.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &q);
  ~~~~~^~~~~~~~~~
lot.cpp:36:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &k);
   ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -