Submission #833219

#TimeUsernameProblemLanguageResultExecution timeMemory
833219vjudge1Exam (eJOI20_exam)C++98
0 / 100
3 ms340 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define fi first #define se second const ll N = 1e5+10; ll n,ans; ll h[N],t[N]; bool vis[N]; int main() { cin >> n; for(int i=1; i<=n; i++) { cin >> h[i]; } for(int i=1; i<=n; i++) { cin >> t[i]; } for(int i=1; i<=n; i++) { if(h[i] == t[1]) { for(int j=i-1; j>=1; j++) { if(vis[j]) break; if(h[j] < h[i]) { h[j] = h[i]; vis[j] = true; } else break; } for(int j=i+1; j<=n; j++) { if(vis[j]) break; if(h[j] < h[i]) { h[j] = h[i]; vis[j] = true; } else break; } } } for(int i=1; i<=n; i++) if(h[i] == t[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...