Submission #1182642

#TimeUsernameProblemLanguageResultExecution timeMemory
1182642VMaksimoski008Simple game (IZhO17_game)C++20
22 / 100
1095 ms860 KiB
#include <bits/stdc++.h> #define ar array //#define int long long using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const int mod = 1e9 + 7; const ll inf = 1e18; const int N = 1e6 + 5; signed main() { ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0); int n, q; cin >> n >> q; vector<int> a(n+1); for(int i=1; i<=n; i++) cin >> a[i]; while(q--) { int t; cin >> t; if(t == 1) { int p, v; cin >> p >> v; a[p] = v; } else { int h, ans = 0; cin >> h; for(int i=1; i<n; i++) { if(a[i] <= h && h <= a[i+1]) ans++; else if(a[i+1] <= h && h <= a[i]) ans++; } cout << ans << '\n'; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...