Submission #667196

# Submission time Handle Problem Language Result Execution time Memory
667196 2022-11-30T17:18:24 Z illyakr Exam (eJOI20_exam) C++14
12 / 100
75 ms 3848 KB
//#pragma GCC optimize("inline,Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,abm")
#include <bits/stdc++.h>
#define ll long long
#define int ll
typedef long double ld;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define y0 dfgoert
#define y1 kjsjofd
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 998244353;
const long long INF1e9 = 1010101010;
const long long INF1e18 = 1010101010101010101;
const long long INF1e15 = 1010101010101010;
const ld PI = 3.14159265358979323846264338327950288419716939937510;

int n;
int a[101010];
int b[101010];

bool block2 = true;
void solve() {
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++)
        cin >> b[i];

    for (int i = 1; i <= n; i++) {
        if (b[i] != b[1]) {block2 = false;break;}
    }
    if (block2) {
        int mx = 0;
        int ans = 0, l = 1;
        for (int i = 1; i <= n; i++) {
            if (a[i] > b[i]) {
                if (mx == b[i])
                    ans += (i - l);
                l = i + 1;
                mx = a[i + 1];
                continue;
            }
            mx = max(mx, a[i]);
        }
        if (mx == b[n])
            ans += (n - l + 1);

        cout << ans;
        return;
    }
    exit(1);
}

int32_t main() {
//    fast
    int t = 1;
//    cin >> t;
    for (int id = 1; id <= t; id++) {
        solve();
    }
    return 0;
}
/**
*/
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 16 ms 1000 KB Output is correct
3 Correct 47 ms 2700 KB Output is correct
4 Correct 26 ms 2192 KB Output is correct
5 Correct 74 ms 3848 KB Output is correct
6 Correct 26 ms 2168 KB Output is correct
7 Correct 31 ms 2388 KB Output is correct
8 Correct 75 ms 3736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 468 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -