Submission #1014402

# Submission time Handle Problem Language Result Execution time Memory
1014402 2024-07-04T20:21:24 Z amine_aroua Sličnost (COI23_slicnost) C++17
0 / 100
44 ms 3928 KB
#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<<'\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 3928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 3928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 3928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 3928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 3928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 3928 KB Output isn't correct
2 Halted 0 ms 0 KB -