Submission #341225

# Submission time Handle Problem Language Result Execution time Memory
341225 2020-12-29T09:07:29 Z Habib_Assoev Simple game (IZhO17_game) C++14
22 / 100
3 ms 492 KB
# include<bits/stdc++.h>
#define in freopen ("measurement.in", "r", stdin);
#define out freopen("measurement.out", "w", stdout);
#define ll long long
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std ;
long long const N = 1e3 + 7;
long long N1 = 1e9 + 7;
double long k = 0;

int a[N];

int main( ){
    //in out
    speed ;
    ll TJK = 1 ;
    // cin >> TJK ;
    while( TJK -- ){
        int n, m;
        cin >> n >> m;
        for ( int i = 1; i <= n; i++ ) {
            cin >> a[i];
        }
        for ( int i = 1; i <= m; i++ ) {
            int t;
            cin >> t;
            if ( t == 2 ) {
                int h, cnt = 0;
                cin >> h;
                for ( int i = 2; i <= n; i++ ) {
                    if ( (a[i - 1] < h && a[i] > h) || (a[i - 1] > h && a[i] < h) ) {
                        cnt++;
                    }
                }
                cout << cnt << '\n';
            }
            else {
                int pos, val;
                cin >> pos >> val;
                a[pos] = val;
            }
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 3 ms 364 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 3 ms 364 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 3 ms 364 KB Output is correct
4 Correct 3 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -