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 15:59:15
2018-05-26 15:53:54
2018-05-26 15:51:13
2018-05-26 12:32:24
Task:Coins
Sender:Oispa nutellaa
Submission time:2018-05-26 15:59:15
Status:READY
Result:WRONG ANSWER

Show test data

Code

#include <iostream>

using namespace std;

int n;

int mx[4];
int sz[4];

bool sqt[4][200005];
int mxsi[4];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	mxsi[1] = mxsi[2] = -1;
	for (int i = 0; i < n; ++i) {
		int c, s;
		cin >> c >> s;
		sz[s]++;
		mx[s] = max(mx[s], c);
		
		sqt[s][c] = true;
		if (sqt[s][c-1]) mxsi[s] = max(mxsi[s], c);
		if (sqt[s][c+1]) mxsi[s] = max(mxsi[s], c+1);
		
		if (sz[1] == 0) cout << "<\n";
		else if (sz[2] == 0) cout << ">\n";
		else if (sz[1] == 1 && mx[2] > mx[1]) {
			cout << "<\n";
		}
		else if (sz[2] == 1 && mx[1] > mx[2]) {
			cout << ">\n";
		}
		else if (sz[1] < sz[2]) {
			cout << "<\n";
		}
		else if (sz[1] > sz[2]) {
			cout << ">\n";
		}
		else {
			if (mx[1] > mx[2] && mxsi[2] == -1) cout << ">\n";
			else if (mx[1] < mx[2] && mxsi[1] == -1) cout << "<\n";
			else if (mx[1] > mx[2] && mxsi[1] > mxsi[2]) cout << ">\n";
			else if (mx[1] < mx[2] && mxsi[1] < mxsi[2]) cout << "<\n";
			else cout << "?\n";
		}
	}
	return 0;
}