#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;
bool done = true;
rep(z, 0, L) {
if (v[j + z] != v[i + z])val++;
if (val > k)done = false;
}
if (done)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;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
6 ms |
204 KB |
Output is correct |
3 |
Correct |
4 ms |
204 KB |
Output is correct |
4 |
Correct |
3 ms |
204 KB |
Output is correct |
5 |
Correct |
1 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 |
82 ms |
304 KB |
Output is correct |
9 |
Correct |
80 ms |
204 KB |
Output is correct |
10 |
Correct |
34 ms |
204 KB |
Output is correct |
11 |
Correct |
25 ms |
208 KB |
Output is correct |
12 |
Correct |
49 ms |
324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
6 ms |
204 KB |
Output is correct |
3 |
Correct |
4 ms |
204 KB |
Output is correct |
4 |
Correct |
3 ms |
204 KB |
Output is correct |
5 |
Correct |
1 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 |
82 ms |
304 KB |
Output is correct |
9 |
Correct |
80 ms |
204 KB |
Output is correct |
10 |
Correct |
34 ms |
204 KB |
Output is correct |
11 |
Correct |
25 ms |
208 KB |
Output is correct |
12 |
Correct |
49 ms |
324 KB |
Output is correct |
13 |
Correct |
165 ms |
352 KB |
Output is correct |
14 |
Execution timed out |
3064 ms |
444 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
957 ms |
544 KB |
Output is correct |
2 |
Correct |
1487 ms |
416 KB |
Output is correct |
3 |
Correct |
619 ms |
396 KB |
Output is correct |
4 |
Execution timed out |
3066 ms |
380 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
957 ms |
544 KB |
Output is correct |
2 |
Correct |
1487 ms |
416 KB |
Output is correct |
3 |
Correct |
619 ms |
396 KB |
Output is correct |
4 |
Execution timed out |
3066 ms |
380 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
6 ms |
204 KB |
Output is correct |
3 |
Correct |
4 ms |
204 KB |
Output is correct |
4 |
Correct |
3 ms |
204 KB |
Output is correct |
5 |
Correct |
1 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 |
82 ms |
304 KB |
Output is correct |
9 |
Correct |
80 ms |
204 KB |
Output is correct |
10 |
Correct |
34 ms |
204 KB |
Output is correct |
11 |
Correct |
25 ms |
208 KB |
Output is correct |
12 |
Correct |
49 ms |
324 KB |
Output is correct |
13 |
Correct |
165 ms |
352 KB |
Output is correct |
14 |
Execution timed out |
3064 ms |
444 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |