Submission #878399

# Submission time Handle Problem Language Result Execution time Memory
878399 2023-11-24T09:59:34 Z prince Simple game (IZhO17_game) C++17
0 / 100
0 ms 348 KB
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
/*void dfs(int u){
    vis[u]=true;
    cout<<u<<" ";
    for(int v:g[u]){
        if(vis[v])continue;
        dfs(v);
    }
}*/
void solve(){
    int n,q;cin>>n>>q;
    /*g.assign(n+1,{});
    vis.assign(n+1,false);
    */
    vector<int>vec(n+1);
    for(int i=1;i<=n;i++){
        cin>>vec[i];
    }
    vector<pair<int,int>>g;
    for(int i=1;i<=n;i++){
        if(i+1>n)break;
        g.emplace_back(make_pair(min(vec[i],vec[i+1]),max(vec[i],vec[i+1])));
        //cout<<vec[i]<<" "<<vec[i+1]<<endl;
    }
    //for(auto [x,y]:g)cout<<x<<" "<<y<<endl;
    while(q--){
        int r;cin>>r;
        if(r==1){
            int a,b;cin>>a>>b;
        }
        else{
            int cnt=0;
            int c;cin>>c;
            for(auto [x,y]:g){
                if(x<c&&c<y){
                    cnt++;
                }
            }
            cout<<cnt<<endl;
        }
    }
}
signed main() {
    cin.tie(0)->sync_with_stdio(false);
#ifdef prince
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int q = 1;
    // cin >> q;
    while (q--) {
        solve();
        cout << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -