Submission #833343

#TimeUsernameProblemLanguageResultExecution timeMemory
833343vjudge1Exam (eJOI20_exam)C++14
12 / 100
58 ms1488 KiB
#include<bits/stdc++.h> using namespace std; int main(){ //12 poin :)) int n; cin>>n; vector<int> a(n+2),b(n+2),c(n+2); for(int i=1; i<=n; i++){ cin>>a[i]; } for(int i=1; i<=n; i++){ cin>>b[i]; } int x=b[1]; for(int i=1; i<=n;i++){ if(c[i]==1)continue; if(a[i]==x){ c[i]=1; int j=i+1; while(a[j]<=x&&j<=n){ a[j]=x; c[j]=1; j++; } j=i-1; while(a[j]<=x&&1<=j){ if(c[j]==1)break; a[j]=x; c[j]=1; j--; } } } int ans=0; for(int i=1;i<=n;i++){ // cout<<a[i]<<" "; if(a[i]==b[i])ans++; } cout<<ans<<"\n"; return 0; } /* 5 1 1 1 1 2 2 2 2 2 2 */
#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...