답안 #1106366

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1106366 2024-10-30T05:07:45 Z stdfloat Simple game (IZhO17_game) C++17
22 / 100
1000 ms 1016 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);

	int n, q;
	cin >> n >> q;

	vector<int> a(n);
	for (auto &i : a)
		cin >> i;

	while (q--) {
		int tp, x;
		cin >> tp >> x;

		if (tp == 1) {
			int vl;
			cin >> vl;

			a[--x] = vl;
		}
		else {
			int cnt = 0;
			vector<bool> vis(n);
			for (int i = 0; i + 1 < n; i++) {
				int mn = min(a[i], a[i + 1]), mx = max(a[i], a[i + 1]);
				cnt += (mn <= x && x <= mx) - (x == a[i]);
			}

			cout << cnt << '\n';
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 2 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 2 ms 336 KB Output is correct
8 Execution timed out 1038 ms 1016 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 2 ms 336 KB Output is correct
8 Execution timed out 1038 ms 1016 KB Time limit exceeded
9 Halted 0 ms 0 KB -