Submission #659541

#TimeUsernameProblemLanguageResultExecution timeMemory
659541illyakrExam (eJOI20_exam)C++14
12 / 100
117 ms3088 KiB
#include <iostream> using namespace std; int n; int a[101010]; int b[101010]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) cin >> b[i]; int last = 1; int mx = 0; int ans = 0; for (int i = 1; i <= n; i++) { if (a[i] > b[i]) { if (mx == b[i]) ans += (i - last); last = i + 1; mx = 0; continue; } mx = max(mx, a[i]); continue; } if (mx == b[n]) ans += (n - last + 1); cout << ans; }
#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...