#include <iostream>
using namespace std;
#define int long long
struct struct_aint{
int sum,pref_min,pref_max;
};
struct_aint v[400005];
struct_aint combin(struct_aint a,struct_aint b){
struct_aint rasp;
rasp.pref_min=min(a.pref_min,a.sum+b.pref_min);
rasp.pref_max=max(a.pref_max,a.sum+b.pref_max);
rasp.sum=a.sum+b.sum;
return rasp;
}
void update(int nod,int st,int dr,int poz,int a){
if(st==dr){
v[nod].sum=a;
v[nod].pref_min=a;
v[nod].pref_max=a;
return ;
}
int mij=(st+dr)/2;
if(mij>=poz) update(2*nod,st,mij,poz,a);
else update(2*nod+1,mij+1,dr,poz,a);
v[nod]=combin(v[2*nod],v[2*nod+1]);
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,i,poz,a;
cin>>n;
for(i=1;i<=n;i++){
cin>>a>>poz;
if(poz==1) update(1,1,n,n-a+1,-1);
else update(1,1,n,n-a+1,1);
if(v[1].pref_max<=0) cout<<">\n";
else if(v[1].pref_min>=0) cout<<"<\n";
else cout<<"?\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
2 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
508 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
5 ms |
3064 KB |
Output is correct |
11 |
Correct |
19 ms |
5200 KB |
Output is correct |
12 |
Correct |
31 ms |
7464 KB |
Output is correct |
13 |
Correct |
26 ms |
7752 KB |
Output is correct |
14 |
Correct |
24 ms |
7540 KB |
Output is correct |
15 |
Correct |
27 ms |
7764 KB |
Output is correct |
16 |
Correct |
25 ms |
7624 KB |
Output is correct |
17 |
Correct |
25 ms |
7752 KB |
Output is correct |
18 |
Correct |
28 ms |
7764 KB |
Output is correct |
19 |
Correct |
27 ms |
7724 KB |
Output is correct |
20 |
Correct |
29 ms |
7760 KB |
Output is correct |
21 |
Correct |
25 ms |
7760 KB |
Output is correct |
22 |
Correct |
28 ms |
7760 KB |
Output is correct |
23 |
Correct |
25 ms |
7760 KB |
Output is correct |
24 |
Correct |
30 ms |
7592 KB |
Output is correct |
25 |
Correct |
30 ms |
7764 KB |
Output is correct |