Submission #396686

# Submission time Handle Problem Language Result Execution time Memory
396686 2021-04-30T15:27:26 Z abdzag Lottery (CEOI18_lot) C++17
25 / 100
3000 ms 568 KB
#include<bits/stdc++.h>

#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define rrep(i,a,b) for(int i=int(a);i>int(b); i--);
#define all(v) v.begin(),v.end()
#define trav(a,v) for(auto&a:v)

using namespace std;
const long long inf = 1e15;
typedef long long ll;

int main(){
	cin.sync_with_stdio(false);
	ll n,L;
	cin >> n >> L;
	vector<ll> v(n);
	rep(i, 0, n) cin >> v[i];
	ll q;
	cin >> q;
	rep(o, 0, q) {
		ll k;
		cin >> k;

		rep(i, 0, n - L + 1) {
			ll l = i, r = i + L;
			ll ans = 0;
			rep(j, 0, n - L + 1) {
				if (j == i)continue;
				ll val = 0;
				rep(z, 0, L) {
					if (v[j + z] != v[i + z])val++;
				}
				if (val <=k)ans++;
			}
			cout << ans << " ";
		}
		cout << endl;
	}
	return 0;
}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:25:7: warning: unused variable 'l' [-Wunused-variable]
   25 |    ll l = i, r = i + L;
      |       ^
lot.cpp:25:14: warning: unused variable 'r' [-Wunused-variable]
   25 |    ll l = i, r = i + L;
      |              ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 5 ms 204 KB Output is correct
3 Correct 4 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 3 ms 204 KB Output is correct
8 Correct 66 ms 204 KB Output is correct
9 Correct 44 ms 204 KB Output is correct
10 Correct 28 ms 332 KB Output is correct
11 Correct 24 ms 328 KB Output is correct
12 Correct 35 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 5 ms 204 KB Output is correct
3 Correct 4 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 3 ms 204 KB Output is correct
8 Correct 66 ms 204 KB Output is correct
9 Correct 44 ms 204 KB Output is correct
10 Correct 28 ms 332 KB Output is correct
11 Correct 24 ms 328 KB Output is correct
12 Correct 35 ms 336 KB Output is correct
13 Correct 153 ms 336 KB Output is correct
14 Execution timed out 3076 ms 460 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 872 ms 568 KB Output is correct
2 Correct 1577 ms 544 KB Output is correct
3 Correct 589 ms 528 KB Output is correct
4 Execution timed out 3063 ms 460 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 872 ms 568 KB Output is correct
2 Correct 1577 ms 544 KB Output is correct
3 Correct 589 ms 528 KB Output is correct
4 Execution timed out 3063 ms 460 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 5 ms 204 KB Output is correct
3 Correct 4 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 3 ms 204 KB Output is correct
8 Correct 66 ms 204 KB Output is correct
9 Correct 44 ms 204 KB Output is correct
10 Correct 28 ms 332 KB Output is correct
11 Correct 24 ms 328 KB Output is correct
12 Correct 35 ms 336 KB Output is correct
13 Correct 153 ms 336 KB Output is correct
14 Execution timed out 3076 ms 460 KB Time limit exceeded
15 Halted 0 ms 0 KB -