| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1327602 | d_k | Sličnost (COI23_slicnost) | C++20 | 3094 ms | 1080 KiB |
/*Bismillahir Rahmanir Raheem*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define pb push_back
const int inf = 1e9 + 7;
const int N = 5e5 + 5;
const int MOD = 1e9 + 7;
void ma1n() {
int n, k, q;
cin>>n>>k>>q;
vector<int> a(n + 1), b(n + 1);
for(int i = 1; i <= n; i++) cin>>a[i];
for(int i = 1; i <= n; i++) cin>>b[i];
vector<vector<int> > col1, col2;
for(int i = k; i <= n; i++){
vector<int> c1, c2;
for(int j = i - k + 1; j <= i; j++){
c1.pb(a[j]); c2.pb(b[j]);
}
sort(c1.begin(), c1.end());
sort(c2.begin(), c2.end());
col1.pb(c1); col2.pb(c2);
}
int mx = 0, col = 0;
for(int i = 0; i < col1.size(); i++){
for(int j = 0; j < col2.size(); j++){
int num = 0;
for(int k = 1; k <= n; k++){
auto it1 = find(col1[i].begin(), col1[i].end(), k);
auto it2 = find(col2[j].begin(), col2[j].end(), k);
if(it1 != col1[i].end() and it2 != col2[j].end()){
num ++;
}
}
if(mx == num) col++;
if(mx < num){
col = 1;
mx = num;
}
}
}
cout<<mx<<" "<<col<<"\n";
}
main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
// cin >> T;
while(T--) {
ma1n();
}
return 0;
}
Compilation message (stderr)
| # | 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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
