Submission #1128741

#TimeUsernameProblemLanguageResultExecution timeMemory
1128741raiselBomb (IZhO17_bomb)C++20
0 / 100
2 ms328 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC target("avx2") #define forn for(int i=1;i<=n;i++) #define Yes cout<<"YES\n" #define No cout<<"NO\n" #define YES cout<<"YES\n" #define NO cout<<"NO\n" #define pb push_back #define sp setprecision #define int long long #define ll long long #define nn '\n' using namespace std; const int N=1e6+26; const int MOD=1e9+7; int a[N]; int n,m; void al(){ cin>>n>>m; for(int i=1;i<=n;i++){ cin>>a[i]; } while(m--){ int type; cin>>type; if(type==1){ int x,y; cin>>x>>y; a[x]=y; } else { int x; cin>>x; int cnt=0; for(int i=1;i<n;i++){ if((a[i]<=x && a[i+1]>=x) || (a[i]>=x && a[i+1]<=x)) cnt++; } cout<<cnt<<'\n'; } } } signed main(){ freopen("game.in","r",stdin); freopen("game.out","w",stdout); ios_base::sync_with_stdio(false); cin.tie(nullptr); int t=1; // cin>>t; while(t--) { al(); } }

Compilation message (stderr)

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