Submission #259991

#TimeUsernameProblemLanguageResultExecution timeMemory
259991ly20Lottery (CEOI18_lot)C++17
0 / 100
240 ms65540 KiB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 11234;
int v[MAXN];
vector <int> in;
//int dif[MAXN][MAXN];
map <vector <int>, int> mp;
int main() {
	int id = 0;
	int n, l;
	scanf("%d %d", &n, &l);
	for(int i = 0; i < n; i++) {
		scanf("%d", &v[i]);
	}
	for(int i = 0; i + l - 1 < n; i++) {
		id++;
		for(int j = 0; j < l; j++) {
			in.push_back(v[i + j]);
		}
		mp[in]++;
		in.clear();
	}
	int q;
	scanf("%d", &q);
	for(int i = 0; i < q; i++) {
		int r;
		scanf("%d", &r);
		for(int j = 0; j < id; j++) {
			for(int o = 0; o < l; o++) {
				in.push_back(v[j + o]);
			}
			printf("%d ", mp[in] - 1);
			in.clear();
		}
		printf("\n");
	}
	return 0;
}

Compilation message (stderr)

lot.cpp: In function 'int main()':
lot.cpp:11: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:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &v[i]);
   ~~~~~^~~~~~~~~~~~~
lot.cpp:24:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &q);
  ~~~~~^~~~~~~~~~
lot.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &r);
   ~~~~~^~~~~~~~~~
#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...