Submission #877372

# Submission time Handle Problem Language Result Execution time Memory
877372 2023-11-23T07:56:20 Z marcid Simple game (IZhO17_game) C++17
22 / 100
1000 ms 5204 KB
//izho17_2A
#include <bits/stdc++.h>
#define int long long
const int maxn = 1e6+1;
using namespace std;
int a[maxn], n, m, heights[maxn];
//int op(int u, int v) {
//    return ;
//}
/*int get(int v = 1, int tl = 1, int tr = n, int h) {
    if (l > tr || tl > r) return 0;
    if (l <= tl && tr <= r) return tree[v];
    int mid = tl+tr>>1;
    return get(v*2,tl,mid,h)+get(v*2+1,mid+1,tr,h);
}

void build(int v = 1, int tl = 1, int tr = n) {
    if (tl==tr) {
        tree[v]=a[tl]; return;
    } int mid = tl+tr>>1;
    build(v*2,tl,mid); build(v*2+1,mid+1,tr);
    tree[v]=op(tree[v*2],tree[v*2+1]);
    .
}*/

signed main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (;m--;) {
        int k; cin >> k;
        if (k-1) {
            int c; cin >> c; int cnt = 0;
            for (int i = 2; i <= n; i++) {
                cnt += ((a[i]>=c && a[i-1]<=c) || (a[i]<=c && a[i-1]>=c));
            } cout << cnt << '\n';
        } else {
            int pos, val; cin >> pos >> val;
            a[pos]=val;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 3 ms 2396 KB Output is correct
3 Correct 3 ms 2512 KB Output is correct
4 Correct 3 ms 2396 KB Output is correct
5 Correct 4 ms 2504 KB Output is correct
6 Correct 3 ms 2392 KB Output is correct
7 Correct 3 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 3 ms 2396 KB Output is correct
3 Correct 3 ms 2512 KB Output is correct
4 Correct 3 ms 2396 KB Output is correct
5 Correct 4 ms 2504 KB Output is correct
6 Correct 3 ms 2392 KB Output is correct
7 Correct 3 ms 2396 KB Output is correct
8 Execution timed out 1068 ms 5204 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 3 ms 2396 KB Output is correct
3 Correct 3 ms 2512 KB Output is correct
4 Correct 3 ms 2396 KB Output is correct
5 Correct 4 ms 2504 KB Output is correct
6 Correct 3 ms 2392 KB Output is correct
7 Correct 3 ms 2396 KB Output is correct
8 Execution timed out 1068 ms 5204 KB Time limit exceeded
9 Halted 0 ms 0 KB -