Submission #1128779

#TimeUsernameProblemLanguageResultExecution timeMemory
1128779raiselSimple game (IZhO17_game)C++20
22 / 100
1095 ms1236 KiB
#include <bits/stdc++.h>
//#include <windows.h>
#include <bitset>
#define int long long
#define ll long long
#define fir first
#define sec second
#define cort(v) sort(v.begin(),v.end())
#define pb push_back
#define ins insert
#define sortt sort(a+1, a+1+n)
#define sorts sort(a, a+n)
#define ld long double
using namespace std;
const int N=6e6+12; //2626
const int INF=1e18;
const int MOD=1e9+7;
//vector<int> g[N]; 
ll binpow(ll x,ll y) {
    if(y==0) return 1;
    if(y%2==1) return (binpow(x,y-1)*x);
    int z=binpow(x,y/2);
    return (z*z);
}
void WRONG_ANSWER_ON_TEST_199() {
	int n,q;
	cin>>n>>q;
	int a[n+1];
	for(int i=1; i<=n; i++) {
		cin>>a[i];
	}
	while(q--) {
		int c;
		cin>>c;
		if(c==1) {
			int pos,val;
			cin>>pos>>val;
			a[pos]=val;
		}
		else {
			int x;
			cin>>x;
			int ans=0;
			for(int i=2; i<=n; i++) {
				if(a[i-1]>=x && a[i]<=x) ans++;
				else if(a[i-1]<=x && a[i]>=x) ans++;
			}
			cout<<ans<<'\n';
		}
	}
}
signed main() {
//  freopen("game.in", "r", stdin);
//  freopen("game.out", "w", stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int _=1;
//   cin>>_;
  while(_--) { 
    WRONG_ANSWER_ON_TEST_199();
    }
  }
    
  
  //                                         
  //                                         
  //   222222222222222            66666666   
  //  2:::::::::::::::22         6::::::6    
  //  2::::::222222:::::2       6::::::6     
  //  2222222     2:::::2      6::::::6      
  //              2:::::2     6::::::6       
  //              2:::::2    6::::::6        
  //           2222::::2    6::::::6         
  //      22222::::::22    6::::::::66666    
  //    22::::::::222     6::::::::::::::66  
  //   2:::::22222        6::::::66666:::::6 
  //  2:::::2             6:::::6     6:::::6
  //  2:::::2             6:::::6     6:::::6
  //  2:::::2       2222226::::::66666::::::6
  //  2::::::2222222:::::2 66:::::::::::::66 
  //  2::::::::::::::::::2   66:::::::::66   
  //  22222222222222222222     666666666
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...