#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n;
vector<int> col(N) , cnt(2);
set<int> S;
vector<string> u = {">" , "<" , "?"};
struct node{
int mn = 0 , mx = 0 , lz = 0;
};
vector<node> t(4 * N);
void push(int u){
t[u * 2].mn += t[u].lz;
t[u * 2 + 1].mn += t[u].lz;
t[u * 2].mx += t[u].lz;
t[u * 2 + 1].mx += t[u].lz;
t[u].lz = 0;
}
void update(int u , int l , int r , int L , int R , int x){
if(l > r || r < L || l > R){
return;
}
if(L <= l && r <= R){
t[u].mn += x;
t[u].mx += x;
t[u].lz += x;
return;
}
push(u);
int m = (l + r) / 2;
update(u * 2 , l , m , L , R , x);
update(u * 2 + 1 , m + 1 , r , L , R , x);
t[u].mn = min(t[u * 2].mn , t[u * 2 + 1].mn);
t[u].mx = max(t[u * 2].mx , t[u * 2 + 1].mx);
}
void UPD(int x){
update(1 , 1 , n , 1 , x , (col[x] == 0 ? 1 : -1));
}
int main(){
cin >> n;
for(int i = 1;i <= n;i ++){
int r;
cin >> r;
cin >> col[r];
--col[r];
UPD(r);
if(t[1].mn >= 0){
cout << u[0] << endl;
continue;
}
if(t[1].mx <= 0){
cout << u[1] << endl;
continue;
}
cout << u[2] << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
5464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |