답안 #524485

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
524485 2022-02-09T09:33:37 Z NK2007 Simple game (IZhO17_game) C++14
22 / 100
1000 ms 1196 KB
/*
 _____________
|             |
|    NIKA     |
| KOKHREIDZE  |
|_____________|

*/
#include<bits/stdc++.h>
#define f first
#define s second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define sz(v) (int)v.size()
#define popb pop_back
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define vi vector<int>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define Scan_Vector(v) for (auto &i : v) cin >> i;
#define Print_Vector(v) for (auto &i : v) cout << i << " ";
#define Read(n) cin >> n
#define Print(n) cout << n << endl
#define For(i, n) for (int i = 0; i < n; i++)
#define rFor(i, n) for (int i = n - 1; i >= 0; i--)
#define fast ios_base::sync_with_stdio (false), cin.tie(0), cout.tie(0);
#define debug(x) cout << #x << " " << x << endl;
#define to_int(s) stoi(s);
#define merge(a, b, v) v[a].push_back(b), v[b].push_back(a);
using namespace std;
void solve() {
	int n, q, op, a, b;
	cin >> n >> q;
	vi y(n + 1);
	for (int i = 1; i <= n; i++)
		cin >> y[i];
	while (q--) {
		cin >> op;
		if (op == 1) {
			cin >> a >> b;
			y[a] = b;
		} else {
			cin >> b;
			int res = 0;
			for (int i = 1; i < n; i++) {
				int f = min(y[i], y[i + 1]), s = max(y[i], y[i + 1]);
				if (f <= b && b <= s) {
					res++;
				}
			}
			cout << res << endl;
		}
	}
}
int main () {
	fast;
	int t = 1;
	//Read(t);
	while (t--)
		solve();
}
/*
 _              _      _
| |            | |    | |
| | __   ___   | | __ | | __     __  __    ____
| |/ /  / _ \  | |/ / | / __ \  |  / __|  /____\
|   <  | (_) | |   <  | |   | | | |      |
|_|\_\  \___/  |_|\_\ |_|   |_| |_|       \_____

*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 4 ms 324 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 4 ms 324 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
8 Execution timed out 1047 ms 1196 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 4 ms 324 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
8 Execution timed out 1047 ms 1196 KB Time limit exceeded
9 Halted 0 ms 0 KB -