Submission #833304

# Submission time Handle Problem Language Result Execution time Memory
833304 2023-08-22T04:22:17 Z vjudge1 Exam (eJOI20_exam) C++17
0 / 100
4 ms 468 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(maxx, h[i]);
        } else {
            for (int j = l; j < i; j++) {
                h[j] = maxx;
            }
            maxx = 0;
            l = i + 1;
        }
    }
    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 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 4 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -