답안 #453589

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
453589 2021-08-04T12:42:35 Z dutch 돌 무게 재기 (IZhO11_stones) C++17
100 / 100
36 ms 3592 KB
#include <bits/stdc++.h>
using namespace std;
using T = array<int, 3>;

signed main(){
	cin.tie(0)->sync_with_stdio(0);
	int n, s = 1, i, v; cin >> n;

	while((s+=s)<n);
	T a[2*s];
	fill(a, a+2*s, T{-1, 1, 0});

	while(n--){
		cin >> i >> v;
		v = 2*v-3;

		a[i+=s-1] = {v, v, v};
		while(i/=2){
			T &x = a[i+i], &y = a[i+i+1];
			a[i] = {max(y[0], x[0] + y[2]), min(y[1], x[1] + y[2]), x[2] + y[2]};
		}

		if(a[1][1] >= 0) cout << "<\n";
		else cout << char('>' + (a[1][0] > 0)) << '\n';
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 3 ms 716 KB Output is correct
11 Correct 20 ms 1912 KB Output is correct
12 Correct 33 ms 3532 KB Output is correct
13 Correct 35 ms 3488 KB Output is correct
14 Correct 34 ms 3520 KB Output is correct
15 Correct 34 ms 3536 KB Output is correct
16 Correct 33 ms 3532 KB Output is correct
17 Correct 34 ms 3560 KB Output is correct
18 Correct 35 ms 3524 KB Output is correct
19 Correct 36 ms 3504 KB Output is correct
20 Correct 31 ms 3456 KB Output is correct
21 Correct 34 ms 3524 KB Output is correct
22 Correct 34 ms 3532 KB Output is correct
23 Correct 33 ms 3568 KB Output is correct
24 Correct 34 ms 3592 KB Output is correct
25 Correct 34 ms 3556 KB Output is correct