# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132021 | Vardanyan | Matching (CEOI11_mat) | C++14 | 2065 ms | 6520 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 1000*1000+5;
int a[N];
int b[N];
int pos[N];
int main(){
ios_base::sync_with_stdio(false);
int n,m;
cin>>n>>m;
for(int i = 1;i<=n;i++){
cin>>a[i];
pos[i] = a[i];
}
for(int i = 1;i<=m;i++) cin>>b[i];
vector<int> ans;
for(int i = 1;i<=m;i++){
if(i+n-1>m) break;
int nax = 0;
bool f = true;
for(int j = 1;j<=n;j++){
int x = pos[j];
if(b[x+i-1]<nax){
f = false;
break;
}
nax = b[x+i-1];
}
if(f) ans.push_back(i);
}
cout<<ans.size()<<endl;
for(int i = 0;i<ans.size();i++) cout<<ans[i]<<" ";
cout<<endl;
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... |
# | 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... |