Submission #1128720

#TimeUsernameProblemLanguageResultExecution timeMemory
1128720farni4kSimple game (IZhO17_game)C++20
22 / 100
6 ms1092 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int N=1e6+5; bool chck(int x1,int x2, int c) { return ((x1>=c && x2<=c) || (x2>=c && x1<=c)); } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n,q; cin>>n>>q; int a[n]; for (int i = 0; i<n; i++) cin>>a[i]; if (n<=1000 && q<=1000) { while(q--) { int x; cin>>x; if (x==1) { int x1,y1; cin>>x1>>y1; a[x1-1]=y1; } else { int h; cin>>h; int sum=0; for (int i = 1; i<n; i++) { if (chck(a[i-1],a[i],h)) sum++; } cout<<sum<<'\n'; } } } else { cout<<"DAUTBOLAT"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...