Submission #259962

# Submission time Handle Problem Language Result Execution time Memory
259962 2020-08-08T21:07:25 Z ly20 Lottery (CEOI18_lot) C++17
25 / 100
5 ms 896 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 310;
int v[MAXN];
vector <int> in[MAXN];
int dif[MAXN][MAXN];
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[i].push_back(v[i + j]);
		}
	}
	for(int i = 0; i < id; i++) {
		//for(int m = 0; m < l; m++) {
		///	printf("%d ", in[i][m]);
		//}
		//printf("\n");
		for(int j = 0; j < id; j++) {
			if(j == i) continue;
			int k = 0;
			for(int m = 0; m < l; m++) {
				if(in[i][m] != in[j][m]) k++;
			}
			dif[i][k]++;
		}
	}
	for(int i = 0 ; i < id; i++) {
		for(int j = 1; j <= l; j++) {
			dif[i][j] += dif[i][j - 1];
		}
	} 
	int q;
	scanf("%d", &q);
	for(int i = 0; i < q; i++) {
		int r;
		scanf("%d", &r);
		for(int i = 0; i < id; i++) {
			printf("%d ", dif[i][r]);
		}
		printf("\n");
	}
	return 0;
}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:10: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:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &v[i]);
   ~~~~~^~~~~~~~~~~~~
lot.cpp:40:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &q);
  ~~~~~^~~~~~~~~~
lot.cpp:43:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &r);
   ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 5 ms 640 KB Output is correct
9 Correct 5 ms 640 KB Output is correct
10 Correct 4 ms 896 KB Output is correct
11 Correct 3 ms 768 KB Output is correct
12 Correct 5 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 5 ms 640 KB Output is correct
9 Correct 5 ms 640 KB Output is correct
10 Correct 4 ms 896 KB Output is correct
11 Correct 3 ms 768 KB Output is correct
12 Correct 5 ms 768 KB Output is correct
13 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 5 ms 640 KB Output is correct
9 Correct 5 ms 640 KB Output is correct
10 Correct 4 ms 896 KB Output is correct
11 Correct 3 ms 768 KB Output is correct
12 Correct 5 ms 768 KB Output is correct
13 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Halted 0 ms 0 KB -