Code Submission Evaluation System Login

CSES - HIIT Open 2018

HIIT Open 2018

Contest start:2018-05-26 11:00:00
Contest end:2018-05-26 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard | Statistics


History
2018-05-26 11:58:43
2018-05-26 11:51:54
Task:Coins
Sender:Karhukopla
Submission time:2018-05-26 11:58:43
Status:READY
Result:ACCEPTED

Show test data

Code

#include <bits/stdc++.h>

#define ll long long
#define lll __int128
#define pii pair<int, int>
#define M 1000000007
#define N (1<<18)
using namespace std;

int mx[2*N];
int mn[2*N];
int s[2*N];

void setv (int k, int n) {
	k += N;
	s[k] = mn[k] = mx[k] = n;
	for (k /= 2; k >= 1; k /= 2) {
		s[k] = s[2 * k] + s[2 * k + 1];
		mn[k] = min(min(mn[2 * k], s[2 * k] + mn[2 * k + 1]), s[2 * k]);
		mx[k] = max(max(mx[2 * k], s[2 * k] + mx[2 * k + 1]), s[2 * k]);
	}
}

int main () {
	int n;
	cin>>n;
	while (n --> 0) {
		int c, s;
		cin>>c>>s;
		if (s == 2) s = -1;
		setv(N - c, s);
		char ans = '-';
		if (mn[1] < 0) ans = '<';
		if (mx[1] > 0) {
			if (ans == '<') ans = '?';
			else ans = '>';
		}
		cout<<ans<<endl;
	}
}