제출 #947399

#제출 시각아이디문제언어결과실행 시간메모리
947399GrandTiger1729Simple game (IZhO17_game)C++17
22 / 100
1053 ms1340 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); int n, q; cin >> n >> q; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } while (q--) { int op; cin >> op; if (op == 1) { int i, x; cin >> i >> x; i--; a[i] = x; } else { int x; cin >> x; int ans = 0; for (int i = 1; i < n; i++) { int l = a[i - 1], r = a[i]; if (l > r) { swap(l, r); } if (l < x && x < r) { ans++; } } cout << ans << '\n'; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...