Submission #453572

# Submission time Handle Problem Language Result Execution time Memory
453572 2021-08-04T12:31:36 Z dutch Weighting stones (IZhO11_stones) C++17
100 / 100
39 ms 4376 KB
#include <bits/stdc++.h>
using namespace std;
using T = array<int, 3>;

const T ID = {-1, 1, 0};

T comb(T &x, T &y){
	return {max(y[0], x[0] + y[2]), min(y[1], x[1] + y[2]), x[2] + y[2]};
}

int n, s = 1;
vector<T> a;

signed main(){
	cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	while((s+=s)<n);
	a.assign(2*s, ID);

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

		a[i+=s] = {v, v, v};
		while(i/=2) a[i] = comb(a[2*i], a[2*i+1]);

		if(a[1][0] > 0 && a[1][1] < 0) cout << "?\n";
		else cout << (a[1][0] > 0 ? "<\n" : ">\n");
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 312 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 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 232 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 708 KB Output is correct
11 Correct 21 ms 2372 KB Output is correct
12 Correct 39 ms 4228 KB Output is correct
13 Correct 31 ms 4348 KB Output is correct
14 Correct 35 ms 4356 KB Output is correct
15 Correct 31 ms 4292 KB Output is correct
16 Correct 36 ms 4292 KB Output is correct
17 Correct 31 ms 4376 KB Output is correct
18 Correct 31 ms 4284 KB Output is correct
19 Correct 35 ms 4256 KB Output is correct
20 Correct 31 ms 4324 KB Output is correct
21 Correct 31 ms 4356 KB Output is correct
22 Correct 32 ms 4356 KB Output is correct
23 Correct 32 ms 4360 KB Output is correct
24 Correct 31 ms 4292 KB Output is correct
25 Correct 31 ms 4308 KB Output is correct