Submission #132021

#TimeUsernameProblemLanguageResultExecution timeMemory
132021VardanyanMatching (CEOI11_mat)C++14
36 / 100
2065 ms6520 KiB
#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)

mat.cpp: In function 'int main()':
mat.cpp:33:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0;i<ans.size();i++) cout<<ans[i]<<" ";
                   ~^~~~~~~~~~~
#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...
#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...