Submission #593408

# Submission time Handle Problem Language Result Execution time Memory
593408 2022-07-11T05:23:57 Z zeroesandones Simple game (IZhO17_game) C++17
0 / 100
11 ms 15956 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

#define FOR(i, j, k) for (ll i = j; i < (ll) k; ++i)
#define FORD(i, j, k) for (ll i = j; i >= (ll) k; --i)
#define nl "\n"
#define all(x) (x).begin(), (x).end()

#define sc second
#define fr first
#define pb push_back

void solve()
{
    ll n, m;
    cin >> n >> m;

    ll a[n];
    ll mx = (ll) 1e6 + 5;
    FOR(i, 0, n) {
        cin >> a[i];
    }

    ll lines[mx] = {};
    ll sum[mx] = {};

    FOR(i, 1, n) {
        ++lines[min(a[i - 1], a[i]) + 1];
        --lines[max(a[i - 1], a[i])];
    }

    sum[0] = lines[0];
    FOR(i, 1, mx) {
        sum[i] = sum[i - 1] + lines[i];
    }
    FOR(i, 0, m) {
        ll x, h;
        cin >> x >> h;
        cout << sum[h] << nl;
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);

    ll t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 15956 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 15956 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 15956 KB Output isn't correct
2 Halted 0 ms 0 KB -