Submission #890419

# Submission time Handle Problem Language Result Execution time Memory
890419 2023-12-21T07:00:25 Z tigran Simple game (IZhO17_game) C++17
22 / 100
1000 ms 604 KB
#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main()
{
    int n, m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    while(m--){
        int q;
        cin>>q;
        if(q==1){
            int pos, val;
            cin>>pos>>val;
            a[pos]=val;
        }else{
            int h;
            cin>>h;
            int ans=0;
            for(int i=1;i<n;i++){
                if(min(a[i], a[i+1])<=h&&max(a[i], a[i+1])>=h) ans++;
                if(i!=1&&a[i]==h) ans--;
            }
            cout<<ans<<endl;
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 4 ms 420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 4 ms 420 KB Output is correct
8 Execution timed out 1079 ms 604 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 4 ms 420 KB Output is correct
8 Execution timed out 1079 ms 604 KB Time limit exceeded
9 Halted 0 ms 0 KB -