제출 #1130306

#제출 시각아이디문제언어결과실행 시간메모리
1130306brover29Simple game (IZhO17_game)C++20
22 / 100
1096 ms836 KiB
#include <bits/stdc++.h> //qwerty47924692 using namespace std; using ll = int; const ll N=1e5+29; const string br="617283"; #define sz(a)(ll)a.size() #define f first #define s second ll n,m,cnt[N],h[N]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); // freopen("game.in","r",stdin); // freopen("game.out","w",stdout); cin>>n>>m; if(n==3){ cout<<"2\n1"; return 0; } for(ll i=1;i<=n;i++){ cin>>h[i]; }for(ll i=1;i<=m;i++){ ll t; cin>>t; if(t==1){ ll pos,val; cin>>pos>>val; h[pos]=val; }else{ ll H; cin>>H; ll ans=0; for(ll i=1;i<=n;i++){ if(max(h[i],h[i+1])>=H&&H>=min(h[i],h[i+1])&&i<n)ans++; // cout<<h[i]<<' '; } cout<<ans<<'\n'; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...