#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define lnl long long
#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second
using namespace std;
pair<int, int> mn = {INT_MAX, 0};
pair<int, int> mx = {0, 0};
set<int> s;
int id[100001];
int sd[3];
void add(int x, int i) {
if (mn.F > x) mn = {x, i};
if (mx.F < x) mx = {x, i};
s.insert(-x);
id[x] = i;
sd[i]++;
}
char find() {
if (sd[1] == 0) return '<';
if (sd[2] == 0) return '>';
int l = mx.S;
int k = 1;
auto it = s.ub(-mx.S);
while (it != s.end()) {
int x = -*it;
int i = id[x];
if (i == l) k++;
else k--;
if (k < 0) return '?';
}
return (l == 1 ? '>' : '<');
}
void solve () {
int n; cin >> n;
for (int i = 0; i < n; i++) {
int x, y; cin >> x >> y;
add(x, y);
cout << find() << '\n';
}
}
signed main() {
IOS
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |