Submission #142876

#TimeUsernameProblemLanguageResultExecution timeMemory
142876vardan__02Simple game (IZhO17_game)C++14
22 / 100
1055 ms1572 KiB
#include <iostream> #include <fstream> #include <algorithm> #include <cstring> #include <string> #include <vector> #include <cstdio> #include <queue> #include <deque> #include <stack> #include <cmath> #include <list> #include <set> #include <map> using namespace std; typedef long long ll; #define MP make_pair #define PB push_back ll n,m,i,j,k,a[100005],ans,u,v,t,h; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>m; for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<=m;i++) { cin>>t; if(t==1) { cin>>u>>v; a[u]=v; } else { cin>>h; ans=0; for(j=2;j<=n;j++) { u=max(a[j-1],a[j]); v=min(a[j-1],a[j]); if(h>=v && h<=u) ans++; } cout<<ans<<endl; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...