# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
791847 |
2023-07-24T10:59:57 Z |
이성호(#10048) |
Sličnost (COI23_slicnost) |
C++17 |
|
3000 ms |
352 KB |
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
void get_ans(int n, int k, vector<int> &p, vector<int> &q)
{
vector<bool> used(n+1);
int ans = -1, cnt = 0;
for (int i = 0; i <= n - k; i++) {
for (int j = 0; j <= n - k; j++) {
fill(used.begin(), used.end(), false);
for (int a = i; a < i + k; a++) {
used[p[a]] = true;
}
int tmp = 0;
for (int b = j; b < j + k; b++) {
tmp += used[q[b]];
}
if (ans < tmp) {
ans = tmp;
cnt = 1;
}
else if (ans == tmp) cnt++;
}
}
cout << ans << ' ' << cnt << '\n';
}
int main()
{
int N, K, Q; cin >> N >> K >> Q;
vector<int> p(N), q(N);
for (int i = 0; i < N; i++) cin >> p[i];
for (int i = 0; i < N; i++) cin >> q[i];
get_ans(N, K, p, q);
while (Q--) {
int t; cin >> t;
swap(p[t-1], p[t]);
get_ans(N, K, p, q);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
275 ms |
352 KB |
Output is correct |
17 |
Correct |
390 ms |
352 KB |
Output is correct |
18 |
Correct |
4 ms |
340 KB |
Output is correct |
19 |
Execution timed out |
3083 ms |
348 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
275 ms |
352 KB |
Output is correct |
17 |
Correct |
390 ms |
352 KB |
Output is correct |
18 |
Correct |
4 ms |
340 KB |
Output is correct |
19 |
Execution timed out |
3083 ms |
348 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
10 ms |
212 KB |
Output is correct |
17 |
Correct |
7 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
32 ms |
212 KB |
Output is correct |
20 |
Correct |
24 ms |
296 KB |
Output is correct |
21 |
Correct |
4 ms |
212 KB |
Output is correct |
22 |
Correct |
49 ms |
212 KB |
Output is correct |
23 |
Correct |
16 ms |
212 KB |
Output is correct |
24 |
Correct |
21 ms |
212 KB |
Output is correct |
25 |
Correct |
25 ms |
212 KB |
Output is correct |
26 |
Correct |
8 ms |
212 KB |
Output is correct |
27 |
Correct |
7 ms |
212 KB |
Output is correct |
28 |
Correct |
11 ms |
212 KB |
Output is correct |
29 |
Correct |
31 ms |
212 KB |
Output is correct |
30 |
Correct |
10 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
275 ms |
352 KB |
Output is correct |
17 |
Correct |
390 ms |
352 KB |
Output is correct |
18 |
Correct |
4 ms |
340 KB |
Output is correct |
19 |
Execution timed out |
3083 ms |
348 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
275 ms |
352 KB |
Output is correct |
17 |
Correct |
390 ms |
352 KB |
Output is correct |
18 |
Correct |
4 ms |
340 KB |
Output is correct |
19 |
Execution timed out |
3083 ms |
348 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |