This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cerr.tie(nullptr);
int n, m;
cin >> n >> m;
vi a(n);
for (auto& i : a)
cin >> i;
for (int e = 0; e < m; ++e){
int z;
cin >> z;
if (z == 1){
int pos, val;
cin >> pos >> val;
a[pos-1]=val;
} else {
int h, sol = 0;
cin >> h;
for (int i = 1; i < n; ++i){
if (h >= min(a[i], a[i-1]) && h <= max(a[i], a[i-1]))
++sol;
}
cout << sol << '\n';
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |