제출 #132020

#제출 시각아이디문제언어결과실행 시간메모리
132020VardanyanMatching (CEOI11_mat)C++14
54 / 100
2040 ms31440 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; set<int> ms; for(int i = 1;i<=n;i++) ms.insert(b[i]); for(int i = 1;i<=m;i++){ if(i+n-1>m) break; int nax = 0; bool f = true; if(*(ms.begin()) == b[pos[1]+i-1] && *(++ms.begin()) == b[pos[2]+i-1] && *(--ms.end()) == b[pos[n]+i-1]){ 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]; } } else f = false; if(f) ans.push_back(i); ms.erase(ms.find(b[i])); ms.insert(b[i+n]); } cout<<ans.size()<<endl; for(int i = 0;i<ans.size();i++) cout<<ans[i]<<" "; cout<<endl; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

mat.cpp: In function 'int main()':
mat.cpp:40: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...