Submission #592919

# Submission time Handle Problem Language Result Execution time Memory
592919 2022-07-09T20:01:33 Z PMPRR Simple game (IZhO17_game) C++17
22 / 100
1000 ms 848 KB
#include <bits/stdc++.h>
#define pb push_back
#define MAXN 100010
using namespace std;

std::vector<int> v;
//multiset<int> parcial;
int main(){
    int n,m; cin >> n >> m;
    //cout << "n: " << n << endl;
    //cout << "m: " << m << endl;
    v.pb(0);
    for(int i=1;i<=n;i++){
        int a; cin >> a;
        v.pb(a);
        //cout << "v[" << i << "]= "<< v[i] << endl;
        //for(int j = v[i-1];j<a;j++)
        //parcial.insert(a)
    }
    
    for(int i=0;i<m;i++){
        int a; cin >> a;
        //cout << "a: " << a << endl;
        if(a == 1){
            int b,c; cin >> b >> c;
            v[b] = c;
        }
        if(a == 2){
            int b; cin >> b;
            int resp = 0;
            //cout << "b: " << b << endl;
            for(int j=2;j<=n;j++){
                //cout << "v[" << j << "] = " << v[j];
                //cout << "  v[" << j-1 << "] = " << v[j-1] << endl;
                if(v[j] >= b && v[j-1] <= b) resp++;
                if(v[j-1] >= b && v[j] <= b) resp++;
                //cout << "resp : "<< resp << endl;
            }
            printf("%d\n",resp);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 3 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 3 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Execution timed out 1065 ms 848 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 3 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Execution timed out 1065 ms 848 KB Time limit exceeded
9 Halted 0 ms 0 KB -