Submission #259994

# Submission time Handle Problem Language Result Execution time Memory
259994 2020-08-08T21:58:24 Z ly20 Lottery (CEOI18_lot) C++17
45 / 100
1418 ms 42024 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10010;
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 1 ms 512 KB Output is correct
2 Correct 1 ms 896 KB Output is correct
3 Correct 1 ms 896 KB Output is correct
4 Correct 1 ms 768 KB Output is correct
5 Correct 1 ms 768 KB Output is correct
6 Correct 1 ms 896 KB Output is correct
7 Correct 1 ms 896 KB Output is correct
8 Correct 5 ms 1408 KB Output is correct
9 Correct 7 ms 1536 KB Output is correct
10 Correct 4 ms 1792 KB Output is correct
11 Correct 4 ms 1792 KB Output is correct
12 Correct 5 ms 1792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 896 KB Output is correct
3 Correct 1 ms 896 KB Output is correct
4 Correct 1 ms 768 KB Output is correct
5 Correct 1 ms 768 KB Output is correct
6 Correct 1 ms 896 KB Output is correct
7 Correct 1 ms 896 KB Output is correct
8 Correct 5 ms 1408 KB Output is correct
9 Correct 7 ms 1536 KB Output is correct
10 Correct 4 ms 1792 KB Output is correct
11 Correct 4 ms 1792 KB Output is correct
12 Correct 5 ms 1792 KB Output is correct
13 Correct 40 ms 8824 KB Output is correct
14 Correct 1397 ms 15016 KB Output is correct
15 Correct 1418 ms 15028 KB Output is correct
16 Correct 791 ms 11256 KB Output is correct
17 Correct 1024 ms 12952 KB Output is correct
18 Correct 1062 ms 13048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 847 ms 42024 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 847 ms 42024 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 896 KB Output is correct
3 Correct 1 ms 896 KB Output is correct
4 Correct 1 ms 768 KB Output is correct
5 Correct 1 ms 768 KB Output is correct
6 Correct 1 ms 896 KB Output is correct
7 Correct 1 ms 896 KB Output is correct
8 Correct 5 ms 1408 KB Output is correct
9 Correct 7 ms 1536 KB Output is correct
10 Correct 4 ms 1792 KB Output is correct
11 Correct 4 ms 1792 KB Output is correct
12 Correct 5 ms 1792 KB Output is correct
13 Correct 40 ms 8824 KB Output is correct
14 Correct 1397 ms 15016 KB Output is correct
15 Correct 1418 ms 15028 KB Output is correct
16 Correct 791 ms 11256 KB Output is correct
17 Correct 1024 ms 12952 KB Output is correct
18 Correct 1062 ms 13048 KB Output is correct
19 Runtime error 847 ms 42024 KB Memory limit exceeded
20 Halted 0 ms 0 KB -