#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n;
vector<int> col(N) , cnt(2);
set<int> S;
vector<char> u = {'>' , '<' , '?'};
void UPD(int x){
S.insert(x);
auto it = S.lower_bound(x);
if(it != S.begin()){
cnt[col[x]] += (col[x] == col[*prev(it)]);
}
if(S.upper_bound(x) != S.end()){
cnt[col[x]] += (col[x] == col[*next(it)]);
}
if(it != S.begin() && S.upper_bound(x) != S.end()){
cnt[col[*prev(it)]] -= (col[*prev(it)] == col[*next(it)]);
}
}
int main(){
cin >> n;
for(int i = 1;i <= n;i ++){
int r;
cin >> r;
cin >> col[r];
--col[r];
UPD(r);
if(cnt[0] > 0 && cnt[1] > 0){
cout << u[2] << endl;
continue;
}
if(cnt[0] + cnt[1] == 0){
cout << u[col[*--S.end()]] << endl;
continue;
}
int v = 0;
while(cnt[v] == 0){
++v;
}
if(v == col[*--S.end()]){
cout << u[v] << endl;
continue;
}
cout << u[2] << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |