Submission #167819

# Submission time Handle Problem Language Result Execution time Memory
167819 2019-12-10T09:31:49 Z kostia244 Lottery (CEOI18_lot) C++17
25 / 100
189 ms 65540 KB
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
using vi = vector<ll>;
int n, l;
vi a;
int cmp(int x, int y) {
	int t = 0;
	for (int i = 0; i < l; i++)
		t += a[x + i] != a[y + i];
	return t;
}
vi t[10100];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> l;
	a.resize(n);
	for (auto &i : a)
		cin >> i;
	for (int i = 0; i + l - 1 < n; i++) {
		for (int j = i+1; j + l - 1 < n; j++) {
			t[i].pb(cmp(i, j));
			t[j].pb(t[i].back());
		}
	}
	for(int i = 0; i < n; i++)
		sort(all(t[i]));
	int q, z;
	cin >> q;
	while(q--) {
		cin >> z;
		for(int i = 0; i + l - 1 < n; i++) {
			auto it = upper_bound(all(t[i]), z);
			cout << (it-t[i].begin()) << ' ';
		}
		cout << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 632 KB Output is correct
2 Correct 3 ms 632 KB Output is correct
3 Correct 3 ms 636 KB Output is correct
4 Correct 3 ms 632 KB Output is correct
5 Correct 2 ms 632 KB Output is correct
6 Correct 3 ms 632 KB Output is correct
7 Correct 3 ms 632 KB Output is correct
8 Correct 5 ms 888 KB Output is correct
9 Correct 5 ms 888 KB Output is correct
10 Correct 7 ms 1784 KB Output is correct
11 Correct 6 ms 1784 KB Output is correct
12 Correct 6 ms 1784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 632 KB Output is correct
2 Correct 3 ms 632 KB Output is correct
3 Correct 3 ms 636 KB Output is correct
4 Correct 3 ms 632 KB Output is correct
5 Correct 2 ms 632 KB Output is correct
6 Correct 3 ms 632 KB Output is correct
7 Correct 3 ms 632 KB Output is correct
8 Correct 5 ms 888 KB Output is correct
9 Correct 5 ms 888 KB Output is correct
10 Correct 7 ms 1784 KB Output is correct
11 Correct 6 ms 1784 KB Output is correct
12 Correct 6 ms 1784 KB Output is correct
13 Runtime error 155 ms 32968 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 189 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 189 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 632 KB Output is correct
2 Correct 3 ms 632 KB Output is correct
3 Correct 3 ms 636 KB Output is correct
4 Correct 3 ms 632 KB Output is correct
5 Correct 2 ms 632 KB Output is correct
6 Correct 3 ms 632 KB Output is correct
7 Correct 3 ms 632 KB Output is correct
8 Correct 5 ms 888 KB Output is correct
9 Correct 5 ms 888 KB Output is correct
10 Correct 7 ms 1784 KB Output is correct
11 Correct 6 ms 1784 KB Output is correct
12 Correct 6 ms 1784 KB Output is correct
13 Runtime error 155 ms 32968 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
14 Halted 0 ms 0 KB -