Submission #699274

# Submission time Handle Problem Language Result Execution time Memory
699274 2023-02-16T11:19:33 Z mmmmaasss Exam (eJOI20_exam) C++14
12 / 100
121 ms 3116 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main()
{
   int n;cin >> n;
   int rr = 0;
    vector<int> a(n + 1) , b(n + 1);
    for(int i = 1;i <= n;i ++){
        cin >> a[i];
    }
    for(int i = 1;i <= n;i ++){
        cin >> b[i];
    }
    ll ans = 0;
    for(int i = 1;i <= n;i ++){
        if(a[i] != b[i]){
            continue;
        }
        ll l = i , r = i;
        while(r < n && a[r + 1] <= b[i]){
            ++ r;
        }
        while(l > 1 && l >= rr && a[l - 1] <= b[i]){
            -- l;
        }
        if(r > rr)ans += r - l + 1;
        rr = r;
    }
    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 22 ms 812 KB Output is correct
3 Correct 44 ms 2008 KB Output is correct
4 Correct 25 ms 1364 KB Output is correct
5 Correct 74 ms 3116 KB Output is correct
6 Correct 28 ms 1492 KB Output is correct
7 Correct 121 ms 1620 KB Output is correct
8 Correct 69 ms 2992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 216 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -