Submission #833313

# Submission time Handle Problem Language Result Execution time Memory
833313 2023-08-22T04:28:37 Z vjudge1 Exam (eJOI20_exam) C++17
12 / 100
17 ms 1108 KB
#include <bits/stdc++.h>
using namespace std;

int n;
int h[100005];
int t[100005];

void dua() {
    int l = 0, maxx = 0;
    for (int i = 0; i < n; i++) {
        if (h[i] <= t[0]) {
            maxx = max(h[i], maxx);
        } else {
            for (int j = l; j < i; j++) {
                h[j] = maxx;
            }
            maxx = 0;
            l = i + 1;
        }
    }
    for (int j = l; j < n; j++) {
        h[j] = maxx;
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (h[i] == t[i]) {
            ans++;
        }
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> t[i];
    }

    /*
    // subtask 2
    bool two = 1;
    for (int i = 1; i < n; i++) {
        if (t[i] != t[i-1]) {
            two = 0;
            break;
        }
    }
    if (two) {
        dua();
        return 0;
    }
    */
    dua();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Correct 11 ms 980 KB Output is correct
4 Correct 8 ms 1108 KB Output is correct
5 Correct 16 ms 1100 KB Output is correct
6 Correct 8 ms 1108 KB Output is correct
7 Correct 10 ms 1108 KB Output is correct
8 Correct 17 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -