#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
#define intt long long
int main() {
int n , k , Q;
cin>>n>>k>>Q;
vector<vector<int>> a(2 , vector<int>(n));
for(int i = 0 ; i < 2 ; i++)
{
for(int j = 0 ; j < n ; j++)
{
cin>>a[i][j];
a[i][j]--;
}
}
vector<vector<bitset<N>>> bs(2 , vector<bitset<N>>(n));
for(int i = 0 ; i < 2 ; i++)
{
for(int j = 0 ; j < k ; j++)
{
bs[i][0][a[i][j]] = 1;
}
for(int j = 1 ; j + k - 1 < n ; j++)
{
bs[i][j] = bs[i][j - 1];
bs[i][j][a[i][j - 1]] = 0;
bs[i][j][a[i][j + k - 1]] = 1;
}
}
int ans = 0;
for(int i = 0 ; i + k - 1 < n ; i++)
{
for(int j = 0 ; j + k - 1 < n ; j++)
{
ans = max(ans , (int)(bs[0][i] & bs[1][j]).count());
}
}
intt nb = 0;
for(int i = 0 ; i + k - 1 < n ; i++)
{
for(int j = 0 ; j + k - 1 < n ; j++)
{
if(ans == (int)(bs[0][i] & bs[1][j]).count())
{
nb++;
}
}
}
cout<<ans<<' '<<nb;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
3932 KB |
Output is correct |
2 |
Correct |
75 ms |
3932 KB |
Output is correct |
3 |
Correct |
2 ms |
3928 KB |
Output is correct |
4 |
Correct |
20 ms |
3928 KB |
Output is correct |
5 |
Correct |
63 ms |
3932 KB |
Output is correct |
6 |
Correct |
86 ms |
3928 KB |
Output is correct |
7 |
Correct |
2 ms |
3932 KB |
Output is correct |
8 |
Correct |
64 ms |
3932 KB |
Output is correct |
9 |
Correct |
63 ms |
3928 KB |
Output is correct |
10 |
Correct |
32 ms |
3932 KB |
Output is correct |
11 |
Correct |
40 ms |
3932 KB |
Output is correct |
12 |
Correct |
64 ms |
3928 KB |
Output is correct |
13 |
Correct |
22 ms |
3928 KB |
Output is correct |
14 |
Correct |
13 ms |
3928 KB |
Output is correct |
15 |
Correct |
3 ms |
4184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
3932 KB |
Output is correct |
2 |
Correct |
75 ms |
3932 KB |
Output is correct |
3 |
Correct |
2 ms |
3928 KB |
Output is correct |
4 |
Correct |
20 ms |
3928 KB |
Output is correct |
5 |
Correct |
63 ms |
3932 KB |
Output is correct |
6 |
Correct |
86 ms |
3928 KB |
Output is correct |
7 |
Correct |
2 ms |
3932 KB |
Output is correct |
8 |
Correct |
64 ms |
3932 KB |
Output is correct |
9 |
Correct |
63 ms |
3928 KB |
Output is correct |
10 |
Correct |
32 ms |
3932 KB |
Output is correct |
11 |
Correct |
40 ms |
3932 KB |
Output is correct |
12 |
Correct |
64 ms |
3928 KB |
Output is correct |
13 |
Correct |
22 ms |
3928 KB |
Output is correct |
14 |
Correct |
13 ms |
3928 KB |
Output is correct |
15 |
Correct |
3 ms |
4184 KB |
Output is correct |
16 |
Execution timed out |
3044 ms |
179708 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
3932 KB |
Output is correct |
2 |
Correct |
75 ms |
3932 KB |
Output is correct |
3 |
Correct |
2 ms |
3928 KB |
Output is correct |
4 |
Correct |
20 ms |
3928 KB |
Output is correct |
5 |
Correct |
63 ms |
3932 KB |
Output is correct |
6 |
Correct |
86 ms |
3928 KB |
Output is correct |
7 |
Correct |
2 ms |
3932 KB |
Output is correct |
8 |
Correct |
64 ms |
3932 KB |
Output is correct |
9 |
Correct |
63 ms |
3928 KB |
Output is correct |
10 |
Correct |
32 ms |
3932 KB |
Output is correct |
11 |
Correct |
40 ms |
3932 KB |
Output is correct |
12 |
Correct |
64 ms |
3928 KB |
Output is correct |
13 |
Correct |
22 ms |
3928 KB |
Output is correct |
14 |
Correct |
13 ms |
3928 KB |
Output is correct |
15 |
Correct |
3 ms |
4184 KB |
Output is correct |
16 |
Execution timed out |
3044 ms |
179708 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
3932 KB |
Output is correct |
2 |
Correct |
75 ms |
3932 KB |
Output is correct |
3 |
Correct |
2 ms |
3928 KB |
Output is correct |
4 |
Correct |
20 ms |
3928 KB |
Output is correct |
5 |
Correct |
63 ms |
3932 KB |
Output is correct |
6 |
Correct |
86 ms |
3928 KB |
Output is correct |
7 |
Correct |
2 ms |
3932 KB |
Output is correct |
8 |
Correct |
64 ms |
3932 KB |
Output is correct |
9 |
Correct |
63 ms |
3928 KB |
Output is correct |
10 |
Correct |
32 ms |
3932 KB |
Output is correct |
11 |
Correct |
40 ms |
3932 KB |
Output is correct |
12 |
Correct |
64 ms |
3928 KB |
Output is correct |
13 |
Correct |
22 ms |
3928 KB |
Output is correct |
14 |
Correct |
13 ms |
3928 KB |
Output is correct |
15 |
Correct |
3 ms |
4184 KB |
Output is correct |
16 |
Incorrect |
82 ms |
3928 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
3932 KB |
Output is correct |
2 |
Correct |
75 ms |
3932 KB |
Output is correct |
3 |
Correct |
2 ms |
3928 KB |
Output is correct |
4 |
Correct |
20 ms |
3928 KB |
Output is correct |
5 |
Correct |
63 ms |
3932 KB |
Output is correct |
6 |
Correct |
86 ms |
3928 KB |
Output is correct |
7 |
Correct |
2 ms |
3932 KB |
Output is correct |
8 |
Correct |
64 ms |
3932 KB |
Output is correct |
9 |
Correct |
63 ms |
3928 KB |
Output is correct |
10 |
Correct |
32 ms |
3932 KB |
Output is correct |
11 |
Correct |
40 ms |
3932 KB |
Output is correct |
12 |
Correct |
64 ms |
3928 KB |
Output is correct |
13 |
Correct |
22 ms |
3928 KB |
Output is correct |
14 |
Correct |
13 ms |
3928 KB |
Output is correct |
15 |
Correct |
3 ms |
4184 KB |
Output is correct |
16 |
Execution timed out |
3044 ms |
179708 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
3932 KB |
Output is correct |
2 |
Correct |
75 ms |
3932 KB |
Output is correct |
3 |
Correct |
2 ms |
3928 KB |
Output is correct |
4 |
Correct |
20 ms |
3928 KB |
Output is correct |
5 |
Correct |
63 ms |
3932 KB |
Output is correct |
6 |
Correct |
86 ms |
3928 KB |
Output is correct |
7 |
Correct |
2 ms |
3932 KB |
Output is correct |
8 |
Correct |
64 ms |
3932 KB |
Output is correct |
9 |
Correct |
63 ms |
3928 KB |
Output is correct |
10 |
Correct |
32 ms |
3932 KB |
Output is correct |
11 |
Correct |
40 ms |
3932 KB |
Output is correct |
12 |
Correct |
64 ms |
3928 KB |
Output is correct |
13 |
Correct |
22 ms |
3928 KB |
Output is correct |
14 |
Correct |
13 ms |
3928 KB |
Output is correct |
15 |
Correct |
3 ms |
4184 KB |
Output is correct |
16 |
Execution timed out |
3044 ms |
179708 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |