제출 #1134022

#제출 시각아이디문제언어결과실행 시간메모리
1134022zhasynSimple game (IZhO17_game)C++20
22 / 100
1095 ms856 KiB
#include <bits/stdc++.h>
#define pb push_back
#define pf push_front
using namespace std;
#define F first
#define S second
typedef long long ll;
#define pii pair <int, int>
#define pll pair <ll, ll>
typedef long double ld;
const ll N = 1e5 + 100, M = 4096 + 10, len = 315, inf = 1e18;
const ll mod = 1e9 + 7;
ll um(ll a, ll b){
	return (1LL * a * b) % mod;
}
ll subr(ll a, ll b){
	return ((1LL * a - b) % mod + mod) % mod;
}
int a[N];
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for(int i = 0, code, x, pos; i < m; i++){
		cin >> code >> x;
		if(code == 2){
			int ans = 0;
			for(int j = 1; j < n; j++){
				if(x > min(a[j], a[j + 1]) && x < max(a[j], a[j + 1])) ans++;
			}
			cout << ans << endl;
		} else{
			cin >> pos;
			a[x] = pos;
		}
	}
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...