답안 #591656

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
591656 2022-07-07T17:53:47 Z Devigo Simple game (IZhO17_game) C++14
22 / 100
1000 ms 1328 KB
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

const int siz = 0;
const int mod = 0;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	vector<int> v(n);
	for(int i=0; i<n; i++) {
		cin >> v[i];
	}
	while(m--) {
		int q; cin >> q;
		if(q == 1) {
			int pos, val; cin >> pos >> val;
			v[pos-1] = val;
		}
		else {
			int cnt = 0; int x; cin >> x;
			for(int i=0; i<n-1; i++) {
				if(v[i] == x) {
					cnt++;
				}
				else if(v[i] < x) {
					if(v[i+1] > x) cnt++;
				}
				else if(v[i] > x) {
					if(v[i+1] < x) cnt++;
				}
			}
			if(v[n-1] == x) cnt++;
			cout << cnt << "\n";
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Execution timed out 1079 ms 1328 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Execution timed out 1079 ms 1328 KB Time limit exceeded
9 Halted 0 ms 0 KB -