Submission #259979

# Submission time Handle Problem Language Result Execution time Memory
259979 2020-08-08T21:29:17 Z ly20 Lottery (CEOI18_lot) C++17
45 / 100
1421 ms 14880 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2010;
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 640 KB Output is correct
3 Correct 1 ms 768 KB Output is correct
4 Correct 4 ms 640 KB Output is correct
5 Correct 1 ms 640 KB Output is correct
6 Correct 1 ms 768 KB Output is correct
7 Correct 1 ms 768 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 7 ms 1536 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 640 KB Output is correct
3 Correct 1 ms 768 KB Output is correct
4 Correct 4 ms 640 KB Output is correct
5 Correct 1 ms 640 KB Output is correct
6 Correct 1 ms 768 KB Output is correct
7 Correct 1 ms 768 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 7 ms 1536 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 44 ms 8568 KB Output is correct
14 Correct 1421 ms 14880 KB Output is correct
15 Correct 1419 ms 14680 KB Output is correct
16 Correct 776 ms 11000 KB Output is correct
17 Correct 1122 ms 12664 KB Output is correct
18 Correct 1122 ms 12664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
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 640 KB Output is correct
3 Correct 1 ms 768 KB Output is correct
4 Correct 4 ms 640 KB Output is correct
5 Correct 1 ms 640 KB Output is correct
6 Correct 1 ms 768 KB Output is correct
7 Correct 1 ms 768 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 7 ms 1536 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 5 ms 1536 KB Output is correct
13 Correct 44 ms 8568 KB Output is correct
14 Correct 1421 ms 14880 KB Output is correct
15 Correct 1419 ms 14680 KB Output is correct
16 Correct 776 ms 11000 KB Output is correct
17 Correct 1122 ms 12664 KB Output is correct
18 Correct 1122 ms 12664 KB Output is correct
19 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Halted 0 ms 0 KB -