이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;
ll N, l, Q, val[355], ans[355][355];
signed main()
{
ios::sync_with_stdio(0), cin.tie(0);
cin >> N >> l;
for (int i = 1; i <= N; i++)
cin >> val[i];
for (int i = 1; i <= N - l + 1; i++)
for (int j = i + 1; j <= N - l + 1; j++)
{
map<int, int> mp;
int k = l;
for (int x = 0; x < l; x++)
if(val[x + i] == val[x + j])
k--;
ans[i][k]++;
ans[j][k]++;
//cout << i << " " << j << " " << k << '\n';
}
for (int i = 1; i <= N - l + 1; i++)
for (int j = 1; j <= l; j++)
ans[i][j] += ans[i][j - 1];
cin >> Q;
for (int i = 1; i <= Q; i++)
{
int k;
cin >> k;
for (int j = 1; j <= N - l + 1; j++)
cout << ans[j][k] << " \n"[j == N - l + 1];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |