Submission #839798

# Submission time Handle Problem Language Result Execution time Memory
839798 2023-08-30T16:23:30 Z tshabanov7 Exam (eJOI20_exam) C++17
12 / 100
19 ms 3156 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }

    bool subtask2 = true;
    for (int i = 0; i < n; i++) {
        subtask2 &= b[i] == b[0];
    }

    if (subtask2) {
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] > b[0]) {
                continue;
            }

            bool ok = false;
            int j = i;
            while (j < n && a[j] <= b[0]) {
                ok |= a[j] == b[0];
                j++;
            }

            if (ok) {
                ans += j - i;
            }
            i = j - 1;
        }

        cout << ans << '\n';
    }

    return 0;
}
# 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 Correct 1 ms 340 KB Output is correct
2 Correct 4 ms 852 KB Output is correct
3 Correct 11 ms 2004 KB Output is correct
4 Correct 8 ms 1492 KB Output is correct
5 Correct 16 ms 3156 KB Output is correct
6 Correct 9 ms 1492 KB Output is correct
7 Correct 9 ms 1620 KB Output is correct
8 Correct 19 ms 3020 KB Output is correct
# 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 212 KB Output isn't correct
2 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 -