Submission #465962

#TimeUsernameProblemLanguageResultExecution timeMemory
465962fuad27Exam (eJOI20_exam)C++17
0 / 100
1083 ms1988 KiB
#include<bits/stdc++.h> using namespace std; int main () { int n; cin >> n; int a[n], b[n]; for(int i = 0;i<n;i++)cin>>a[i]; for(int i =0;i<n;i++)cin>>b[i]; for(int i = 0;i<n;i++) { if(a[i] == b[i]) { for(int j = i-1;j>=0;j--) { if(b[j] == a[i] and a[j] <= a[i]) { a[j] = a[i]; } else { break; } } for(int j = i+1;j<n;j++) { if(a[j] <= a[i]) { a[j] = a[i]; } else { break; } } } } int ans = 0; for(int i = 0;i<n;i++) { if(a[i] == b[i])ans++; } cout<<ans<<endl; }
#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...