제출 #1128790

#제출 시각아이디문제언어결과실행 시간메모리
1128790satbergenSimple game (IZhO17_game)C++20
22 / 100
1095 ms1248 KiB
#include <bits/stdc++.h> #define y1 sat #define dl double #define int long long #define ff first #define ss second // #define sz size #define pb push_back #define wrans cout << -1 #define neutral cout << 0 using namespace std; const int N=1e6+1; const int M=2600; const int MOD=1e9+7; const double long E=2.718281828459045; const double long pi=3.14159265359; const long long INF=1e18; int a[N]; // ╔╗╔╗╔╗╔╗╔╗╔╗╔═╗ // ║║║║║║║║║║║║╚╗║ // ║╚╝║║║║║║╚╝║╔╝║ // ║╔╗║║║║║║╔╗║║╔╝11 // ║║║║║╚╝║║║║║╔╗─ // ╚╝╚╝╚══╝╚╝╚╝╚╝─ // int binpow(int a,int b){ // if(b==0) return 1; // if(b%2 == 0){ // int x=binpow(a,b/2); // return (x*x)%MOD; // } // else return (a*binpow(a,b-1))%MOD; // } void solve(){ int n,m; cin >> n >> m; map <int,int> mp; for(int i = 1 ; i <= n ; i++){ cin >> a[i]; } for(int i = 1 ; i <= m ; i++){ int q; cin >> q; if(q==1){ int v,h; cin >> v >> h; a[v]=h; } else{ int h; cin >> h; int cnt=0; for(int i=1;i<n;i++){ if(min(a[i],a[i+1])<h && max(a[i],a[i+1])>h){ cnt++; } } cout<<cnt<<"\n"; } } } signed main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); // cout.tie(0); // for(int i = 2 ; i <= INF ; i++){ // if(prime[i]==0){ // for(int j = 2 ; i*j<=INF ; j++){ // prime[i*j]=1; // } // } // } // fact(); int test=1; // cin >> test; while(test--){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...