#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define pll pair<ll, ll>
#define all(x) (x).begin(), (x).end()
ll l, n;
vector<ll> v;
vector<vector<ll>> v1;
void f(){
for(ll i=0; i<l; i++){
for(ll j=0; j<n-l+1; j++){
for(ll k=j+1; k<n-l+1; k++){
if(v[j+i]!=v[k+i]){
v1[j][k]++;
v1[k][j]++;
}
}
}
}
for(auto& u : v1) sort(all(u));
}
int main() {
cin >> n >> l;
v.resize(n); for(auto& u : v) cin >> u;
v1.assign(n-l+1, vector<ll>(n-l+1, 0));
f();
ll q; cin >> q;
while(q--){
ll x; cin >> x;
for(ll i=0; i<n-l+1; i++){
cout << (upper_bound(all(v1[i]), x)-v1[i].begin())-1 << ' ';
}
cout << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
13 ms |
484 KB |
Output is correct |
9 |
Correct |
8 ms |
428 KB |
Output is correct |
10 |
Correct |
6 ms |
852 KB |
Output is correct |
11 |
Correct |
7 ms |
852 KB |
Output is correct |
12 |
Correct |
10 ms |
852 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
13 ms |
484 KB |
Output is correct |
9 |
Correct |
8 ms |
428 KB |
Output is correct |
10 |
Correct |
6 ms |
852 KB |
Output is correct |
11 |
Correct |
7 ms |
852 KB |
Output is correct |
12 |
Correct |
10 ms |
852 KB |
Output is correct |
13 |
Correct |
136 ms |
31604 KB |
Output is correct |
14 |
Execution timed out |
3050 ms |
14292 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
43 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
43 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
13 ms |
484 KB |
Output is correct |
9 |
Correct |
8 ms |
428 KB |
Output is correct |
10 |
Correct |
6 ms |
852 KB |
Output is correct |
11 |
Correct |
7 ms |
852 KB |
Output is correct |
12 |
Correct |
10 ms |
852 KB |
Output is correct |
13 |
Correct |
136 ms |
31604 KB |
Output is correct |
14 |
Execution timed out |
3050 ms |
14292 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |