Submission #1014403

#TimeUsernameProblemLanguageResultExecution timeMemory
1014403amine_arouaSličnost (COI23_slicnost)C++17
7 / 100
3044 ms179708 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...