Submission #1130305

#TimeUsernameProblemLanguageResultExecution timeMemory
1130305brover29Simple game (IZhO17_game)C++20
0 / 100
2 ms320 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'; } } }

Compilation message (stderr)

game.cpp: In function 'int main()':
game.cpp:15:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     freopen("game.in","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
game.cpp:16:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     freopen("game.out","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...