QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#318693#5449. 楼梯catagory97 2626ms237796kbC++233.8kb2024-01-31 17:09:492024-01-31 17:09:51

Judging History

你现在查看的是最新测评结果

  • [2024-01-31 17:09:51]
  • 评测
  • 测评结果:97
  • 用时:2626ms
  • 内存:237796kb
  • [2024-01-31 17:09:49]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
#define SZ(x) ((LL)(x.size()))
using namespace std;
long long read(){
  long long q=0,w=1;
  char ch=getchar();
  while(ch>'9' || ch<'0'){if(ch=='-')w=-1;ch=getchar();}
  while(ch>='0'&&ch<='9'){q=q*10+(ch-'0');ch=getchar();}
  return q*w;
}
void write(LL x){
  if(x<0){putchar('-');x=(-x);}
  if(x>9)write(x/10);
  putchar('0'+x%10);
}
void writeln(LL x){write(x);puts("");}
void writecs(LL x){write(x);putchar(' ');}

const long long lim = 1000000000;
namespace seg{
  const long long SIZE = 20000000+95;
  struct node{LL l,r,d,t;}s[SIZE];LL tot;
  void pushup(LL p){s[p].d=max(s[s[p].l].d,s[s[p].r].d)+s[p].t;return ;}
  void update(LL &p,LL x,LL y,LL v,LL l=1,LL r=lim){//将 [x,y] 区间内的部分加 v
    if(y<l || r<x || x>y)return ;
    s[++tot]=s[p];p=tot;
    if(x<=l&&r<=y){s[p].d+=v;s[p].t+=v;return ;}
    LL mid=(l+r)>>1;
    if(x<=mid)update(s[p].l,x,y,v,l,mid);
    if(mid<y)update(s[p].r,x,y,v,mid+1,r);
    pushup(p);return ;
  }
  void make(LL &p,LL l=1,LL r=lim,LL tag=0){//将小于 0 的部分设置为 0
    s[++tot]=s[p];p=tot;
    if(s[p].d+tag<=0){s[p].l=s[p].r=0;s[p].d=s[p].t=-tag;return ;}
    if(l==r)return ;
    tag+=s[p].t;LL mid=(l+r)>>1;
    if(s[s[p].r].d+tag>=0)make(s[p].r,mid+1,r,tag);
    else {make(s[p].l,l,mid,tag);make(s[p].r,mid+1,r,tag);}
    pushup(p);return ;
  }
  LL query(LL p,LL x,LL l=1,LL r=lim){//得到其中一行的值
    if(!p)return 0;
    if(l==r)return s[p].t;
    LL mid=(l+r)>>1;
    if(x<=mid)return query(s[p].l,x,l,mid)+s[p].t;
    else return query(s[p].r,x,mid+1,r)+s[p].t;
  }
  LL get(LL p,LL y,LL l=1,LL r=lim,LL tag=0){//得到其中一列的值
    if(l==r)return ((s[p].d+tag>=y)?(l):(l-1));
    tag+=s[p].t;LL mid=(l+r)>>1;
    if(s[s[p].r].d+tag>=y)return get(s[p].r,y,mid+1,r,tag);
    else return get(s[p].l,y,l,mid,tag);
  }
  LL bound(LL p,LL __X,LL __Y,LL k,LL l=1,LL r=lim,LL tag=0){
    if(l==r){
      LL vl=0;
      {//l
	LL X=(__X-l+1);
	LL Y=((s[p].d+tag)-__Y+1);
	vl=((X<=0||Y<=0)?(0):(X+Y-1));
      }
      return ((vl<=k)?(l):(l+1));
    }
    tag+=s[p].t;LL mid=(l+r)>>1;
    LL vl=0;
    {//mid+1
      LL X=(__X-(mid+1)+1);
      LL Y=((s[s[p].r].d+tag)-__Y+1);
      vl=((X<=0||Y<=0)?(0):(X+Y-1));
    }
    if(vl<=k)return bound(s[p].l,__X,__Y,k,l,mid,tag);
    else return bound(s[p].r,__X,__Y,k,mid+1,r,tag);
  }
}

const long long N = 300000+95;
long long T,rt,__rt[N];
LL GET(LL x,LL y){
  LL X=(seg::get(rt,y)-x+1);
  LL Y=(seg::query(rt,x)-y+1);
  if(X<=0||Y<=0)return 0;
  return (X+Y-1);
}

void solve(LL x,LL y,LL q){
  LL p=GET(x,y);assert((p%q)==0);
  if(p==q){writecs(x);writeln(y);return ;}
  LL K=(p/q);LL k=(K>>1)*q;
  LL ans=lim+1;
  
  LL X=seg::get(rt,y);
  ans=seg::bound(rt,X,y,k);
  /*  while(l<=r){
    LL mid=(l+r)>>1;
    if(GET(mid,y)>k){l=mid+1;}
    else {r=mid-1;ans=mid;}
  }*/
  
  if(GET(ans,y)==k){solve(ans,y,q);return ;}
  assert(ans>x);
  LL Y=seg::query(rt,ans)+1;
  LL c=GET(x,Y);Y+=(c-(p-k));
  assert(GET(x,Y)==(p-k));
  solve(x,Y,q);return ;
}

int main(){
  T=read();
  for(LL t=1;t<=T;t++){
    char opt;cin>>opt;
    if(opt=='+'){
      LL a=read(),b=read();
      seg::update(rt,1,a,b);
    }
    else if(opt=='-'){
      LL a=read(),b=read();
      seg::update(rt,a,lim,-b);seg::make(rt);
      
    }
    else if(opt=='R'){
      LL u=read();
      rt=__rt[(t-1)-u];
    }
    else if(opt=='?'){
      LL q=read();
      LL Y=seg::query(rt,1),X=seg::get(rt,1);
      assert((X!=0)==(Y!=0));
      if(!X){puts("-1 -1");continue;}
      /*      cout<<"> X = "<<X<<" Y = "<<Y<<endl;
      for(LL i=1;i<=X;i++){
	for(LL j=1;j<=Y;j++)cout<<GET(i,j)<<" ";
	cout<<endl;
	}*/
      solve(1,1,q);
    }
    __rt[t]=rt;
  }
  return 0;
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 5ms
memory: 5796kb

input:

1000
- 1 999995
? 770771330
? 688406105220012703
? 466054413
? 1466199
? 940610359316496655
? 310504014100463831
? 765557590
? 419614901
? 830584303
? 85199513
? 768715778674812284
? 742663363105169125
? 859012516258231128
? 168409807482711289
? 842755243
? 618667253264707663
? 957265852
+ 1 1
+ 1 1...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 3
1 1
1 1
1 3
1 1
1 3
1 1
1 1
1 1
1 3
1 3
1 3
1 3
1 1
1 1
1 1
1 1
1 3
1 3
1 3
1 3
1 2
1 1
1 2
1 1
1 2
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 2
1 1
1 ...

result:

ok ok

Test #2:

score: 0
Accepted
time: 8ms
memory: 5712kb

input:

1000
- 1 999999992
? 426873616
- 1 256
? 670399288694575053
? 270955652351585633
? 258266169
? 358158412890035660
- 1 579
? 882074593944476252
? 575229109486341356
? 343017523563388060
? 73907450
? 730903768
? 413587891090231085
? 803451715032296303
? 945196920
+ 1 783
? 783
? 29
? 87
+ 1 933
+ 1 62...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 755
1 697
1 2343
1 2925
1 1
1 2941
1 2769
1 2925
1 1
1 1
1 2941
1 2510
1 2522
1 2497
1 2329
1 2426
1 1
1 2521
1 2497
1 1262
1 2522
1 1262
1 2426
1 1
1 2329
1 1
1 1
1 1
1 2510
1 2522
1 2522
1 2497
1 2522
1 1262
1 2497...

result:

ok ok

Test #3:

score: 0
Accepted
time: 0ms
memory: 5788kb

input:

1000
? 724684671
- 229 22497
+ 29 60
+ 275 51
+ 2 60
+ 50 60
+ 750 8
+ 856 8
+ 513 36
+ 65 59
+ 565 35
+ 36 60
? 1292
+ 17 60
+ 697 8
? 8
+ 416 38
? 1398
+ 205 51
+ 40 60
? 503
+ 57 60
+ 6 60
+ 393 39
? 2
+ 54 60
+ 100 56
+ 803 8
? 32
? 112
+ 130 56
+ 488 36
+ 30 60
+ 20 60
? 1
+ 63 59
? 1
+ 25 60
+...

output:

-1 -1
1 1
1 499
1 1
448 1
392 172
9 794
1 831
488 139
750 24
2 1377
392 252
1 1
488 176
1 1
1 1363
2 2469
1 1
73 874
1 1
2 2924
1 3261
79 1283
77 1283
1 4049
1 1
1 4079
1 4147
1 1
1 3832
1 4446
1 5696
1 6374
1 5212
1 6172
1 6052
1 5692
1 1
1 6112
2 6292
1 6292
1 4012
1 5932
1 5812
1 6383
1 2813
1 46...

result:

ok ok

Test #4:

score: 0
Accepted
time: 10ms
memory: 5708kb

input:

1000
? 612443313965411255
- 398 867638065
- 338 149214194
? 412057943687439209
+ 29 2
+ 288 7
+ 1 60
+ 4 60
+ 181 12
? 1
+ 84 38
+ 234 8
? 237
+ 39 51
+ 2 60
+ 132 2
? 1
+ 7 2
+ 9 59
+ 61 2
+ 19 56
+ 3 60
+ 14 2
+ 342 7
+ 397 6
+ 5 60
+ 7 57
+ 288 1
+ 14 54
+ 132 11
? 29
+ 29 49
? 1122
? 102
+ 61 37...

output:

-1 -1
-1 -1
288 7
1 34
288 7
374 1
1 1
308 1
235 14
1 745
1 1
1 763
1 1
235 14
1 1
1 1
1 1
1 1
1 1
235 14
235 14
235 14
235 14
1 1
1 1
235 14
235 14
235 14
1 1
235 14
1 763
1 1
235 14
1 763
235 14
1 1
2 506
3 445
1 541
1 1
3 583
1 1
1 763
3 583
3 583
1 745
3 583
3 583
1 1
1 1
1 1
3 583
1 554
39 133
...

result:

ok ok

Test #5:

score: 0
Accepted
time: 0ms
memory: 7780kb

input:

1000
? 603050749
+ 78 59
+ 909 2
? 3
+ 66 60
+ 335 51
+ 245 51
+ 618 36
? 3
+ 38 60
+ 47 60
+ 827 34
+ 25 60
+ 345 51
+ 497 37
+ 30 60
+ 76 59
+ 6 60
+ 92 59
+ 285 51
+ 4 60
+ 29 60
+ 40 60
? 3
+ 53 60
+ 88 59
+ 14 60
+ 1 60
+ 42 60
+ 521 37
? 3
+ 74 59
+ 52 60
+ 32 60
? 1
+ 22 60
+ 5 60
+ 23 60
+ 1...

output:

-1 -1
908 1
908 1
4 1028
908 1
909 2
1 1841
1 1901
1 1849
1 2140
1 692
1 2195
1 1
1 2164
1 2433
1 2313
1 2653
1 1
3 3156
1 3246
1 1
1 1
1 3879
1 1
1 4229
1 1
1 4327
1 1
14 3813
1 1
76 2121
1 1
1 5218
1 5611
1 5612
19 4334
1 5026
1 6623
1 1
1 6743
1 1
1 7253
18 6363
37 5595
1 1
27 5475
37 5595
1 1
34...

result:

ok ok

Test #6:

score: 0
Accepted
time: 6ms
memory: 5736kb

input:

1000
+ 639 6
+ 6 60
? 44
? 1
+ 25 58
+ 201 35
+ 419 6
? 1
+ 76 2
+ 474 6
+ 10 60
+ 863 5
+ 14 60
+ 18 60
+ 227 35
+ 112 49
+ 8 60
? 11
? 1
? 1364
+ 12 60
+ 751 5
? 1429
+ 4 60
? 1
? 1489
+ 807 5
? 1
+ 11 60
+ 31 58
? 1
+ 149 2
+ 64 55
+ 34 58
? 1727
? 157
+ 919 5
? 4
+ 16 60
+ 46 55
+ 28 58
+ 58 55
...

output:

601 1
639 6
639 6
1 497
6 502
1 1
1 1
4 627
1 1
201 103
863 5
1 1
721 1
916 5
1 698
245 1
1 937
1 1
1 1477
1 1435
1 1483
1 1
1 1439
1 1610
1 1615
1 1935
1 1
15 1415
1 1
19 1056
19 1114
1 1
1 708
17 1056
14 1474
14 708
17 1056
1 2229
19 1114
19 1056
1 2253
17 1056
1 708
19 1114
19 1114
1 1
1 2203
19 ...

result:

ok ok

Test #7:

score: 0
Accepted
time: 2ms
memory: 5716kb

input:

1000
- 886 3325373
- 421 609251347
- 74 509944584
- 353 790375490
- 597 946044374
- 542 516826393
+ 14 60
+ 15 60
+ 19 60
+ 46 59
? 2
+ 23 60
+ 56 59
+ 167 51
+ 60 59
+ 197 51
+ 77 56
? 1
+ 187 51
+ 542 13
+ 17 60
+ 357 39
+ 39 60
? 103
? 1339
+ 269 40
+ 147 51
? 2
? 1430
? 1
+ 21 60
+ 20 60
+ 82 56...

output:

13 239
14 575
452 1
1 1
167 244
1 1
167 245
13 1065
14 1065
13 1189
266 1
780 11
1 1448
1 1532
1 1739
1 1794
1 1854
1 1
1 1831
1 2088
1 1
1 2489
1 1
1 1
4 2867
1 3180
1 1
1 3329
1 4289
1 1
1 1885
1 1
448 63
1 4584
1 4693
1 3591
1 1
1 4863
59 1877
39 1477
51 1877
1 4572
1 4206
1 1
687 1
270 1
881 1
1...

result:

ok ok

Test #8:

score: 0
Accepted
time: 4ms
memory: 5648kb

input:

1000
? 836688957840823224
- 306 679936336
+ 48 60
+ 58 59
+ 35 60
+ 28 60
+ 102 56
+ 520 36
+ 167 51
+ 23 60
? 31
+ 15 60
+ 50 2
? 341
+ 8 60
+ 66 59
+ 47 60
? 601
? 1202
+ 43 60
+ 347 37
+ 683 6
? 734
+ 87 56
+ 628 2
+ 26 60
+ 495 36
+ 21 60
+ 243 50
? 1732
+ 7 60
+ 9 60
+ 39 60
+ 10 60
+ 97 56
+ 3...

output:

-1 -1
494 32
215 1
1 148
1 1
1 154
1 1
1 1781
1 1951
1 2561
1 1
1 2734
1 2951
1 3349
1 4021
1 4116
1 1
1 4307
1 1
1 1
1 2882
1 4905
1 1
1 5074
1 3726
1 1
1 1
1 1
1 5295
1 1
57 872
1 1
73 1737
57 1
75 1737
73 1625
1 5340
75 1737
57 1569
73 1625
65 1625
58 2326
73 1737
57 872
75 1737
75 1737
57 1569
7...

result:

ok ok

Test #9:

score: 0
Accepted
time: 4ms
memory: 5660kb

input:

1000
+ 44 60
+ 24 60
? 163
+ 52 60
? 1
? 3
? 33
+ 28 60
+ 258 49
? 546
+ 54 60
? 6
+ 79 59
? 665
+ 306 49
+ 39 60
+ 32 60
+ 282 49
+ 270 49
? 70
+ 61 2
? 1
+ 6 60
+ 698 33
+ 615 34
+ 43 60
+ 50 60
? 1
+ 8 60
+ 59 60
+ 535 35
+ 156 55
+ 57 60
+ 83 59
+ 840 4
+ 135 56
? 2152
+ 110 56
+ 561 35
+ 318 49...

output:

1 1
24 180
22 180
1 171
1 1
43 225
1 1
222 163
306 49
698 33
1 1
1 1286
698 39
6 1786
1 1
1 1
1 2024
1 2273
1 2360
1 2692
1 1
32 1535
1 3102
1 2802
1 1182
1 3218
1 3268
1 1
1 3596
1 3592
1 3577
1 3718
1 3719
1 1
1 1
1 4381
1 4729
1 1
1 1
1 4818
1 4896
1 1
71 2059
1 1
1 5054
1 2172
1 5280
1 3756
1 54...

result:

ok ok

Test #10:

score: 0
Accepted
time: 7ms
memory: 5728kb

input:

1000
- 1 999999996
? 503511061
? 999085692614634733
? 647103043
? 820196349493776381
? 652137897
+ 1 102
? 1
? 102
- 1 997
+ 1 348
? 87
? 12
? 4
+ 1 426
+ 1 313
? 1087
- 1 285
? 802
? 1
+ 1 131
? 933
? 1
? 311
+ 1 279
+ 1 531
? 3
? 1743
? 249
? 1
? 83
? 7
? 249
? 1
? 21
? 581
? 3
? 83
+ 1 846
? 863
...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 102
1 1
1 262
1 337
1 345
1 1
1 1
1 802
1 1
1 933
1 623
1 1741
1 1
1 1495
1 1743
1 1661
1 1737
1 1495
1 1743
1 1723
1 1163
1 1741
1 1661
1 1727
1 1
1 2589
1 2587
1 2587
1 1
1 1727
1 2589
1 2589
1 1899
1 1
1 1891
1 1
1 1256
1 1408
1 1414
1 2086
1 2085
1 2080
1 1044
1 1...

result:

ok ok

Test #11:

score: 0
Accepted
time: 6ms
memory: 5708kb

input:

1000
? 58814603
+ 532 3
+ 60 2
? 134
+ 265 5
? 1
+ 1 30
+ 10 30
+ 476 4
+ 395 5
+ 11 30
? 1
+ 12 30
+ 40 26
+ 9 30
+ 23 29
? 755
+ 317 5
+ 4 30
? 10
+ 343 5
+ 422 4
+ 91 20
+ 17 2
? 1
+ 6 30
+ 25 29
+ 504 3
? 883
+ 15 30
+ 50 26
+ 114 2
+ 291 5
+ 8 30
? 1
+ 14 30
+ 2 30
+ 239 6
+ 139 6
+ 70 21
+ 449...

output:

-1 -1
401 1
265 8
532 3
1 1
525 1
343 21
1 1
4 415
494 6
315 1
1 1
1 788
238 53
145 1
1 820
1 849
36 1
370 1
450 7
423 1
115 1
1 1
215 1
423 7
450 1
527 1
1 1
318 1
532 3
531 3
239 54
266 39
368 28
215 24
1 1
41 1
266 34
215 34
1 889
532 3
1 253
20 360
20 389
13 253
17 360
20 253
1 1
20 360
1 253
30...

result:

ok ok

Test #12:

score: 0
Accepted
time: 6ms
memory: 5656kb

input:

1000
? 641775127
+ 658 6
? 663
+ 57 2
+ 27 30
+ 157 21
? 2
+ 22 30
+ 464 8
+ 14 30
? 56
+ 219 10
? 1
+ 48 29
? 1
? 823
+ 21 30
+ 147 21
+ 1 30
+ 18 30
? 1
+ 6 30
+ 97 26
+ 283 9
+ 20 30
+ 72 26
+ 87 26
+ 19 30
? 1111
+ 633 6
+ 7 30
? 31
+ 52 29
? 1
+ 127 21
+ 44 29
+ 50 29
+ 261 10
? 1
+ 28 30
+ 4 3...

output:

-1 -1
1 1
658 5
608 1
658 6
464 14
1 1
658 6
1 1
2 434
48 219
1 608
1 1
1 1
1 1
464 35
757 1
1 1
27 558
1 1
1 1431
1 1434
1 1499
903 1
1 1
1 1535
1 1628
1 1
1 1701
1 1
1 1731
1 1768
200 1
1 1
12 1489
200 1
1 1817
1 1
200 1
1 1
1 1817
1 1817
1 1
12 1489
1 1
1 1817
12 1489
1 1
200 1
12 1489
1 1817
1 1...

result:

ok ok

Test #13:

score: 0
Accepted
time: 0ms
memory: 5732kb

input:

1000
? 322718911
? 527680755138194048
- 127 243926522
- 449 695974349
- 191 588919912
+ 30 30
? 59
+ 78 29
+ 856 5
+ 16 30
+ 25 30
+ 50 30
+ 52 30
+ 191 20
+ 60 29
+ 150 2
? 109
+ 135 26
+ 4 30
+ 44 30
+ 29 30
+ 6 30
? 1236
+ 397 6
+ 297 19
+ 14 30
+ 472 6
+ 908 5
+ 76 29
? 1
+ 33 30
+ 110 26
+ 622 ...

output:

-1 -1
-1 -1
1 1
752 1
1 1
908 5
833 1
908 5
1 1
908 5
607 1
908 5
739 1
379 1
17 678
1 1
1 1
1 1273
908 5
484 1
1 1428
1 1
1 1
32 922
1 1059
1 1
1 1572
1 1
908 5
1 1866
1 1
1 1
1 2082
1 2094
1 1
1 2210
572 57
66 777
1 2440
1 2457
1 1
1 2576
1 964
448 46
598 46
598 56
1 1
573 1
1 236334
1 236311
1 23...

result:

ok ok

Test #14:

score: 0
Accepted
time: 0ms
memory: 5776kb

input:

1000
+ 24 30
+ 2 30
+ 93 28
+ 32 30
+ 96 28
+ 114 28
+ 69 2
+ 6 30
+ 55 30
? 349
? 1
? 1
+ 375 19
+ 836 6
? 1
+ 911 6
+ 11 30
+ 183 25
+ 159 25
+ 15 30
+ 60 30
+ 141 25
+ 231 2
+ 53 30
+ 105 28
+ 75 28
+ 611 6
+ 147 25
+ 25 30
? 1
+ 17 30
? 507
? 9
+ 4 30
? 1
+ 7 30
+ 636 6
+ 12 30
? 539
? 231
? 3
+...

output:

1 1
2 236
2 236
836 6
911 6
422 1
908 1
141 139
396 1
692 1
911 4
93 257
1 1
1 1
1 1
1 432
1 1546
1 1
1 1
1 1676
1 1
718 1
1 1
1 2022
2 2055
26 1020
1 1967
1 2123
1 1
1 2511
1 1
1 1737
1 2661
1 1
1 2728
1 1
1 2877
1 1
1 1
1 1089
1 2693
6 2919
1 1770
1 1
1 1
836 24
1 3249
1 1
38 2197
1 1
1 1
38 2197
...

result:

ok ok

Test #15:

score: 0
Accepted
time: 0ms
memory: 7764kb

input:

1000
- 60 823078266
+ 306 20
+ 589 8
+ 74 29
+ 54 30
? 1
+ 72 29
+ 751 7
+ 20 30
+ 8 30
+ 134 26
+ 405 20
+ 895 7
? 565
+ 48 30
? 1160
? 10
+ 23 30
+ 119 26
+ 94 29
? 1245
+ 727 8
? 1253
+ 82 29
+ 19 30
+ 36 30
+ 44 30
+ 55 30
+ 799 7
+ 3 30
? 1
+ 124 26
? 1
? 1465
+ 428 2
+ 264 21
+ 41 30
+ 823 7
+...

output:

589 8
372 1
1 1
892 1
1 1
1 1
895 7
895 7
1 1
727 36
895 7
751 28
1 250
7 1132
1 1
19 1127
885 9
1 1362
1 1
1 1387
1 1
12 1471
1 1218
1 1787
1 1306
1 1
1 1
1 1
1 2123
1 1729
1 1
1 2199
1 2229
1 2431
1 1
1 2527
1 1
1 2913
2 2943
4 2909
13 2833
1 3288
1 2311
1 3368
1 3476
1 3522
55 1921
1 3009
13 3249...

result:

ok ok

Test #16:

score: 0
Accepted
time: 3ms
memory: 7836kb

input:

1000
? 200865510
+ 509 4
+ 16 12
+ 256 5
? 23
+ 62 11
+ 3 12
+ 31 12
+ 29 12
+ 4 12
+ 200 5
? 593
? 1
+ 64 11
+ 392 4
+ 296 5
+ 124 9
+ 192 5
+ 446 4
+ 280 5
+ 78 11
+ 338 4
+ 51 12
+ 25 12
+ 383 4
+ 500 4
+ 41 12
+ 100 9
? 1
+ 47 12
+ 14 12
+ 374 4
+ 482 4
+ 12 12
+ 356 4
+ 128 9
+ 52 12
+ 80 11
+ ...

output:

-1 -1
490 1
1 1
509 4
3 196
1 1
1 1
1 1
1 1
347 1
388 24
424 1
516 1
1 1
23 454
509 1
109 1
1 1
1 1
49 190
1 759
1 1
12 724
1 857
563 4
563 3
1 1
561 4
280 110
279 110
1 921
1 1
291 1
1 1
1 1
1 1
92 336
1 1129
1 1
1 384
49 588
35 576
49 564
35 780
1 1
49 600
1 1126
52 574
35 384
1 1185
49 600
49 516...

result:

ok ok

Test #17:

score: 0
Accepted
time: 5ms
memory: 5712kb

input:

1000
? 997038533866592106
+ 563 3
+ 158 8
+ 213 3
+ 11 12
+ 393 3
+ 623 3
? 654
+ 42 12
? 6
? 9
+ 423 3
? 1
+ 243 3
+ 40 12
? 57
+ 713 3
+ 38 12
? 1
? 263
? 789
+ 503 3
+ 19 12
+ 163 8
? 812
+ 4 12
? 412
+ 233 3
+ 57 12
+ 22 12
+ 673 3
+ 183 3
+ 41 12
+ 44 12
+ 313 3
? 442
+ 18 12
+ 373 3
? 31
+ 37 ...

output:

-1 -1
1 1
620 1
617 1
623 3
569 1
713 3
459 1
1 1
1 1
319 1
295 1
685 1
713 3
1 1
1 1
707 1
713 3
711 1
713 3
1 1
595 1
1 359
703 1
1 1
706 1
715 1
1 1
710 1
723 3
665 1
1 572
441 45
443 45
1 584
1 1
1 634
723 1
1 647
353 90
1 732
67 232
723 3
1 859
1 1
1 1
4 890
118 1
1 1
4 967
1 1017
1 1
1 1041
54...

result:

ok ok

Test #18:

score: 0
Accepted
time: 5ms
memory: 7704kb

input:

1000
? 591451888148632183
- 478 549549332
- 787 581090850
- 265 537152516
+ 32 12
+ 427 5
+ 590 4
+ 58 12
? 1
+ 63 12
? 317
+ 395 5
+ 41 12
? 651
+ 139 9
? 60
+ 17 12
+ 97 11
+ 403 5
+ 23 12
+ 57 12
+ 19 12
? 362
+ 105 11
+ 51 12
+ 99 11
+ 387 5
+ 89 11
+ 680 4
? 28
+ 127 9
+ 85 11
? 888
+ 119 9
+ 1...

output:

-1 -1
590 4
282 1
1 1
534 1
247 1
656 1
1 1
1 1
680 4
1 1
680 4
680 4
442 19
1 1
1 1
58 346
699 1
590 24
1 1
1 578
1 1
590 28
1 1
167 1
590 1
734 4
659 1
564 1
734 3
1 1
734 4
734 4
1 1
733 1
734 4
386 92
1 1
351 100
712 1
725 1
1 1
61 519
3 899
3 928
357 69
1 828
133 111
135 1
725 16
4 1108
121 141...

result:

ok ok

Test #19:

score: 0
Accepted
time: 4ms
memory: 5716kb

input:

1000
? 856936698
+ 836 3
? 419
+ 120 11
+ 776 3
? 1
+ 118 11
+ 98 11
? 1
+ 79 12
+ 63 12
? 898
+ 141 2
? 900
+ 876 3
? 1
+ 386 3
+ 376 3
? 949
+ 696 3
? 2
+ 31 12
+ 8 12
+ 108 11
+ 52 12
+ 146 8
? 1007
? 1
+ 456 3
? 505
+ 38 12
+ 176 8
+ 616 3
+ 75 12
+ 45 12
+ 216 8
+ 59 12
+ 51 12
+ 39 12
+ 606 3
...

output:

-1 -1
420 1
836 3
836 3
1 1
1 1
876 3
1 1
875 3
1 1
98 72
1 16
776 18
774 18
348 1
864 7
876 9
615 27
906 3
716 18
906 1
906 3
906 3
1 1
1 1
905 3
906 3
905 3
72 362
1 84
866 12
210 1
611 28
1 1
1 1
1 1
896 6
64 432
4 996
76 547
1 1
2 1148
2 1148
1 1109
2 1208
1 1229
1 1
1 1
3 1284
30 1090
1 1359
1 ...

result:

ok ok

Test #20:

score: 0
Accepted
time: 4ms
memory: 5712kb

input:

1000
- 928 780094783
- 710 398698340
- 355 708243512
- 222 934705837
- 273 29457417
+ 7 12
+ 166 8
+ 113 11
+ 139 11
+ 181 8
+ 35 12
+ 21 12
+ 801 3
? 877
+ 53 12
+ 127 11
+ 88 12
+ 301 3
? 183
? 1
+ 196 8
+ 441 3
+ 125 11
+ 47 12
+ 271 2
+ 151 11
? 962
+ 601 3
+ 38 12
+ 221 8
+ 45 12
? 997
+ 34 12
...

output:

1 1
621 1
801 3
1 1
1 1
801 3
1 1
1 1
34 197
1 1
801 3
1 1
800 3
1 1
589 9
1 1
1 1
797 1
801 3
1 1
229 1
801 3
691 1
1 1
1 1
562 1
4 499
801 3
1 1
1 1
801 3
778 1
1 1
404 1
34 530
1 774
1 1
745 1
105 265
5 817
1 712
568 1
61 527
5 919
10 915
1 1
11 910
1 1
5 957
1 197
836 1
197 87
5 1123
61 707
1 11...

result:

ok ok

Test #21:

score: 0
Accepted
time: 4ms
memory: 5652kb

input:

1000
+ 8 12
+ 636 3
+ 15 12
+ 94 12
+ 356 3
+ 85 12
? 13
+ 556 3
+ 206 8
+ 24 12
+ 20 12
+ 111 11
? 49
? 7
+ 79 12
+ 846 3
+ 131 11
+ 77 12
+ 13 12
? 995
+ 546 3
+ 21 12
? 1010
+ 47 12
? 73
+ 27 12
+ 57 12
+ 816 3
+ 151 11
+ 211 8
+ 786 3
+ 54 12
+ 856 3
+ 886 3
+ 486 3
? 1132
+ 536 3
+ 12 12
? 1147...

output:

626 1
590 1
632 1
1 1
1 1
776 1
1 1
1 1
858 1
735 1
1 1
868 1
1 1
1 1
596 27
1 1
1 1
41 264
815 1
886 3
1 1
1 1
886 6
81 324
544 51
1 1
186 169
726 34
842 1
391 1
906 3
6 996
1 1
896 6
1 1
6 1146
1 1
231 176
790 1
1 1
320 1
1 825
1 1
1 1
1 1026
1 1
1 1511
1 1499
1 1419
4 1540
1 1
1 1
846 21
75 497
5...

result:

ok ok

Test #22:

score: 0
Accepted
time: 3ms
memory: 7732kb

input:

1000
+ 593 132415
- 310 420098
+ 576 965794
+ 509 638949
- 637 368901
+ 46 196629
+ 619 517472
+ 424 441788
+ 772 340443
+ 418 139594
- 21 147269
+ 383 456861
- 628 598537
+ 51 595087
+ 146 948842
- 942 435406
- 357 40209
+ 811 716421
+ 806 540386
+ 204 538624
- 891 312107
+ 598 65368
+ 355 739033
+...

output:

1 1
6 66847345
1 66844514
1 1
1 66823788
6 66847345
6 66847345
1 1
1 66844514
1 1
6 66847345
6 66847345
1 66844514
6 66847345
1 1
1 1
1 1
6 66847345
1 1
1 66844514
6 66847345
6 66847345
1 1
1 66844514
1 1
1 66823788
1 1
1 66844514
6 66847345
6 66847345
1 1
1 1
1 1
6 66847345
1 1
1 1
1 1
6 66847345
6...

result:

ok ok

Subtask #2:

score: 20
Accepted

Dependency #1:

100%
Accepted

Test #23:

score: 20
Accepted
time: 5ms
memory: 5772kb

input:

1000
- 1 999992
? 637280166636841974
? 122747834
+ 1 1
? 1
? 1
? 1
? 1
- 1 1
? 770322629409376789
+ 1 1
? 1
? 1
? 1
? 1
- 1 1
+ 1 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
+ 1 1
+ 1 1
? 3
+ 1 1
? 2
? 1
+ 1 1
? 5
+ 1 1
? 6
? 1
? 3
? 2
? 1
+ ...

output:

-1 -1
-1 -1
1 1
1 1
1 1
1 1
-1 -1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 3
1 4
1 1
1 1
1 6
1 4
1 5
1 6
1 1
1 7
1 5
1 8
1 1
1 7
1 10
1 9
1 1
1 10
1 9
1 1
1 6
1 9
1 10
1 1
1 1
1 9
1 10
1 9
1 1
1 6
1 10
1 1
1 9
1 7
1 10
...

result:

ok ok

Test #24:

score: 0
Accepted
time: 7ms
memory: 7708kb

input:

1000
- 1 999999995
? 895722220
? 622701657484514284
? 749191541
? 760407573
? 256900305987464119
? 366941537
? 606282059898057385
? 242911831452679328
? 62941208393497996
? 635277918903264521
? 364101078
? 668570749
? 782177832606476483
? 488263309
? 846845755610111030
? 683601827513277887
? 5323761...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
41 165
28 635
1 1
33 1
1 1
28 633
28 635
33 1
28 633
28 633
1 1
28 635
1...

result:

ok ok

Test #25:

score: 0
Accepted
time: 2ms
memory: 5700kb

input:

1000
? 883233335
- 363843 95831
- 753410 82908
? 281607526
+ 2575 5
+ 257 51
+ 80 59
+ 102 56
+ 1353 6
? 7
? 131
+ 19 60
+ 35 60
? 33
? 2871
? 957
? 1
+ 1133 6
+ 28 60
? 979
? 1
+ 56 60
+ 167 51
? 24
+ 54 60
+ 1078 6
+ 87 2
+ 12 60
? 4
+ 127 56
+ 22 60
+ 1 60
? 3352
+ 3083 4
? 24
+ 78 59
? 1
? 3923
...

output:

-1 -1
-1 -1
2573 1
2449 1
2547 1
1 1
1623 1
2575 5
1601 1
2575 5
2556 1
2572 5
1 1
3063 1
3083 4
1 1
3083 4
2033 13
2573 9
1075 1
2973 1
2813 1
1 1
3081 4
1696 1
3066 1
3251 1
3215 1
1 1
3161 1
3191 1
2071 36
1 1
1980 1
3013 1
1 1
690 1
1 1
1 1
3425 4
3425 4
1 2712
1849 45
2674 28
1 1
64 1390
1 1
1 ...

result:

ok ok

Test #26:

score: 0
Accepted
time: 7ms
memory: 5796kb

input:

1000
+ 61 2
? 62
+ 8 2
? 16
+ 1 60
+ 6 60
? 46
+ 4 60
? 61
? 122
+ 5 60
? 19
+ 393 6
+ 15 2
+ 40 51
? 695
+ 20 56
? 751
+ 338 6
+ 10 59
+ 2 60
+ 180 12
+ 283 9
+ 83 39
+ 131 2
+ 231 10
+ 30 2
+ 3 60
? 1010
+ 25 56
+ 30 54
+ 61 39
+ 15 54
+ 7 60
+ 8 58
+ 131 11
? 1342
? 22
? 122
? 61
? 1342
R 13
+ 15...

output:

1 1
47 1
1 79
2 66
1 66
1 226
1 1
1 1
1 1
1 1
1 929
41 57
41 96
1 1
1 711
30 299
1 1
21 1
62 118
62 79
1 929
30 298
21 1
62 118
62 118
62 79
21 298
1 528
1 656
1 716
392 1
1 829
1 940
13 294
1 1
13 238
1 294
13 238
1 294
1 294
13 294
13 294
1 294
1 1
1 1
1 929
1 950
393 5
1 1
1 940
13 294
13 238
1 2...

result:

ok ok

Test #27:

score: 0
Accepted
time: 0ms
memory: 5728kb

input:

1000
- 744068 585281
+ 3217 5
+ 3945 5
+ 596 38
+ 2057 7
+ 3441 5
+ 669 36
+ 105 56
? 64
+ 36 60
+ 9 60
? 4
+ 35 60
+ 2441 6
? 4282
+ 85 59
? 1447
+ 53 60
? 9
+ 23 60
+ 1787 7
+ 345 51
+ 13 60
+ 75 59
+ 2 60
? 1566
? 87
? 783
+ 37 60
+ 25 60
? 146
+ 3777 5
+ 4057 5
+ 63 60
? 5000
? 4
+ 4627 4
+ 2661...

output:

3379 9
3942 5
1 1
2513 1
3941 1
2400 1
3863 1
3177 1
3804 1
1 1
4054 5
1 1
4576 1
4627 4
1 1
1 1
4627 4
3777 19
4627 4
4626 1
4624 1
4627 4
1 1
2 3535
4625 4
1 4299
1 4228
3707 1
4684 4
1 1
3553 49
2879 1
1 1
4623 1
2 5056
1 1
2 5056
1 1
13 4494
1612 1
4684 4
2 5266
1 1
2 5574
1 803
1 5710
1 5764
12...

result:

ok ok

Test #28:

score: 0
Accepted
time: 5ms
memory: 5772kb

input:

1000
? 633778962213240036
- 851177905 750702799
- 378492115 580518445
- 465131557 630960174
+ 37 2
+ 875 6
+ 14 60
+ 391 8
+ 1097 5
+ 6 60
? 1
+ 28 59
+ 52 56
+ 1434 4
+ 20 60
? 1
+ 657 7
+ 550 8
+ 711 7
+ 2 60
+ 497 8
+ 47 56
+ 285 2
+ 3 60
? 1961
? 37
+ 16 60
+ 42 56
+ 765 7
+ 1041 5
+ 109 50
+ 20...

output:

-1 -1
1097 5
1434 4
1 1
1401 1
1427 1
1 1
1153 19
676 1
1 1
1434 4
28 643
27 640
1 1
927 1
28 643
1 1
1 1120
1 1542
1 1
1 1
1434 4
1 1
1385 1
68 1
551 40
766 40
551 1
931 40
876 40
1 1
984 44
876 40
1 1
876 40
985 46
766 40
551 40
876 40
68 1
931 40
766 40
551 1
551 1
1 1
551 40
1 2409
551 1
876 40
...

result:

ok ok

Test #29:

score: 0
Accepted
time: 0ms
memory: 5712kb

input:

1000
- 943099343 513027683
+ 4 60
? 3
+ 2538 6
+ 10 60
+ 415 38
+ 962 12
? 2713
+ 1571 9
+ 1938 8
+ 326 39
? 1
? 2769
+ 191 51
+ 864 12
? 6
+ 23 60
+ 2045 7
? 13
+ 913 12
+ 1062 11
? 2
+ 61 59
+ 815 13
? 3
+ 141 51
+ 2594 5
? 1
+ 2318 6
+ 116 56
+ 31 60
? 807
+ 1 60
+ 66 2
+ 2 60
+ 1779 9
+ 26 60
+ ...

output:

4 58
1 1
2538 6
1 1
2538 1
2531 1
2538 5
2538 4
2594 5
1819 1
1556 66
1 1
1 1
1 1
2594 5
1 1
1571 85
1 1
1 2577
1 1
2704 1
1 2289
1 1
1 1
37 2293
1 1
1 4157
1 1
1 4433
1 1
1 1
1 4809
1 1
92 1843
1 1
1 5285
92 1843
1 1
1 1
92 1843
1 5250
1 1
132 1
1 1
4 4867
1 1
1 1367
2194 53
70 684
1 4578
1 4935
1 ...

result:

ok ok

Test #30:

score: 0
Accepted
time: 2ms
memory: 7832kb

input:

1000
? 43032597990244423
? 455130775583464288
? 412733204506561581
+ 70 59
+ 1996 6
+ 76 59
+ 2903 4
? 1
+ 32 60
? 103
+ 593 2
? 4
+ 72 59
? 1
? 3151
? 23
+ 15 60
+ 98 56
+ 37 60
+ 223 51
+ 1017 8
+ 2 60
? 3446
+ 78 59
+ 2618 4
+ 38 60
? 83
? 3569
? 43
+ 1 60
? 3629
? 191
? 1
+ 1886 6
+ 858 8
+ 83 2...

output:

-1 -1
-1 -1
-1 -1
2903 4
2804 1
2903 1
2903 4
1 1
2884 1
1 1
2824 1
1 1
2864 1
1 1
2716 1
2903 4
2898 1
1 31
551 31
1614 1
1 1
2589 1
2903 4
2806 1
703 1
2259 1
2840 1
2579 10
2785 7
2903 4
2903 4
1 1
2901 4
2879 1
21 2185
1 2547
2715 10
1 350
1 382
2903 4
2719 12
2439 1
1 1
1 3633
9 3372
1 1
1 3837...

result:

ok ok

Test #31:

score: 0
Accepted
time: 0ms
memory: 5712kb

input:

1000
? 402253789334530553
? 395409983577110390
+ 6 60
+ 7 60
+ 176 51
+ 297 2
+ 131 56
+ 1035 10
+ 1399 9
? 1646
? 823
+ 362 39
+ 16 60
+ 2092 7
? 1
? 489
+ 2696 5
? 2
+ 1716 8
+ 385 38
? 10
? 3100
+ 882 10
+ 2473 6
+ 20 60
+ 23 60
+ 2200 7
+ 50 60
? 3303
+ 14 60
+ 552 36
+ 38 60
? 3
+ 780 10
+ 3377...

output:

-1 -1
-1 -1
1 1
595 1
2092 7
1610 1
2695 5
2691 1
1 1
1 1
2695 4
1 1
3377 4
1871 1
3377 3
3377 1
1 1
1 1
1 2297
2650 20
3371 1
3352 1
1 1
1 1
2 3387
2 3387
1 3402
3377 3
2 3587
1 1
1 1
2 3942
1 3915
2473 55
1 2763
3088 1
1 1
2425 51
2 4309
1923 1
1 1
223 1
1 5051
1 3501
1 1
3377 4
1 1
1 4925
1 5266
...

result:

ok ok

Test #32:

score: 0
Accepted
time: 7ms
memory: 5732kb

input:

1000
- 1 999999998
? 191047433372939880
? 689332612536469355
? 991049930
? 471407569263308015
+ 859 728
? 1586
? 61
? 2
? 26
? 1
? 122
? 793
? 13
+ 203 794
? 119
? 10
? 1
? 476
? 595
? 34
? 70
? 17
? 14
? 7
? 1190
? 2380
? 340
- 694 870
? 18
? 246
- 704 181
? 18
? 41
? 2214
? 123
? 3
+ 777 124
- 939...

output:

-1 -1
-1 -1
-1 -1
-1 -1
1 1
855 672
859 727
859 703
859 728
855 611
794 1
859 716
754 715
857 721
859 728
635 477
397 596
839 715
817 701
856 715
859 715
859 722
397 1
1 1
567 681
683 721
683 493
683 721
683 698
1 1
683 616
692 727
693 852
691 841
1 1
418 1
591 609
693 851
591 782
1 1
691 848
1 1515...

result:

ok ok

Test #33:

score: 0
Accepted
time: 6ms
memory: 5796kb

input:

1000
+ 337 4
+ 421 3
? 61
+ 14 30
? 457
? 1
+ 365 3
? 20
+ 205 6
? 1
+ 505 3
+ 3 30
+ 310 4
+ 257 5
+ 65 20
+ 12 30
+ 22 29
+ 449 3
+ 283 5
+ 393 3
? 62
? 31
+ 76 20
+ 34 26
+ 15 30
+ 24 29
+ 7 30
+ 9 30
? 11
+ 16 30
+ 11 30
+ 87 20
+ 477 3
+ 20 29
+ 6 30
+ 44 26
+ 10 30
? 1
+ 110 2
+ 133 8
+ 1 30
+...

output:

363 1
1 1
421 3
404 1
421 3
449 1
477 1
497 1
7 481
1 1
1 617
1 649
1 1
450 4
1 799
1 1
1 1
258 27
1 1
232 27
35 1
1 1
1 778
1 1
19 322
1 212
1 859
17 322
1 1
1 1
12 212
1 883
1 1
88 71
88 71
1 953
1 1
1 1
1 1
30 274
1 908
30 274
1 1
30 274
1 1
1 1
1 953
30 274
1 1
1 908
1 1
30 274
30 274
30 274
1 1...

result:

ok ok

Test #34:

score: 0
Accepted
time: 5ms
memory: 5708kb

input:

1000
- 820258425 145131798
+ 824 4
+ 908 3
? 2
+ 40 29
+ 717 5
+ 936 3
+ 46 29
+ 1 30
? 1
? 1038
+ 434 6
+ 18 30
+ 7 30
+ 5 30
+ 484 6
? 570
+ 880 3
+ 6 30
+ 3 30
+ 138 21
+ 2 30
+ 587 5
? 1
+ 28 30
+ 73 26
+ 16 30
+ 118 21
+ 36 29
? 93
+ 25 30
+ 128 21
+ 58 26
+ 88 26
? 107
+ 160 20
? 11
+ 10 30
+ ...

output:

907 3
908 6
1 1
393 1
936 3
852 1
838 1
928 1
935 3
933 1
1 709
1 708
935 3
1 643
1 1
3 744
928 1
1 1
936 3
2 986
1 1
278 1
1 1
1 1358
1 1
69 1
936 3
1 1129
257 1
203 1
1 1762
51 510
1 1790
1 1
51 458
30 163
51 458
1 1706
51 510
30 163
51 458
51 510
51 510
1 1
51 458
1 1762
1 1
51 510
1 1
30 163
51 ...

result:

ok ok

Test #35:

score: 0
Accepted
time: 0ms
memory: 7780kb

input:

1000
? 343701946976016788
? 817104848
+ 1027 5
+ 86 26
+ 1 30
+ 871 5
+ 923 5
+ 1159 4
? 1
? 411
+ 21 30
+ 25 30
+ 26 30
+ 76 2
+ 392 6
+ 1456 4
+ 667 6
? 1
+ 793 5
+ 467 6
+ 7 30
+ 1294 4
+ 42 30
+ 897 5
+ 15 30
+ 1079 5
+ 442 6
+ 1053 5
? 42
+ 1267 4
+ 39 30
+ 46 30
+ 717 6
+ 29 30
+ 10 30
+ 30 30...

output:

-1 -1
-1 -1
1159 4
767 1
1456 4
1021 18
1312 1
1589 1
1433 1
1514 1
1596 1
1596 3
1596 3
1 1
1 1
1596 3
1 1
1596 3
1 1
1 1126
323 1
313 1
1 1
1595 3
1 1
1 1498
1 1
1 1496
1 1642
1 1404
1 1
601 1
467 120
11 1606
1 1865
1 1
1 1
1 1980
1 1
1 2100
1 1
1680 1
1 1
1 2142
1 1235
1457 1
1680 3
1246 1
793 13...

result:

ok ok

Test #36:

score: 0
Accepted
time: 0ms
memory: 5652kb

input:

1000
- 818800624 446646434
- 27414106 735469552
? 111568553
- 441631873 295236704
- 249860804 762203017
- 553642689 693917976
? 217971857
- 425015676 590766431
- 334516507 936725365
- 376162412 508802174
- 57313907 213779630
+ 387 19
+ 10 30
? 3
+ 63 30
+ 105 28
+ 35 30
+ 38 30
? 7
+ 1178 4
+ 42 30
...

output:

-1 -1
-1 -1
385 19
385 15
1926 1
1995 1
2033 3
1186 1
2033 1
2032 3
1 1
2032 3
1913 1
2032 3
1 1
1542 1
2032 3
1 1
2145 3
2145 1
1367 19
2 1066
1 1
1 1
2228 3
2225 1
1 1
1 1
1 1
2313 3
1313 39
1032 1
1 1
2313 3
1270 57
1 1
1 1
1 2087
1 1
2313 1
2168 8
2274 1
2288 1
7 2453
1 2743
763 1
1 1
1 1
735 1
...

result:

ok ok

Test #37:

score: 0
Accepted
time: 4ms
memory: 5700kb

input:

1000
+ 22 30
? 51
+ 837 8
+ 2021 3
? 1
+ 53 30
+ 998 8
+ 71 30
+ 61 30
+ 375 21
? 1
+ 748 9
? 2189
+ 72 30
+ 1238 7
+ 1214 7
+ 9 30
+ 17 30
+ 385 21
+ 170 26
+ 16 30
? 395
? 3
+ 1567 5
? 2375
+ 1287 6
+ 405 21
+ 200 26
? 1214
+ 85 29
+ 315 21
+ 1046 7
+ 426 2
+ 25 30
+ 68 30
+ 1645 5
+ 109 29
+ 31 3...

output:

1 1
2021 3
2021 3
1 1
1629 1
2021 1
1 1
843 1
2018 1
1651 1
2179 1
1 1
2189 3
2189 3
1 1
1 1
38 679
1 90
9 900
2197 1
2217 3
1 1
637 1
1 1
9 1377
2217 3
2217 3
2015 1
2217 3
5 1837
1 1
1 1814
2189 5
2179 6
1 1
1 2493
2140 1
1 2845
1602 43
2216 3
56 1694
1 2970
1 2048
1930 1
16 2750
1 3171
1 1
1 1
21...

result:

ok ok

Test #38:

score: 0
Accepted
time: 5ms
memory: 5664kb

input:

1000
+ 16 12
+ 26 12
? 1
+ 41 12
+ 611 3
+ 291 3
+ 71 11
+ 12 12
? 5
? 45
+ 561 3
+ 531 3
+ 43 12
+ 28 12
? 705
+ 106 8
+ 351 3
? 1
? 358
+ 37 12
+ 341 3
+ 31 12
+ 33 12
+ 15 12
+ 461 3
+ 521 3
+ 81 8
? 781
+ 421 3
+ 126 8
+ 451 3
+ 431 3
+ 46 12
+ 661 3
? 1
+ 241 3
+ 3 12
+ 6 12
+ 131 8
+ 67 11
? 1...

output:

16 24
609 1
569 1
1 1
611 3
268 1
1 1
451 21
661 3
610 5
613 1
221 60
191 1
421 33
661 3
594 1
1 1
665 1
671 3
670 3
652 1
671 3
1 397
651 7
681 3
6 697
1 1
641 13
1 949
1 949
687 1
1 1
542 31
572 31
432 1
572 34
1 1
92 1
461 73
562 1
8 873
1 1
25 663
26 675
1 955
1 962
1 1
147 151
58 157
122 151
14...

result:

ok ok

Test #39:

score: 0
Accepted
time: 4ms
memory: 5776kb

input:

1000
? 799101924556869888
? 634727384
- 551823302 458749052
- 160594369 36937490
? 560527360861009747
- 480470861 80598631
- 191523059 381216422
- 300579332 854280403
+ 11 12
+ 52 12
+ 481 3
+ 791 3
? 1
? 41
+ 8 12
+ 831 3
? 5
? 875
+ 10 12
+ 591 3
+ 62 11
? 1
? 901
? 53
+ 48 12
+ 5 12
+ 68 11
+ 431...

output:

-1 -1
-1 -1
-1 -1
791 3
753 1
829 1
1 1
831 3
1 1
784 1
831 1
1 1
831 3
367 1
820 1
828 1
676 1
831 3
1 1
1 1
831 3
1 1
769 1
279 1
766 11
803 1
831 3
831 3
830 3
831 3
831 3
442 1
830 3
243 1
1 1
588 1
371 87
188 1
490 60
1 1
1 1
501 66
831 3
831 3
1 1
1 1
831 3
22 680
1 1
814 1
1 1014
1 468
761 19...

result:

ok ok

Test #40:

score: 0
Accepted
time: 4ms
memory: 5772kb

input:

1000
- 932542979 390508036
+ 196 2
+ 31 12
+ 316 3
? 332
? 1
+ 43 12
+ 111 8
? 2
+ 566 3
+ 2 12
? 1
? 617
? 617
+ 73 11
+ 121 8
+ 116 8
+ 85 11
? 1
? 655
+ 686 3
+ 29 12
+ 141 8
+ 131 8
+ 306 3
+ 486 3
+ 10 12
? 8
+ 906 3
? 1047
+ 13 12
+ 41 12
+ 266 3
+ 826 3
+ 20 12
? 99
? 3
+ 77 11
+ 516 3
? 1103...

output:

1 1
316 3
315 3
566 3
1 1
1 1
566 3
1 1
681 1
1 1
813 1
906 1
1 1
909 1
926 3
1 1
901 1
1 1
326 51
1 1
916 1
1 1
1 1
2 609
1 1
1 1
655 51
926 3
432 1
516 78
1 1
425 1
58 442
1 981
1 827
1 1
6 956
390 1
1 1
209 118
925 1
1 1
1 1094
1 1
137 1
1 1
1 1221
1 1
1 290
17 1018
926 3
1 1211
25 924
925 3
130 ...

result:

ok ok

Test #41:

score: 0
Accepted
time: 4ms
memory: 5680kb

input:

1000
- 341931140 365865602
- 845081870 989903406
- 84666035 82751689
- 780421340 155098541
+ 63 12
+ 31 12
+ 48 12
? 98
? 7
+ 570 4
+ 5 12
+ 553 5
+ 35 12
+ 1 12
+ 529 5
? 1
+ 313 5
+ 14 12
+ 465 5
+ 59 12
+ 45 12
? 1
+ 337 5
+ 44 12
+ 714 4
+ 217 2
+ 545 5
+ 975 4
? 1
+ 13 12
+ 137 9
+ 56 12
? 1171...

output:

1 1
61 8
570 4
553 9
975 4
1 1
405 1
975 4
1 1
736 1
376 58
377 61
1 1
975 4
1 1
358 1
969 1
1 1
1 1
885 15
975 4
1 1
869 1
1 1
265 1
948 1
448 107
975 3
975 4
221 1
875 32
885 28
13 831
212 1
465 121
949 1
1 949
855 25
1 1
59 589
926 16
60 630
1 1091
1 1
915 19
444 1
1 1206
1 1313
1 1111
61 828
1 1...

result:

ok ok

Test #42:

score: 0
Accepted
time: 4ms
memory: 7764kb

input:

1000
- 139771670 151816065
+ 609 3
+ 369 3
+ 149 8
+ 25 12
+ 76 12
+ 699 3
? 739
? 1
+ 30 12
+ 159 8
? 1
+ 1 12
? 3
+ 739 3
+ 103 11
+ 46 12
+ 819 3
+ 31 12
+ 119 11
? 1
+ 66 12
+ 539 3
+ 121 11
+ 1009 3
+ 127 11
+ 799 3
+ 1249 3
+ 519 3
? 9
+ 17 12
+ 85 12
+ 137 11
+ 14 12
? 13
+ 8 12
+ 244 8
+ 619...

output:

1 1
699 3
609 6
699 1
819 3
1243 1
1239 1
1248 3
1084 1
1216 1
1248 3
1249 3
945 1
1 1
1255 1
1 1
1062 1
1258 3
1 1
1249 6
991 1
1235 1
1 1
1258 3
461 1
1209 9
712 1
1208 9
1198 7
127 249
1014 1
1 1
1 1
1 1
1209 9
1042 1
1209 12
1 1
1249 5
1 1
1 1
1029 30
1149 24
800 1
1050 1
1246 1
1 1
1171 1
1269 ...

result:

ok ok

Test #43:

score: 0
Accepted
time: 0ms
memory: 5628kb

input:

1000
? 788204862
- 766153650 262998225
- 239784404 714911849
- 671589115 539101332
- 957718463 503903921
- 38249837 725516518
- 411439007 175225944
+ 366 5
+ 510 5
? 1
+ 93 12
+ 61 12
+ 58 12
? 3
+ 334 5
+ 146 11
+ 91 12
? 1
+ 2 12
+ 82 12
+ 226 9
? 2
+ 210 9
+ 990 4
+ 70 12
+ 214 9
+ 954 4
? 7
+ 71...

output:

-1 -1
510 5
509 4
510 5
509 5
987 1
963 1
990 3
1 1
1071 4
1 1
1071 3
1 1
927 20
990 8
1 1
1048 1
1 1
1 1
1 1
1069 1
1 1
711 52
784 1
206 201
1 1
865 1
1 1
1 1
1 1
1062 8
1 1
1062 8
816 1
144 103
558 117
1025 12
1062 8
1 1
1 1
1061 8
1055 1
1062 8
1 1
1 1
1 1
918 44
1 1
687 88
879 60
232 1
1 1
1 297...

result:

ok ok

Test #44:

score: 0
Accepted
time: 6ms
memory: 7640kb

input:

1000
+ 828515 378833
- 913936 37297
+ 999591 753791
+ 541369 21327
- 128090 191341
+ 676650 957339
+ 637479 516609
+ 900617 958164
- 506064 384050
- 816094 437265
+ 657590 816523
+ 959320 331429
- 930033 355207
+ 120953 609750
+ 337197 880101
+ 39046 813872
+ 867450 686846
+ 94845 686378
+ 513228 18...

output:

34 69273147
1 59288015
1 69263819
1 69272137
1 69207381
1 1
1 69265799
29 69273146
1 69265799
34 69273147
34 69273147
1 69263819
1 1
1 1
1 69272137
29 69273146
1 1
34 69273147
29 69273146
1 59288015
1 69272137
1 1
1 1
1 69272137
1 69265799
34 69273147
1 69207381
1 1
1 69263819
34 69273147
1 1
34 692...

result:

ok ok

Subtask #3:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #45:

score: 10
Accepted
time: 42ms
memory: 9936kb

input:

10000
- 1 999991
? 51642673708798142
? 484858251
? 241022805898228231
? 853145858
? 507839352
? 624514179
? 265899555
? 518135543197326485
+ 1 1
R 1
? 181920453
? 634429286886498994
? 141349658
? 318797432346517433
? 12836741748146729
? 891941072845575122
? 777965676
? 356277427560382499
- 1 1
? 403...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 ...

result:

ok ok

Test #46:

score: 0
Accepted
time: 64ms
memory: 9912kb

input:

10000
- 1 999999992
? 78392518046724165
? 583190556
? 678477533836385913
? 583013734
? 268724011969298950
- 834 764
? 68092471
? 665446809
- 633 237
? 26620354
+ 249 319
- 49 784
? 61
? 366
? 1
- 908 908
? 61
- 480 354
? 61
- 380 14
+ 213 472
? 59
? 1003
? 1
? 17
+ 506 977
R 1
? 1
? 59
? 17
- 445 23...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 306
1 1
48 319
1 306
1 306
213 414
1 1
213 472
209 460
213 472
213 414
209 460
1 1
213 414
213 472
209 460
758 682
1 1
634 1142
1 1
213 2249
1 1948
1 1
21 2570
25 2570
316 934
482 468
19 2788
1 1593
1 1
25 2790
1 2770
439 1502
25 3262
1 1
1 2314
25 3...

result:

ok ok

Test #47:

score: 0
Accepted
time: 28ms
memory: 9880kb

input:

10000
- 395299 197776
? 672542832
- 708014 715038
- 787354 1449
+ 1696 51
+ 21496 6
+ 20571 7
? 21559
+ 23531 6
+ 61 60
+ 23146 6
+ 150 60
+ 144 60
+ 1531 56
+ 7267 10
+ 216 60
? 61
+ 2447 50
+ 4372 37
+ 28512 5
+ 23311 6
+ 5443 36
+ 17061 7
+ 585 59
+ 11703 9
+ 276 60
+ 2876 50
+ 27000 5
+ 1846 51
...

output:

-1 -1
1 1
23476 1
28480 1
28512 5
18483 1
1 1
28512 5
1 1
18440 1
1 1
32125 4
32122 1
27268 1
32125 4
15627 1
1 1
1 1
33265 4
1 1
33322 4
1 1
1 1
21358 1
33322 4
33311 1
1 1
21260 1
1 1
33322 3
33322 4
14963 1
1 1
14906 1
33322 4
33322 4
33322 3
1 1
33265 12
33265 12
1 1
31353 1
33265 12
14736 1
210...

result:

ok ok

Test #48:

score: 0
Accepted
time: 66ms
memory: 9884kb

input:

10000
+ 191 56
+ 3547 4
+ 517 36
+ 2521 4
+ 13 60
+ 17 60
+ 4630 4
+ 31 60
+ 3775 4
+ 4402 4
? 133
+ 99 59
+ 1324 4
+ 2065 4
+ 1438 4
+ 97 59
+ 2692 4
? 1685
+ 1951 4
+ 83 59
+ 156 56
+ 3034 4
+ 4516 4
? 1
+ 39 60
+ 2 60
+ 43 60
? 1
+ 783 33
? 5
? 65
+ 106 2
+ 4174 4
+ 28 60
? 5461
+ 79 59
+ 1894 4
...

output:

4501 1
2961 1
4630 4
4630 4
4629 1
4569 1
1 1
1759 45
3918 1
4194 1
1 1
4630 4
1 1
4553 1
4630 3
3581 1
4629 1
1 1
4572 1
4630 4
4628 4
4630 4
4630 4
1160 1
4561 1
760 1
722 1
4630 3
4630 4
1 1
2635 84
1 1
3547 48
4623 1
4630 4
1 4758
1 3495
1 1
2 5083
1 2871
65 1955
1 3915
1 5587
2 5638
2 5748
3537...

result:

ok ok

Test #49:

score: 0
Accepted
time: 22ms
memory: 9880kb

input:

10000
? 169309425
- 611184 287529
+ 57 60
? 58
+ 24928 7
+ 14300 9
+ 212 60
+ 346 60
+ 2544 51
+ 2324 51
+ 205 60
+ 40210 4
+ 5257 38
+ 19876 8
+ 9462 10
? 1
+ 446 60
? 40687
+ 29988 5
+ 230 60
? 1698
+ 4640 39
? 40791
+ 395 60
+ 7176 36
+ 738 60
+ 115 60
+ 436 60
+ 629 60
+ 12844 9
+ 3444 51
+ 3741...

output:

-1 -1
1 59
40210 4
1 1
38516 1
1 1
40207 1
40093 1
1 1
40210 4
40210 4
40210 1
19214 1
1 1
39981 1
40210 4
38917 1
1 1
39345 1
40210 4
1 1
40210 4
40210 3
40210 4
1 1
40210 4
40208 1
1 1
25555 1
40210 4
39889 1
37417 12
1 1
28882 1
1 1
25100 1
40210 4
1 1
40155 1
1 1
36050 1
40208 1
40177 1
17147 1
...

result:

ok ok

Test #50:

score: 0
Accepted
time: 51ms
memory: 9952kb

input:

10000
- 904527810 739448722
? 172666022316725526
+ 4505 6
? 4510
+ 506 56
+ 456 56
+ 1269 36
+ 63 60
+ 6982 5
+ 4340 6
? 3
+ 11529 4
? 3919
+ 12612 4
+ 11928 4
+ 263 59
? 12907
+ 5000 6
+ 1884 35
+ 2176 34
? 1
+ 7486 5
+ 8382 5
+ 12783 4
+ 874 50
+ 66 60
+ 128 60
+ 64 60
+ 8214 5
+ 661 51
+ 172 60
+...

output:

-1 -1
1 1
6981 4
7614 1
1 1
12612 4
12783 4
13296 4
13289 1
1 1
12145 1
1 1
13515 1
13823 1
1 1
9894 29
13866 4
13866 4
1 1
13862 1
5758 1
13866 1
13866 4
1 1
1 1
13866 3
13659 1
13796 1
13866 4
9403 41
13866 4
1 1
1 1
5032 1
13866 4
5002 1
13866 3
9429 1
1 182
97 3557
13498 1
12963 1
14037 4
1 1
13...

result:

ok ok

Test #51:

score: 0
Accepted
time: 38ms
memory: 11796kb

input:

10000
+ 870 56
+ 12926 10
+ 76 60
+ 665 56
+ 21278 5
+ 18711 7
+ 303 60
+ 19629 7
+ 388 60
+ 188 60
+ 5215 14
? 516
+ 391 60
+ 5497 14
+ 7258 13
? 1
+ 920 56
+ 10192 11
+ 412 60
+ 1680 51
+ 22566 5
+ 13803 9
+ 1 60
+ 327 60
? 23359
+ 483 59
? 11709
? 3
+ 8026 13
? 1
? 23431
+ 141 60
+ 81 60
? 1
? 23...

output:

18201 14
21278 5
1 1
10900 1
22565 4
22566 5
1 1
22566 5
1 1
22566 5
10778 1
22565 5
22397 1
22434 1
1 1
1 1
22566 5
18597 1
21938 1
22034 1
22566 5
22566 5
22566 5
1 1
22566 5
22566 5
1 1
22564 1
22566 5
1 1
1 1
22565 4
1 1
22958 5
1 1
24616 1
24657 1
1 1
1 1
24663 3
1 1
1 1
24663 4
1 1
24663 4
246...

result:

ok ok

Test #52:

score: 0
Accepted
time: 41ms
memory: 11884kb

input:

10000
- 543462752 111240181
+ 690 59
+ 519 60
+ 509 60
+ 1331 51
+ 17078 6
+ 13277 7
+ 24053 5
+ 8613 8
+ 1271 56
+ 3067 38
+ 27259 4
+ 31135 4
+ 1076 56
+ 1921 51
+ 5541 35
+ 317 60
+ 26746 4
? 1
? 3
+ 1021 56
+ 63 60
+ 29254 4
? 31818
+ 274 60
+ 4138 36
+ 354 60
+ 26405 5
+ 14357 7
+ 27943 4
+ 260...

output:

31135 4
31133 4
1 1
31133 4
20459 1
1 1
20436 1
31135 4
30357 1
30581 1
1 1
31134 1
31135 3
1 1
31127 1
31135 4
31135 4
1 1
1 1
30846 1
14084 1
1 1
31135 4
1 1
22491 1
1 1
31135 4
1 1
31135 4
31093 1
30972 1
31135 4
1 1
1 1
31133 4
31135 3
13007 1
31078 1
31135 4
31122 1
29549 1
29995 16
31066 1
311...

result:

ok ok

Test #53:

score: 0
Accepted
time: 37ms
memory: 11864kb

input:

10000
? 371100110872998426
- 196897526 406576172
+ 576 59
+ 9411 13
? 22
+ 31 60
+ 706 59
+ 548 59
+ 4364 39
+ 948 56
+ 1158 56
? 9811
? 1
? 1
+ 776 59
+ 459 60
+ 166 60
+ 181 60
+ 1203 56
? 326
? 10106
+ 20463 8
+ 6190 14
? 3
+ 2398 51
? 1
+ 499 60
+ 26762 6
+ 26047 6
+ 4056 39
? 27641
+ 300 60
+ 1...

output:

-1 -1
9402 1
1 1
9411 13
9411 13
9098 1
1 1
20462 7
20463 8
1 1
21195 1
1 1
1 1
1 1
1 1
26762 6
1 1
26762 6
1 1
26762 6
1 1
1 1
1 1
26679 1
1 1
29866 1
30351 4
30351 4
1 1
29126 1
27009 1
30346 1
30351 4
30349 4
30351 3
25475 1
30351 4
18876 1
30258 1
30012 1
30243 1
25391 1
30005 1
30255 1
1 1
3032...

result:

ok ok

Test #54:

score: 0
Accepted
time: 65ms
memory: 9880kb

input:

10000
- 1 999999989
? 854803774980924014
? 366296493
? 44260361757615642
? 354024438796336948
? 235345445
? 273082148558437774
? 654283837570755065
? 434911849859856800
? 37095183716651734
? 374319068
- 830 396
? 327213098
+ 362 295
R 1
? 836452575345424749
? 341917233
? 165607131718316743
+ 947 263...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
807 1
931 249
931 187
937 235
807 1
1 1
937 261
807 1
1 1
947 263
931 187
1 1
181 261
1 1
183 263
179 179
1 1
1 1
1 1
1 1
183 121
183 125
130 90
183 125
183 125
183 121
1 1
51 523
1 1
51 523
49 523
559 1
810 13
8...

result:

ok ok

Test #55:

score: 0
Accepted
time: 57ms
memory: 9960kb

input:

10000
- 425706638 673569911
? 333713287121988942
- 73122577 192431241
- 703014478 486986479
- 166937354 734512429
- 669805867 967168964
? 781106041
- 104180619 475478572
- 788408117 629169920
- 436514051 576477351
+ 3 30
+ 148 30
+ 3181 6
+ 2219 7
+ 928 2
+ 93 30
+ 1112 8
+ 341 26
? 3319
+ 63 30
+ 4...

output:

-1 -1
-1 -1
1 1
3181 6
1 1
5227 3
1 1
5227 3
5227 3
4354 1
1 1
1 1
1 1
5227 3
1 1
1 1
5199 1
4493 1
1 1
3515 31
1 1614
5225 1
1 1
4779 9
5133 1
5227 1
5081 1
4667 12
4666 11
5227 3
1 1
1 1
5184 1
5311 1
1 1
5169 1
1573 1
1508 1
1 1
4 2707
3 2739
1 497
5283 6
5311 1
5307 1
5283 6
1 1
1 1
1342 1
1 1
5...

result:

ok ok

Test #56:

score: 0
Accepted
time: 54ms
memory: 9876kb

input:

10000
? 158385510
? 330698307
+ 403 28
+ 1618 19
? 8
+ 148 30
+ 1 30
? 1
+ 120 30
? 1
+ 565 28
+ 5400 5
+ 5842 5
+ 589 28
+ 1462 19
+ 281 30
+ 538 28
+ 2300 6
+ 128 30
+ 7777 4
? 4048
+ 595 28
+ 7534 4
+ 237 30
+ 7968 3
+ 766 25
+ 9144 3
+ 8248 3
+ 3775 6
? 9565
? 1
+ 4490 5
+ 247 30
? 12
? 200
+ 68...

output:

-1 -1
-1 -1
1613 17
1618 19
1618 19
3743 1
1 1
9144 3
9135 1
8947 1
9144 3
9144 3
9144 3
9143 3
8249 1
9144 3
8526 1
7495 1
1 1
1 1
9144 3
9116 1
9676 3
1 1
9676 3
9872 3
1 1
9871 3
9872 3
9872 3
1 1
7072 1
9871 3
9868 1
9872 3
9869 1
1 1
9872 3
9864 1
9368 1
9144 21
1 1
9453 1
1 1
9871 3
9571 1
983...

result:

ok ok

Test #57:

score: 0
Accepted
time: 41ms
memory: 9960kb

input:

10000
? 789203249
- 145033530 216841645
- 855037843 559074667
? 220569521
? 849384071
- 865926982 137876387
? 104033476
- 243995975 213674251
? 52841741
- 22691187 119921821
- 57115161 241710477
- 876843966 768471768
+ 142 30
+ 3050 10
+ 2683 21
+ 418 30
+ 462 30
+ 245 30
? 32
? 320
+ 3092 10
+ 256 ...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
2665 18
2740 1
1 1
13297 4
13297 4
12061 1
13296 1
13295 4
13297 4
9882 1
1 1
15952 1
1 1
15952 3
15952 3
15951 3
13174 1
1 1
15663 1
1 1
1 1
1 1
15498 1
15952 3
1 1
15952 3
7244 1
15277 1
15616 1
15949 1
10112 1
15930 1
13453 1
15980 3
15944 1
1 1
15980 3
15964 1
1 1
1...

result:

ok ok

Test #58:

score: 0
Accepted
time: 37ms
memory: 9952kb

input:

10000
? 653375643403521046
- 382390650 403494125
- 193848294 417080075
- 663045629 62519236
? 413539094
? 591996690
- 675087491 837403539
- 57577565 669745583
- 320017426 114420581
- 388597322 375325170
+ 686 30
+ 714 29
+ 9422 7
+ 469 30
+ 1397 26
+ 17654 3
+ 402 30
+ 586 30
+ 378 30
+ 782 29
+ 172...

output:

-1 -1
-1 -1
-1 -1
17654 3
17654 1
1 1
17783 1
1 1
17597 1
14060 1
1 1
1 1
17794 3
17794 1
17631 1
17794 3
16199 1
17793 3
17794 3
17794 1
17794 3
17794 3
1 1
17202 1
1 1
18241 1
1 79
1 1
18235 1
17542 1
18216 1
1 1
1 1
18242 3
17820 1
18242 3
18242 3
7875 1
1 1
18242 3
18190 1
1 1
18193 1
12962 87
1...

result:

ok ok

Test #59:

score: 0
Accepted
time: 29ms
memory: 9952kb

input:

10000
+ 383 30
+ 1641 26
+ 322 30
+ 375 30
+ 3494 20
+ 163 30
+ 10973 6
+ 45 30
+ 1446 26
+ 1019 29
+ 346 30
? 1
+ 2066 21
+ 12023 6
+ 2386 21
+ 27 30
+ 14066 5
+ 1726 26
+ 20242 3
+ 129 30
+ 8480 7
+ 1711 26
+ 5193 8
? 1
+ 939 29
+ 8240 7
? 20747
+ 272 30
+ 1111 29
+ 4871 8
? 2
+ 621 30
+ 494 30
? ...

output:

10973 6
20242 3
1 1
20241 3
1 1
20242 3
1 1
20242 3
1 1
1 1
1 1
1 1
20251 1
20549 3
20531 1
20550 3
20510 1
9640 1
22006 3
1 1
21772 1
22006 3
21995 1
20420 1
21944 1
22006 3
19619 1
21999 1
21888 1
20160 1
1 1
22006 1
1 1
22006 3
21948 1
18540 1
1 1
21408 1
21968 1
1 1
22006 3
22004 1
21882 1
1 1
2...

result:

ok ok

Test #60:

score: 0
Accepted
time: 46ms
memory: 9856kb

input:

10000
? 291100932577212805
? 788602503
- 782072727 439546129
- 612294436 964941196
? 777741174028564530
? 996935273701916349
+ 3268 3
? 1
+ 2728 3
+ 893 8
+ 5948 3
? 852
+ 2768 3
? 5967
+ 608 11
+ 3738 3
+ 327 12
+ 1253 8
? 1
+ 122 12
? 1
+ 534 11
? 6024
? 3
? 1506
+ 1318 8
? 13
+ 2018 3
+ 2188 3
+ ...

output:

-1 -1
-1 -1
-1 -1
-1 -1
3268 3
5099 1
1 1
5948 3
5948 3
1 1
5948 1
4445 1
5938 1
5948 3
5918 1
5948 3
5947 3
5948 3
5947 3
4914 1
5625 1
1 1
5938 1
5925 1
5505 1
5942 1
5948 3
5948 1
5739 1
5948 3
5948 3
1 1
5944 1
6058 3
6057 3
1 1
2710 1
6058 3
5614 1
6048 1
1 1
1 1
6058 3
6057 1
2638 1
2627 1
605...

result:

ok ok

Test #61:

score: 0
Accepted
time: 33ms
memory: 9864kb

input:

10000
? 825288418
? 944191971
- 678754534 82898105
- 705248193 71810410
+ 8054 3
+ 586 12
+ 692 11
+ 3234 3
+ 301 12
+ 6044 3
+ 500 12
+ 6614 3
+ 1944 3
+ 597 12
+ 6634 3
+ 712 11
+ 621 12
+ 812 11
+ 525 12
+ 1249 8
+ 325 12
? 8196
+ 794 11
+ 7364 3
+ 5984 3
+ 451 12
+ 898 11
? 58
+ 5444 3
+ 6304 3
...

output:

-1 -1
-1 -1
1 1
7999 1
8044 1
8054 1
8054 1
8051 1
1 1
7862 1
1 1
5288 1
5284 1
3847 1
6997 1
1 1
1 1
8051 1
1 1
8054 3
6974 15
6974 18
1 1
6974 18
1 1
6974 18
1 1
8043 1
1 1
8053 3
6325 1
8050 1
1 1
7185 1
7185 1
8049 1
7506 1
1 1
8053 3
1 1
8053 3
8051 1
7504 21
1 1
8054 3
1 1
8015 1
1 1
1 1
6783 ...

result:

ok ok

Test #62:

score: 0
Accepted
time: 37ms
memory: 9896kb

input:

10000
? 853172908647670349
+ 547 12
+ 225 12
+ 4893 5
+ 1769 9
+ 364 12
+ 132 12
+ 620 12
+ 5579 4
+ 328 12
+ 531 12
+ 1773 9
+ 330 12
+ 338 12
+ 299 12
? 5
+ 3349 5
+ 308 12
+ 2789 5
+ 1059 11
? 1
+ 1741 9
+ 5201 4
+ 1461 9
+ 30 12
+ 7127 4
+ 6695 4
+ 507 12
? 3680
+ 1205 9
+ 6002 4
? 7373
? 1
+ 21...

output:

-1 -1
5578 1
5579 4
3468 1
1 1
7127 4
7127 4
7126 1
6080 1
1 1
1 1
7127 4
3426 1
7127 4
7120 1
7619 1
6519 1
1 1
7890 4
7892 4
7892 4
7892 3
7130 1
3733 55
1 1
3723 1
5732 22
3670 1
7924 1
7982 4
1 1
7963 1
1 1
1 1
1 1
7982 4
1 1
7982 4
7982 4
7959 1
7982 4
1 1
7982 4
7943 1
6673 1
1 1
1 1
8198 1
36...

result:

ok ok

Test #63:

score: 0
Accepted
time: 33ms
memory: 9896kb

input:

10000
+ 5671 3
? 3
+ 9821 3
+ 6591 3
+ 481 12
+ 243 12
+ 523 12
? 5
? 1973
+ 1926 8
+ 1000 11
+ 846 12
+ 5261 3
+ 1058 11
+ 884 12
+ 482 12
+ 1152 11
+ 798 12
+ 3061 3
? 20
+ 3631 3
+ 352 12
+ 624 12
+ 601 12
+ 877 12
+ 1026 11
+ 1956 8
+ 424 12
+ 3391 3
+ 813 12
+ 1182 11
+ 10591 3
? 37
+ 296 12
? ...

output:

5671 1
9819 1
7851 1
9804 1
10557 1
1 1
5172 1
10581 1
9953 1
9039 1
10514 1
10568 1
10021 1
1 1
1 1
6898 1
10711 3
1 1
10711 3
10635 1
10572 1
10711 1
10711 3
1 1
1 1
6906 1
10413 1
1 1
10112 1
7841 45
9670 1
10681 1
10708 1
6884 44
9948 1
1 1
7820 1
10710 3
10711 3
9220 32
7681 47
6832 1
10751 3
1...

result:

ok ok

Test #64:

score: 0
Accepted
time: 33ms
memory: 9948kb

input:

10000
? 303088656
- 864759833 733335172
? 998361565
+ 570 12
? 1
+ 2604 8
+ 584 12
+ 5009 3
? 3
+ 91 12
+ 103 12
+ 1137 11
+ 5229 3
? 3
+ 665 12
+ 787 12
+ 7509 3
+ 705 12
+ 7199 3
+ 7959 3
+ 573 12
+ 1814 8
+ 612 12
+ 485 12
+ 10259 3
+ 2344 8
? 3477
? 1
+ 790 12
+ 57 12
+ 6819 3
+ 10439 3
+ 101 12...

output:

-1 -1
-1 -1
570 12
5009 1
5229 1
6794 1
10259 3
1 1
10429 1
10424 1
10439 3
10439 3
10152 1
10439 3
10318 1
10365 1
10419 1
4952 1
1 1
10489 3
1 1
4895 1
9248 1
1 1
10659 3
5246 1
1 1
11265 1
5229 1
11298 3
5229 78
1 1
9570 1
1 1
11298 3
11309 3
11309 3
1 1
5145 1
1 1
7197 1
11301 1
11309 3
11289 4
...

result:

ok ok

Test #65:

score: 0
Accepted
time: 30ms
memory: 9880kb

input:

10000
? 894000788
+ 566 12
+ 12056 3
+ 680 12
? 863
? 12082
+ 2536 8
+ 8966 3
+ 2231 8
+ 524 12
? 1
+ 308 12
+ 4446 3
+ 4456 3
+ 634 12
? 1
+ 31 12
+ 9106 3
+ 1661 8
? 6083
? 1
+ 10896 3
+ 1108 11
+ 13396 3
+ 12626 3
+ 11306 3
+ 284 12
+ 2661 8
? 17
? 13549
? 797
? 1
+ 12566 3
+ 12556 3
+ 3256 3
? 2...

output:

-1 -1
11196 1
1 1
12056 3
12056 3
5982 1
12056 3
13382 1
1 1
12605 1
13396 3
13395 3
1 1
12911 1
13391 1
6586 36
13362 1
12541 11
1 1
1 1
13396 3
1 1
11447 1
12591 1
1 1
13394 1
13396 3
10644 1
13396 3
1 1
13394 1
1 1
13298 1
13506 3
1 1
13506 3
11953 1
1 1
13326 1
1 1
1 1
13506 3
10698 1
13337 1
12...

result:

ok ok

Test #66:

score: 0
Accepted
time: 51ms
memory: 13996kb

input:

10000
+ 217593 571589
+ 415789 108751
- 117214 236462
+ 161922 235410
- 888348 709119
+ 535725 971334
+ 586502 192017
+ 993151 382782
- 232549 22974
- 477398 444633
- 656108 350810
+ 209798 96868
- 173128 279596
+ 475841 68136
+ 918284 770201
+ 234237 888515
- 557087 387417
- 180364 330945
- 842261 ...

output:

2 639446425
1 636112802
1 626114297
1 639446419
1 619449029
1 639445659
1 612784663
1 639446331
1 639446424
1 586124994
1 599455443
1 639446425
1 632779952
1 532808590
1 479502159
1 639446411
1 319668078
1 639446363
1 639446423
1 639446379
1 1
1 637780040
1 639446403
1 639446043
1 639445659
1 629447...

result:

ok ok

Subtask #4:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #67:

score: 20
Accepted
time: 198ms
memory: 20368kb

input:

40000
- 1 999989
+ 1 1
? 1
? 1
? 1
? 1
+ 1 1
? 2
? 1
? 1
- 1 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
- 1 1
? 459503449626971713
? 135016910
? 5731773
? 52316937639933998
? 269214524
? 797561718
? 909578511260041483
? 133507102
- 1 1
- 1 1
? 699316943
? 987427419883089774
? 889563372
? 41792073161585014
? 4160...

output:

1 1
1 1
1 1
1 1
1 1
1 2
1 2
1 1
1 1
1 1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 3
1 1
1 1
1 1
1 1
1 1
1 3
1 1
1 3
1 3
1 1
1 4
1 3
1 5
1 1
1 5
1 1
1 1
1 5
1 5
1 5
1 1
1 1
1 5
1 1
1 6
1 4
1 1
1 5
1 5
1 1
1 1
1 6
1 1
1 4
1 7
1 1
1 ...

result:

ok ok

Test #68:

score: 0
Accepted
time: 311ms
memory: 20356kb

input:

40000
- 1 999999990
? 124566229007091206
? 263598660
? 135377055
? 63646129
? 114729471
? 911467053
+ 892 35
? 463
? 926
? 2
? 1
- 9 682
? 42
? 7
? 3
? 1
? 21
? 6
? 1
- 789 209
+ 522 241
? 1
? 797
? 1
? 1
+ 814 77
? 106
+ 205 334
? 100
? 75
? 1500
? 25
? 5
? 1
? 150
? 300
? 750
? 50
+ 988 284
- 699 ...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
464 1
1 1
891 35
892 35
1 1
8 29
7 34
8 35
1 22
7 31
8 35
522 241
1 1
522 241
522 241
496 239
791 1
457 309
1 1
507 309
522 314
522 318
741 1
232 309
382 1
791 51
205 936
1 1
144 820
197 934
205 936
1 1
205 936
205 936
205 936
1 1
205 936
522 1674
1 1574
1 1
522 1...

result:

ok ok

Test #69:

score: 0
Accepted
time: 112ms
memory: 24464kb

input:

40000
? 677759651
- 780509 987243
- 393725 99290
+ 15205 39
+ 42770 9
+ 1593 60
+ 48542 9
+ 494 60
? 24359
+ 1958 60
+ 1564 60
? 1
? 48838
+ 135720 4
+ 1906 60
? 136080
+ 145011 4
+ 24847 10
+ 1776 60
? 1531
+ 11981 51
+ 2127 60
? 72778
+ 8961 51
+ 33415 10
+ 141363 4
+ 922 60
? 145681
? 1
+ 323 60
...

output:

-1 -1
24201 1
48542 9
1 1
1 1
143484 1
72241 1
1 1
145011 4
1 1
145011 4
1 1
1 1
1 1
1 1
145011 4
145009 1
144976 1
1 1
145011 4
143954 1
144997 1
145011 4
1 1
143072 1
1 1
144946 1
144923 1
145011 4
1 1
125985 44
126480 44
145011 4
135710 18
120210 1
145009 4
145011 4
144968 1
145011 4
144536 1
1 1...

result:

ok ok

Test #70:

score: 0
Accepted
time: 309ms
memory: 22412kb

input:

40000
? 223976876737847075
+ 7714 6
+ 368 59
+ 10717 5
+ 10 60
+ 209 60
+ 6669 6
? 1
? 10912
+ 2189 36
+ 366 59
+ 9709 5
+ 227 60
? 1384
+ 15943 4
? 16302
+ 13853 5
? 16307
+ 268 60
+ 8484 6
? 16373
+ 242 60
? 1
+ 3314 6
+ 135 60
+ 638 56
? 43
+ 15715 4
? 29
+ 11893 5
+ 12117 5
+ 4304 6
? 1
+ 111 60...

output:

-1 -1
10717 5
1 1
9343 1
1 1
1 1
1 1
15943 4
7675 28
15690 5
15943 4
12617 1
19192 4
12560 1
12528 1
19192 4
19192 4
19192 3
13702 22
18198 1
14953 1
1 1
19192 4
14942 1
8556 1
15627 1
1 1
15608 1
19186 1
1 1
18194 1
1 1
19192 4
18841 1
17471 1
1 1
19192 4
7775 1
19183 1
19192 3
7691 1
1 1
5426 132
...

result:

ok ok

Test #71:

score: 0
Accepted
time: 124ms
memory: 24468kb

input:

40000
? 25911325859333899
? 62124818760140691
+ 1909 60
+ 627 60
+ 1025 60
+ 3353 59
+ 59190 10
+ 275 60
+ 6466 56
? 1
+ 27212 37
+ 236 60
? 1
+ 10771 51
+ 19997 39
? 5431
+ 4091 56
+ 2695 59
+ 31277 12
? 59868
+ 2355 60
? 59928
+ 128568 6
? 288
+ 11181 51
+ 2351 60
? 43141
+ 2287 60
? 3
+ 3615 59
+...

output:

-1 -1
-1 -1
59190 10
59190 10
53769 1
1 1
1 1
128286 1
85433 1
128568 4
128568 6
128545 1
124097 1
128564 6
128564 6
1 1
1 1
158835 4
1 1
126615 1
151514 1
1 1
158835 4
158835 4
151490 1
158668 1
158835 4
1 1
149310 1
153437 1
1 1
126358 1
1 1
158810 1
104581 1
1 1
1 1
158835 4
158835 4
1 1
1 1
1588...

result:

ok ok

Test #72:

score: 0
Accepted
time: 243ms
memory: 22408kb

input:

40000
? 943887944802513695
- 957810392 494047143
? 617753090
- 491999643 308221301
- 929069152 387695680
+ 489 60
? 548
? 2
+ 6481 37
+ 668 60
+ 30650 4
+ 8354 35
+ 6505 37
+ 34469 4
? 11
+ 24209 4
+ 5678 39
+ 4425 51
+ 825 60
+ 54818 4
+ 2150 56
+ 3835 51
+ 846 60
+ 4855 40
+ 8146 35
? 3961
? 55454...

output:

-1 -1
-1 -1
1 1
489 59
34462 1
50861 1
1 1
54818 3
54818 3
1 1
54818 4
51804 1
26173 1
54818 4
54818 4
47570 22
50953 1
54818 3
48946 1
54818 4
54818 4
25336 1
54818 3
50589 1
54664 1
54818 4
1 1
1 1
56072 4
56050 1
51998 1
56002 1
56072 4
55991 1
1 1
35547 1
56072 4
1 1
56066 1
24737 1
56045 1
5552...

result:

ok ok

Test #73:

score: 0
Accepted
time: 190ms
memory: 22352kb

input:

40000
- 166825612 977935390
- 514386237 381826777
- 503724529 680126794
+ 1657 59
+ 2239 56
+ 1129 60
+ 899 60
+ 102006 4
+ 67593 7
+ 1113 60
+ 1505 59
+ 1467 60
? 102430
+ 23932 10
+ 104115 4
? 1
+ 58575 7
? 52280
+ 2654 56
+ 28369 10
? 1
+ 7579 51
? 104677
+ 58521 7
+ 3159 56
+ 1879 59
+ 13600 38
...

output:

1 1
104115 4
51857 1
104115 4
1 1
104104 1
104115 4
104113 4
104115 3
104115 4
51563 1
103801 1
1 1
103952 1
104115 3
1 1
104115 4
1 1
104115 4
104115 3
108918 1
109929 4
1 1
81992 43
109892 1
109927 4
109929 4
109929 4
108782 1
109927 4
91154 1
109929 4
1 1
109922 1
109929 4
1 1
109929 4
109893 1
1...

result:

ok ok

Test #74:

score: 0
Accepted
time: 166ms
memory: 24456kb

input:

40000
- 64830132 333068085
- 517582866 791523723
? 673029574741650695
+ 1560 60
+ 14680 37
? 2
+ 2260 59
? 1
? 14835
+ 639 60
+ 128801 4
+ 32778 10
+ 858 60
? 1
+ 6525 51
? 9
+ 276 60
+ 40039 9
+ 43679 9
+ 105933 5
+ 25893 10
? 1
+ 6725 51
+ 4825 56
+ 52749 8
+ 6035 51
? 25880
+ 18936 36
+ 38791 9
+...

output:

-1 -1
14679 37
14680 37
1 1
128801 4
128796 1
128801 4
102930 1
1 1
1 1
1 1
1 1
128801 4
128702 1
110231 1
119520 1
63800 1
1 1
128801 4
110202 1
128438 1
126974 1
1 1
128576 1
128801 4
128678 1
118784 1
1 1
132049 1
64901 1
131443 1
132048 4
131976 1
105097 1
132050 4
132050 4
1 1
132050 4
132050 3...

result:

ok ok

Test #75:

score: 0
Accepted
time: 172ms
memory: 22404kb

input:

40000
? 842615538
+ 87446 5
+ 679 60
? 1
+ 1284 60
+ 61738 6
+ 2992 59
+ 1648 60
+ 62673 6
+ 620 60
+ 2900 59
? 1
+ 30333 6
+ 116898 4
+ 6983 51
+ 5503 56
? 1
? 117389
? 1
? 1
+ 18543 35
+ 1637 60
+ 4013 56
+ 5533 56
+ 87614 5
+ 2616 59
+ 69750 5
? 1
+ 7523 51
+ 7753 51
+ 182 60
+ 11213 49
+ 101054 ...

output:

-1 -1
87446 5
87446 5
116898 4
1 1
116898 4
116898 4
116898 4
116896 4
116841 1
93202 1
116891 1
116799 1
143786 1
1 1
144258 4
1 1
1 1
142249 1
143591 1
144223 1
144258 4
144258 4
127904 1
144216 1
144239 1
144258 4
127844 1
1 1
143957 1
114705 1
141243 1
1 1
1 1
1 1
144066 1
1 1
144258 4
114533 1
...

result:

ok ok

Test #76:

score: 0
Accepted
time: 294ms
memory: 20292kb

input:

40000
- 1 999999997
? 574341954
? 530744726891117072
? 153312352
? 16275489105590872
? 245535434586172579
? 665990227001338666
+ 809 716
- 434 724
? 164
? 1148
? 82
? 7
? 2
? 574
+ 874 976
? 1
? 171
? 855
? 3
? 2565
? 19
? 135
? 57
? 285
+ 768 42
+ 799 212
- 482 476
? 2819
+ 818 136
? 1
? 2955
? 15
...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
329 657
1 1
411 657
428 715
433 715
1 575
874 976
824 856
1 1270
872 976
1 1
862 970
770 946
824 970
710 856
1 1
433 2082
1 1
421 2080
395 1924
1 1530
1 1
433 2080
431 2080
582 536
421 2080
1 1435
311 2075
313 2077
313 2082
1 1
313 2079
1 1075
113 2398
114 2398
1 ...

result:

ok ok

Test #77:

score: 0
Accepted
time: 277ms
memory: 22396kb

input:

40000
+ 532 30
+ 13604 4
+ 47 30
? 13667
? 79
+ 15980 4
+ 10528 5
+ 510 30
+ 238 30
+ 1920 19
+ 10242 5
+ 17168 4
+ 1746 25
+ 228 30
+ 644 30
+ 16115 4
+ 955 29
+ 9436 5
+ 57 30
? 17481
+ 2424 19
+ 7637 6
+ 21393 3
+ 4137 6
+ 367 30
+ 4537 6
+ 17473 3
+ 391 30
+ 507 30
? 21839
+ 379 30
+ 1698 25
+ 9...

output:

1 1
13529 1
1 1
1 1
21338 1
21369 1
21417 1
22204 3
22201 1
20553 1
22204 3
22197 1
22201 1
22205 3
1 1
22077 1
22029 1
22200 1
1 1
21145 1
22205 3
22205 3
22204 3
22205 3
22199 1
1 1
22131 1
10298 1
22233 3
21091 1
1 1
22233 3
22226 1
22231 1
22233 3
10034 129
22233 3
21923 1
1 1
13961 1
22233 3
97...

result:

ok ok

Test #78:

score: 0
Accepted
time: 234ms
memory: 22420kb

input:

40000
- 711598956 38143622
- 557163230 93952091
- 93796384 273343789
- 856941038 802329559
- 78117130 925359729
+ 6659 19
+ 1938 29
+ 1266 29
+ 17973 5
+ 326 30
? 2
? 548
+ 32190 3
+ 376 30
+ 2486 26
+ 34682 3
+ 7007 19
? 2491
+ 7854 6
? 40
+ 1408 29
+ 18 30
+ 5618 20
+ 18545 5
? 34964
+ 4771 20
+ 4...

output:

17972 5
17430 1
32194 1
34645 1
1 1
34679 1
1 1
34654 1
34682 3
1 1
1 1
34638 1
34682 3
22838 1
1 1
16872 1
1 1
1 1
34682 3
33310 1
34655 1
1 1
34590 1
1 1
1 1
36702 1
31447 1
17660 1
30499 1
1 1
36705 1
36891 1
36922 1
36949 3
36950 3
38069 3
34058 1
18049 1
38070 3
38069 3
38070 3
38070 3
1 1
2467...

result:

ok ok

Test #79:

score: 0
Accepted
time: 199ms
memory: 22348kb

input:

40000
- 769183911 221531292
- 886908982 733043839
? 520237017859620771
- 231423159 644462823
? 60781984998275393
? 237696858325482314
+ 140 30
+ 29946 5
+ 1562 30
+ 45802 4
+ 505 30
+ 1087 30
+ 43318 4
+ 5376 26
+ 1335 30
? 73
+ 1684 30
+ 1894 30
+ 1985 30
+ 7336 20
+ 3666 26
? 1
+ 31350 5
? 1
+ 208...

output:

-1 -1
-1 -1
-1 -1
45733 1
45802 4
45802 4
53052 3
1 1
42385 1
53048 1
45422 1
1 1
48895 1
1 1
1 1
1 1
42354 1
56749 1
1 1
1 1
54984 1
56860 3
56860 3
1 1
37258 1
56860 3
1 1
56860 3
1 1
61198 1
61200 3
1 1
61169 1
60575 1
61192 1
54800 1
57624 1
61108 1
29041 1
61161 1
39713 1
61184 1
61200 3
61200 ...

result:

ok ok

Test #80:

score: 0
Accepted
time: 158ms
memory: 24436kb

input:

40000
? 426644597273939473
- 810294628 312927982
- 50945315 165557661
+ 2636 30
? 1
? 2665
+ 41058 5
+ 77358 3
? 673
+ 54 30
+ 65794 3
+ 7613 25
+ 821 30
+ 162 30
+ 7751 25
+ 2611 30
? 4848
+ 4691 28
+ 6821 25
+ 2834 28
? 429
+ 23751 6
+ 14225 19
+ 8837 25
+ 2017 30
+ 10721 19
+ 47506 5
+ 17951 6
+ ...

output:

-1 -1
2636 30
1 1
76688 1
72513 1
76932 1
1 1
77358 1
81138 3
81136 1
1 1
81136 1
81110 1
81138 3
1 1
80216 1
64664 1
1 1
81138 3
81138 3
82230 3
81441 1
82229 3
82230 1
82032 1
82230 3
82230 3
82229 3
82230 3
80180 1
82170 1
82122 1
1 1
82230 3
1 1
82230 1
82224 1
53963 1
1 1
81374 1
72792 1
82230 ...

result:

ok ok

Test #81:

score: 0
Accepted
time: 141ms
memory: 24448kb

input:

40000
? 29832296297047517
? 580844055029996911
- 312635783 757770202
? 630749211926238861
+ 1083 30
? 2
? 4
+ 493 30
+ 12959 21
+ 733 30
+ 941 30
+ 85642 3
+ 3541 29
+ 3759 29
+ 2025 30
+ 380 30
+ 1563 30
+ 47141 7
+ 735 30
+ 3393 29
+ 41150 8
+ 5514 26
? 227
+ 654 30
+ 16577 10
+ 5849 26
+ 12619 21...

output:

-1 -1
-1 -1
-1 -1
1083 29
1081 29
85418 1
83772 1
1 1
85572 1
85641 3
85642 3
85619 1
85642 3
85642 3
1 1
1 1
42937 1
87154 3
87153 3
87153 3
72359 1
1 1
87154 3
1 1
64863 1
87153 3
78218 1
86808 1
81554 1
86075 1
86985 1
1 1
86300 1
1 1
82875 1
87154 3
87154 3
86874 1
77152 1
57160 1
57144 1
87154 ...

result:

ok ok

Test #82:

score: 0
Accepted
time: 190ms
memory: 22476kb

input:

40000
+ 19948 4
+ 19210 4
+ 674 12
? 19967
+ 18184 4
? 1
+ 2467 11
+ 8913 5
+ 731 12
+ 970 12
+ 16150 4
? 1
+ 16717 4
+ 1155 12
? 20031
+ 2257 11
+ 430 12
+ 522 12
+ 473 12
+ 2025 12
? 10
? 1
? 490
+ 17914 4
+ 1241 12
+ 3945 9
+ 18373 4
+ 5041 9
+ 3617 9
? 20137
? 13
+ 18526 4
+ 12297 5
+ 19516 4
+ ...

output:

1 1
19948 4
19948 4
1 1
19942 1
19948 4
19462 1
1 1
19939 1
19884 1
22034 4
10908 1
1 1
22036 4
16438 64
1 1
10803 113
22036 4
1 1
1 1
22036 4
1 1
15000 72
16411 76
22036 4
16402 76
16410 80
21666 1
16410 84
21283 1
16293 88
22036 4
21825 1
21301 1
22036 3
22036 4
21999 1
22036 4
22036 4
22034 4
220...

result:

ok ok

Test #83:

score: 0
Accepted
time: 158ms
memory: 22396kb

input:

40000
? 14951798
- 962746718 849768434
+ 3295 11
+ 1946 12
+ 1940 12
+ 2044 12
+ 21410 3
+ 12180 3
? 219
+ 11600 3
+ 20160 3
+ 13880 3
? 21471
+ 9890 3
+ 13670 3
+ 371 12
+ 982 12
+ 2949 11
+ 3427 11
? 1
+ 1976 12
+ 7370 3
+ 2354 12
+ 572 12
? 21562
+ 19300 3
+ 7800 3
+ 296 12
+ 9500 3
+ 953 12
? 1
...

output:

-1 -1
21194 1
1 1
21410 3
1 1
21410 3
20796 1
32006 1
33530 1
1 1
33540 3
1 1
33540 3
32837 1
33540 3
33604 1
16576 1
33619 1
1 1
1 1
1 1
16550 57
33475 1
33606 1
26773 1
1 1
31336 1
33608 1
1 1
1 1
1 1
1 1
33620 3
1 1
1 1
33620 3
1 1
16410 1
33308 1
33620 3
33100 1
33619 3
26702 1
1 1
33620 1
33620...

result:

ok ok

Test #84:

score: 0
Accepted
time: 166ms
memory: 22468kb

input:

40000
? 269781938
- 372800326 617806012
- 464282353 149727588
- 252205549 630950586
- 19010576 523270966
? 62080133
+ 1974 12
+ 28064 4
+ 11233 5
? 28084
+ 19577 4
? 7022
+ 2967 12
+ 26102 4
+ 4773 9
+ 1727 12
+ 2349 12
+ 20621 4
+ 2099 12
? 599
+ 30215 4
+ 23879 4
+ 10953 5
+ 505 12
+ 1951 12
? 1
+...

output:

-1 -1
-1 -1
1 1
21046 1
27469 1
30215 4
1 1
30521 4
30521 3
1 1
31025 1
31034 4
31032 4
31034 4
31034 3
31034 4
15370 1
1 1
31034 3
31031 1
1 1
26543 1
31034 3
31034 4
1 1
27102 1
31034 4
31024 1
31030 1
31034 1
1 1
31009 1
1 1
30852 1
31034 1
31026 1
30733 1
1 1
31034 4
31027 1
23059 1
30888 1
3007...

result:

ok ok

Test #85:

score: 0
Accepted
time: 139ms
memory: 24452kb

input:

40000
- 360681199 399864979
+ 3425 12
+ 22547 3
? 11
+ 1054 12
+ 3148 12
? 1
? 22585
+ 21577 3
+ 1079 12
+ 122 12
? 1
+ 18867 3
+ 3454 12
+ 1149 12
+ 3282 12
+ 3346 12
? 22663
+ 815 12
+ 40107 3
? 11
+ 2184 12
? 805
+ 7737 8
+ 3049 12
+ 38307 3
? 40273
? 23
+ 35147 3
+ 4004 11
+ 1646 12
+ 7122 8
+ 3...

output:

22539 1
22547 3
1 1
22547 3
1 1
40099 1
39305 1
1 1
40087 1
1 1
19951 1
40107 3
26635 1
40107 3
40097 1
1 1
40107 3
29999 1
38273 1
1 1
42067 3
1 1
28482 1
42927 3
42927 1
1 1
42927 3
42613 1
42927 3
40860 1
28436 1
42917 1
39585 1
42927 1
1 1
1 1
42927 3
42926 3
42927 3
21154 1
42796 1
42927 3
4292...

result:

ok ok

Test #86:

score: 0
Accepted
time: 126ms
memory: 24468kb

input:

40000
+ 4713 11
+ 843 12
+ 2943 12
+ 23817 3
+ 29047 3
+ 5215 11
? 1
+ 1009 12
+ 9087 8
? 6
? 1
? 29118
+ 10247 3
+ 2938 12
? 39
? 117
+ 14547 3
+ 1073 12
? 28
+ 551 12
+ 9962 8
+ 4081 11
+ 15097 3
+ 1142 12
? 22
+ 1675 12
+ 44727 3
+ 16997 3
? 12
+ 29467 3
+ 41457 3
+ 490 12
+ 35897 3
+ 8802 8
? 44...

output:

29047 3
29044 1
29047 3
1 1
29011 1
28933 1
29022 1
29028 1
44718 1
1 1
37241 1
44727 3
1 1
47247 3
46528 1
1 1
47247 3
1 1
23429 1
47247 3
47245 1
1 1
23404 1
1 1
41287 18
1 1
47346 3
40527 1
47162 1
1 1
46913 1
47331 1
42035 1
23431 1
23406 1
47347 3
1 1
1 1
1 1
47347 3
1 1
47340 1
47347 1
47337 1...

result:

ok ok

Test #87:

score: 0
Accepted
time: 128ms
memory: 26320kb

input:

40000
? 348058959
- 246637267 226432244
? 850572176612915348
- 616995164 664650525
+ 4528 11
+ 16415 3
+ 4554 11
+ 47075 3
+ 2540 12
+ 3184 12
? 2
+ 20605 3
+ 48575 3
+ 36435 3
+ 998 12
+ 28715 3
+ 3644 12
? 839
+ 1309 12
+ 3360 12
+ 1475 12
? 48698
? 13
+ 2479 12
+ 52925 3
+ 1952 12
? 25
+ 32235 3
...

output:

-1 -1
-1 -1
47074 3
47739 1
1 1
48565 1
52903 1
1 1
1 1
1 1
52925 3
52924 3
1 1
52925 3
42297 1
52925 3
1 1
48084 1
52925 3
52892 1
52916 1
52925 3
52918 1
1 1
52925 3
1 1
52925 3
52924 1
52925 3
1 1
52925 1
1 1
39576 1
42250 1
52920 1
52925 3
1 1
50950 1
1 1
1 1
1 1
35080 1
52871 1
52703 1
52925 1
...

result:

ok ok

Test #88:

score: 0
Accepted
time: 201ms
memory: 38788kb

input:

40000
+ 607847 547419
- 181315 29679
+ 56776 161287
- 873319 243941
+ 107165 750759
+ 194996 651995
+ 521948 604666
- 503605 78776
- 822937 127128
+ 415610 64685
+ 653418 115678
- 907523 50771
+ 176480 621723
+ 889717 680016
- 297093 329679
+ 172725 334071
- 598027 91002
+ 462551 544596
+ 416767 475...

output:

1 1
1 1692783153
1 2539292240
1 1692783153
1 1
1 2539292238
1 1692783153
1 2539292240
1 2539292240
1 1692783153
1 2539292240
1 1692783153
1 1
1 1
1 2539292238
1 2539292238
1 1692783153
1 2539292238
1 2539292240
1 1
1 2539292238
1 1692783153
1 1
1 2539292238
1 1
1 1
1 1
1 2539292238
1 2539292240
1 25...

result:

ok ok

Subtask #5:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #89:

score: 10
Accepted
time: 636ms
memory: 49652kb

input:

120000
- 1 999998
- 1 1
? 524676648
- 1 1
? 471359062610816649
? 106119244925555144
? 743663297
? 423592229
? 186067296173162429
? 632755129
? 246989272133701876
? 17515319
? 709195536
? 233113315381037082
? 142287560
? 397324959
? 405060842572191831
? 570787044218436408
? 808564090
? 67325167266819...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 1
1 2
1 1
1 1
1 1
1 2
1 1
1 1
1 2
1 1
1 1
1 1
1 2
1 1
1 2
1 1
1 2
1 1
1 1
1 1
1 1
1 2
1 2
1 1
1 1
...

result:

ok ok

Test #90:

score: 0
Accepted
time: 1049ms
memory: 53248kb

input:

120000
- 1 999999991
? 234755869
? 250134300
? 474946255
? 915424038
+ 72 210
R 1
? 65537672
? 914328953107461357
+ 144 934
? 1
? 359
? 3
? 1077
+ 658 89
R 1
? 3
? 1077
? 1
+ 61 317
? 17
? 2
- 676 346
? 34
? 697
? 1
? 1394
+ 841 83
R 1
- 472 429
? 82
? 1394
? 1
? 697
? 34
? 1394
? 2
? 41
+ 184 196
+...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
144 934
1 719
142 934
1 1
142 934
1 1
144 934
52 1244
61 1250
35 1244
1 698
61 1251
1 1
94 903
1 1
61 1251
1 698
35 1244
1 1
61 1250
42 1230
1 1
144 2029
310 879
139 2028
1 1
1 1055
107 2143
1 1
61 3164
1 1
61 3162
61 3164
626 1
291 1717
1 1
293 1716
293 1717
717 ...

result:

ok ok

Test #91:

score: 0
Accepted
time: 440ms
memory: 63532kb

input:

120000
- 891888 762912
+ 328047 7
+ 93966 14
? 1
? 328067
+ 12336 56
+ 3116 60
+ 346369 6
+ 5458 60
+ 28126 51
+ 4237 60
+ 48454 39
+ 347029 6
+ 17341 56
+ 12 60
+ 4567 60
? 347563
+ 1019 60
+ 172120 11
? 1
? 57939
+ 326319 7
+ 3554 60
+ 8650 59
+ 8664 59
+ 3221 60
+ 115696 13
+ 423753 4
+ 1732 60
+...

output:

328047 7
1 1
1 1
347029 6
289109 1
282206 1
211396 1
1 1
423746 1
423751 1
1 1
423753 4
423753 4
423753 4
1 1
1 1
1 1
423751 1
1 1
423570 1
421476 1
210424 1
417480 1
338410 1
423753 4
422899 1
421599 1
1 1
423753 4
423753 4
423753 3
1 1
1 1
423753 4
1 1
423753 4
1 1
429795 4
1 1
1 1
367735 1
429795...

result:

ok ok

Test #92:

score: 0
Accepted
time: 929ms
memory: 53212kb

input:

120000
? 444322946139031067
- 793295440 833168991
- 229763750 989309815
? 24197291
- 511348568 910708986
+ 30271 6
? 1044
? 29
+ 4247 51
+ 13349 8
? 30335
? 5
? 1
? 6067
+ 1329 59
? 13
+ 587 60
? 30454
+ 361 60
? 1
+ 12713 8
? 6
+ 634 60
? 10194
+ 1547 56
+ 652 60
? 2
? 30698
+ 923 59
+ 42325 5
+ 17...

output:

-1 -1
-1 -1
29233 1
30248 1
1 1
30267 6
30271 6
24210 1
30264 1
1 1
30271 6
30271 1
20083 1
30271 5
1 1
1 1
42118 1
42268 1
42324 1
1 1
58276 4
1 1
58276 4
58276 3
1 1
38289 1
1 1
1 1
38192 1
46215 1
26245 52
54913 1
58276 3
1 1
1 1
37772 1
58276 3
45854 1
58275 1
58276 4
58276 3
47868 1
27077 1
374...

result:

ok ok

Test #93:

score: 0
Accepted
time: 424ms
memory: 67688kb

input:

120000
+ 246701 6
+ 348758 5
? 19376
? 2076
+ 16199 56
+ 5932 60
+ 5594 60
+ 9946 59
+ 94370 34
+ 522404 4
+ 8812 59
+ 26964 51
? 11
? 47527
? 1
+ 197751 6
+ 2212 60
+ 57424 36
+ 6246 60
? 522959
+ 269014 5
? 261482
? 1
+ 10652 59
+ 35301 50
+ 5584 60
? 1
+ 9444 59
+ 548624 4
+ 5299 60
+ 366062 5
+ ...

output:

329387 1
346687 1
522397 1
474881 1
522404 4
1 1
260936 1
522404 4
522404 4
493683 1
558768 1
496578 1
558770 4
558770 4
1 1
1 1
1 1
558770 4
529299 1
558770 4
557891 1
1 1
558770 4
558770 4
1 1
558680 1
446545 1
1 1
507751 1
371665 1
558770 4
558469 1
558770 4
558770 4
1 1
1 1
1 1
418297 1
1 1
5587...

result:

ok ok

Test #94:

score: 0
Accepted
time: 776ms
memory: 55584kb

input:

120000
? 446275518788921656
- 299417081 149149598
+ 1711 60
? 1
+ 1507 60
+ 7834 51
+ 110591 5
+ 2654 59
+ 1578 60
+ 123359 5
? 34
+ 146137 4
+ 200 60
+ 1297 60
? 146560
+ 4484 56
+ 10464 51
+ 2816 59
+ 1943 60
+ 55617 7
+ 1893 60
+ 136162 4
+ 1741 60
+ 52053 7
? 92
? 146924
+ 136 60
? 36746
+ 62529...

output:

-1 -1
1711 60
123330 1
1 1
146049 1
1 1
109409 1
72662 1
146137 4
144791 1
146137 4
146112 1
138775 1
146137 1
146137 3
72356 1
146137 4
1 1
141900 1
1 1
146134 1
146137 4
146132 1
145835 1
146135 4
71710 1
146137 4
1 1
146137 4
146130 1
1 1
145844 1
129554 1
146137 4
146135 4
141324 1
1 1
146137 4
...

result:

ok ok

Test #95:

score: 0
Accepted
time: 603ms
memory: 59892kb

input:

120000
- 329762 587831686
- 803854511 71863487
- 257829748 718761210
? 270994151822425030
+ 3038 60
? 1
+ 1404 60
+ 114843 4
+ 659 60
+ 312006 4
+ 34098 38
+ 5221 59
+ 2512 60
+ 19720 51
+ 60066 4
+ 4279 60
+ 264525 4
+ 5555 59
+ 83322 4
+ 5189 59
+ 20740 51
? 2
+ 5613 59
+ 4824 60
+ 11585 56
? 17
?...

output:

-1 -1
3038 60
312006 3
311993 1
312006 4
311998 1
311995 1
311967 1
312006 4
312006 4
312006 4
311526 1
1 1
311931 1
312006 4
207213 1
311705 1
312006 4
312006 4
1 1
312006 3
312006 4
312006 4
1 1
311387 1
312006 3
311949 1
1 1
1 1
312006 3
1 1
1 1
312006 4
153214 1
312006 4
1 1
1 1
312006 4
312006 ...

result:

ok ok

Test #96:

score: 0
Accepted
time: 559ms
memory: 59912kb

input:

120000
- 653083553 480301785
- 841223476 908076335
- 482520051 905872054
- 866860766 369267358
+ 495 60
? 1
+ 62833 34
+ 249598 4
+ 119410 4
+ 7920 58
? 23
? 1
? 249757
+ 366619 4
+ 4541 60
? 14
+ 288301 4
+ 5697 60
+ 2862 60
+ 225715 4
+ 60862 34
+ 49221 35
? 6221
+ 154066 4
? 1
? 367043
+ 231871 4...

output:

495 60
249579 1
249598 4
1 1
366609 1
360402 1
366619 4
1 1
366619 4
366619 4
1 1
366619 4
1 1
366619 4
1 1
182437 1
366619 4
366618 1
366606 1
1 1
366619 4
305093 1
366619 1
366619 4
366603 1
1 1
366618 1
366619 4
366619 1
181847 1
366604 1
181749 1
366617 4
1 1
1 1
273998 1
181296 1
1 1
1 1
366619...

result:

ok ok

Test #97:

score: 0
Accepted
time: 515ms
memory: 63616kb

input:

120000
? 128670128510006810
- 112120371 402488881
? 467205337
- 900645079 493628836
- 620356105 304356389
- 741927666 769999308
- 239994867 628314042
- 7683408 735746190
- 353587378 505282600
? 266157939
- 556126795 585332677
? 550850090
+ 5523 60
? 5582
+ 6872 59
+ 231262 8
+ 356437 5
+ 134001 11
+...

output:

-1 -1
-1 -1
-1 -1
-1 -1
1 1
391663 4
391651 1
391658 1
391665 4
356035 1
363656 1
348077 1
391665 4
335598 1
391665 4
391665 4
379003 1
1 1
391657 1
1 1
391665 4
391665 3
373804 1
391665 4
260559 1
391663 4
1 1
391665 4
1 1
391665 3
391665 4
1 1
1 1
402039 4
402039 4
402039 4
1 1
402032 1
402039 4
3...

result:

ok ok

Test #98:

score: 0
Accepted
time: 995ms
memory: 53328kb

input:

120000
- 1 999999991
? 221222707232533683
? 967354364
? 790389858938560694
? 381202725
? 861646599
? 34524131
+ 216 294
? 509
+ 656 635
? 3
? 6
? 88
- 533 655
? 146
? 1460
+ 829 402
? 1
? 2159
? 17
? 127
? 1
? 1
- 943 943
? 127
? 1
? 17
? 2159
- 358 357
? 2159
? 1
? 17
? 127
? 2159
+ 898 935
? 1
- 5...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
655 634
655 631
587 617
437 585
1 1
532 1037
1 1
523 1030
469 974
532 1037
532 1037
469 974
532 1037
523 1030
1 1
1 1
532 680
523 673
493 593
1 1
216 2266
216 2266
1 1
1 1
100 2890
1 1
1 2445
1 1628
77 3416
78 3416
1 1
77 3414
48 3791
1 1
1 3788
78 3807
1 1
1 ...

result:

ok ok

Test #99:

score: 0
Accepted
time: 878ms
memory: 53756kb

input:

120000
- 226176001 163612570
- 411784030 110259103
? 861194173
? 400697581
+ 158 30
+ 10605 19
? 10653
+ 211 30
+ 970 30
? 3
? 10713
+ 2331 29
+ 1737 30
? 1
+ 1601 30
+ 22100 6
+ 2401 29
? 11166
+ 1977 30
? 6
+ 18125 6
+ 40591 4
+ 1274 30
+ 1850 30
+ 53312 3
? 11
+ 4377 25
+ 1763 30
+ 381 30
? 53732...

output:

-1 -1
-1 -1
1 1
10603 19
1 1
10605 19
10940 1
22100 1
53304 1
1 1
50487 1
53312 3
53312 3
57315 3
57312 1
57316 3
1 1
1 1
57316 3
57174 1
57314 1
57316 3
57251 1
42776 1
57316 3
1 1
1 1
55902 1
57309 1
57316 3
57316 3
57315 3
1 1
57315 3
37811 1
57316 3
1 1
56959 1
56357 1
57126 1
1 1
1 1
57960 3
1 ...

result:

ok ok

Test #100:

score: 0
Accepted
time: 747ms
memory: 57844kb

input:

120000
? 778358171093808790
? 707509876098704663
- 316877631 318204199
+ 1550 30
+ 2182 30
+ 65490 5
? 1
+ 85471 4
? 28513
+ 77344 4
+ 33389 6
+ 59900 5
+ 2459 30
+ 10247 25
+ 81043 4
+ 16667 19
+ 14195 19
+ 54414 5
+ 1934 30
+ 5042 28
? 1
+ 5759 28
? 2
+ 119323 3
+ 1505 30
+ 1209 30
+ 4184 28
+ 597...

output:

-1 -1
-1 -1
65490 5
56967 1
85471 4
85471 3
1 1
119279 1
116777 1
1 1
119323 1
119322 1
1 1
121617 1
118344 1
121613 1
121647 3
121595 1
60406 1
121646 3
121187 1
1 1
121647 3
90960 1
121646 3
1 1
121647 3
121647 3
1 1
115792 1
121647 3
90813 1
121646 3
96978 1
1 1
121647 3
121321 1
121572 1
59846 1...

result:

ok ok

Test #101:

score: 0
Accepted
time: 613ms
memory: 59820kb

input:

120000
+ 2981 30
+ 427 30
? 1
? 80
+ 163656 3
+ 1897 30
+ 1671 30
+ 147867 4
+ 163 30
+ 79685 5
+ 190928 3
? 44
? 4
+ 167268 3
+ 1921 30
+ 15095 26
+ 63992 6
+ 62792 6
? 191163
+ 155984 3
? 453
+ 108051 5
+ 84651 5
? 2
+ 54567 6
+ 2571 30
+ 89539 5
+ 1611 30
? 1
+ 75707 5
+ 111066 4
+ 45067 6
+ 2238...

output:

2981 30
2931 1
190887 1
190927 1
1 1
190478 1
190927 3
190928 3
190917 1
1 1
190928 1
1 1
190924 1
1 1
1 1
190928 3
127009 1
190928 3
190320 1
1 1
190918 1
190516 1
1 1
190884 1
126861 1
190928 3
190928 3
190928 3
1 1
189927 1
180223 1
190927 3
190928 3
1 1
190928 3
1 1
190927 1
190928 3
1 1
94303 1...

result:

ok ok

Test #102:

score: 0
Accepted
time: 507ms
memory: 61904kb

input:

120000
- 118958516 503123842
+ 7774 29
+ 143895 4
? 7
? 1
+ 850 30
+ 81555 6
? 143963
+ 9720 29
+ 167304 4
? 4783
+ 2402 30
+ 59130 6
+ 213106 3
? 213246
+ 28148 21
+ 194794 3
+ 959 30
? 79
+ 45235 19
+ 90355 6
? 805
? 30475
+ 231418 3
? 46328
+ 76230 6
+ 76680 6
+ 8688 29
? 1
? 2663
+ 20128 26
? 29...

output:

143892 1
143895 4
1 1
162525 1
1 1
213030 1
212304 1
182637 1
185099 1
231418 3
228758 1
228488 1
231418 3
231418 1
237717 3
198000 1
228896 1
237716 1
233994 6
223692 1
234846 1
237716 1
190014 1
1 1
237718 3
237540 1
236402 1
237540 1
237717 3
118304 1
237717 3
237718 1
1 1
237718 3
237717 3
1 1
2...

result:

ok ok

Test #103:

score: 0
Accepted
time: 449ms
memory: 63500kb

input:

120000
? 441444219756204750
+ 11813 29
? 11841
? 3
+ 137929 7
+ 10377 29
+ 70583 9
+ 1642 30
+ 98777 8
+ 10543 29
+ 93855 8
? 138077
? 1
+ 116027 8
+ 105562 8
? 723
? 573
+ 217577 4
? 185
+ 5459 30
+ 96270 8
+ 16688 26
+ 9333 29
? 2
? 217838
+ 11909 29
+ 26963 21
+ 5436 30
+ 2735 30
+ 11711 29
+ 264...

output:

-1 -1
1 1
11812 28
1 1
137929 7
137213 1
137363 1
217396 1
217577 3
1 1
217575 4
1 1
206099 1
217577 4
217550 1
1 1
217577 4
217478 1
261795 3
261782 1
1 1
1 1
267408 1
1 1
1 1
267422 3
1 1
200285 1
267423 3
1 1
267423 3
1 1
264817 1
267423 3
133076 1
267422 3
267423 3
267388 1
267422 3
263887 1
1 1...

result:

ok ok

Test #104:

score: 0
Accepted
time: 679ms
memory: 58988kb

input:

120000
? 123850262343170892
+ 2349 12
+ 34387 5
? 34403
+ 11099 9
+ 3473 12
+ 25187 5
+ 3475 12
? 31
? 34441
? 1
+ 10991 9
+ 55326 4
+ 54219 4
+ 55065 4
+ 8123 11
+ 47253 4
+ 8573 11
? 1289
+ 2444 12
+ 2317 12
? 1
+ 10587 9
+ 11895 9
+ 2744 12
+ 43662 4
? 55485
+ 10635 9
+ 1778 12
? 55506
? 3
+ 4846...

output:

-1 -1
1 1
34361 1
1 1
34387 5
54049 1
55326 4
1 1
1 1
55324 4
54573 1
1 1
60069 4
60066 1
59942 1
60069 4
61614 1
61986 4
61986 4
61986 4
1 1
33751 1
67935 4
45136 1
67846 1
66850 1
56508 1
54222 1
67935 4
45072 1
49643 34
1 1
69464 1
71022 1
69314 1
70753 1
1 1
1 1
71022 4
71016 1
68024 1
71022 4
7...

result:

ok ok

Test #105:

score: 0
Accepted
time: 625ms
memory: 58948kb

input:

120000
- 293847409 139973373
- 358516199 676524406
? 742905586
? 221613672
- 810351729 280476468
? 707376202189158459
? 181621888
- 5702944 929745554
- 392536197 224535013
+ 85938 3
+ 70998 3
+ 18923 8
+ 63178 3
+ 1142 12
+ 7633 11
+ 16903 8
? 145
+ 49848 3
+ 27688 3
+ 4402 12
+ 32608 3
? 43003
? 86...

output:

-1 -1
-1 -1
-1 -1
-1 -1
85796 1
42947 1
1 1
75188 1
85930 1
1 1
68738 1
1 1
85928 1
85888 1
85936 1
86728 3
1 1
86706 1
1 1
93448 3
1 1
1 1
93284 1
92889 1
94608 1
94570 1
62969 1
94608 3
94504 1
94608 3
94604 1
94562 1
1 1
94608 3
1 1
1 1
94451 1
94581 1
94598 1
93627 1
94596 1
93487 1
94607 3
1 1
...

result:

ok ok

Test #106:

score: 0
Accepted
time: 553ms
memory: 59140kb

input:

120000
+ 4935 12
? 1
+ 4498 12
+ 3718 12
+ 50848 3
+ 12621 11
+ 1029 12
+ 9403 11
? 1
+ 3244 12
? 428
+ 6020 12
+ 41298 3
? 13
+ 56168 3
+ 90488 3
+ 60808 3
? 11
+ 48398 3
+ 60498 3
+ 79878 3
+ 7976 12
+ 7963 12
? 7
+ 15223 8
+ 58258 3
+ 50 12
+ 38128 3
+ 77918 3
+ 3616 12
+ 6022 12
+ 45148 3
? 9068...

output:

4935 12
50848 3
50423 1
50838 1
90480 1
90484 1
1 1
1 1
90488 3
1 1
90488 3
1 1
84009 1
45107 1
1 1
90484 1
90481 1
90487 3
90488 1
96710 1
48425 1
97378 3
97372 1
1 1
1 1
97378 1
81035 1
97378 3
48333 1
97378 3
93111 1
1 1
97368 1
96575 1
97376 1
97378 3
95430 1
98258 1
98258 3
98258 3
96153 1
1 1
...

result:

ok ok

Test #107:

score: 0
Accepted
time: 503ms
memory: 61112kb

input:

120000
? 311811663686762573
+ 38023 5
+ 25583 9
+ 21139 9
+ 7377 12
+ 82514 4
? 82552
+ 18083 9
+ 9054 12
+ 21395 9
? 1
+ 28463 5
+ 16943 9
? 1
+ 73559 4
+ 9509 12
+ 4775 12
+ 4589 12
+ 4828 12
? 82648
+ 15903 9
+ 2956 12
+ 41279 5
? 18
+ 231 12
? 3
+ 49631 5
? 11813
+ 59263 5
+ 64423 5
+ 6468 12
+ ...

output:

-1 -1
1 1
82514 4
82514 4
1 1
82500 1
82512 4
70709 1
54957 1
1 1
1 1
107714 4
105085 1
1 1
107714 4
107677 1
106581 1
107714 1
71707 1
107714 3
1 1
57264 1
114842 3
114842 4
114842 4
114842 4
1 1
114837 1
114833 1
114842 4
114842 4
114842 4
1 1
1 1
76345 1
1 1
1 1
114842 4
114842 4
1 1
114842 4
114...

result:

ok ok

Test #108:

score: 0
Accepted
time: 450ms
memory: 61952kb

input:

120000
- 470080190 176685367
- 291110707 156468192
- 476111726 12211627
? 221804870
+ 22668 8
+ 138228 3
+ 14091 11
+ 31158 8
? 138257
+ 30128 8
+ 1249 12
? 1
+ 81828 3
? 138280
+ 248 12
+ 10440 12
+ 54388 3
+ 2881 12
+ 44158 3
+ 492 12
+ 10080 12
+ 1832 12
+ 75618 3
+ 20488 8
+ 97248 3
? 69186
+ 60...

output:

-1 -1
1 1
138228 3
1 1
69054 1
137174 1
138194 1
130942 1
1 1
134488 1
68993 1
1 1
110517 1
138228 3
138228 3
130933 1
138228 3
1 1
1 1
138228 3
135217 1
1 1
1 1
138228 3
137793 1
1 1
129200 1
1 1
1 1
127768 1
138467 3
138468 3
103688 36
138427 1
138053 1
138468 3
1 1
138393 1
138445 1
122999 1
1 1
...

result:

ok ok

Test #109:

score: 0
Accepted
time: 473ms
memory: 61580kb

input:

120000
+ 29271 9
+ 13019 11
+ 83532 4
+ 6245 12
+ 41267 5
+ 118983 4
? 119027
+ 3983 12
? 119039
? 1
? 1
? 1
+ 3221 12
+ 96897 4
+ 19955 9
+ 8558 12
+ 7498 12
+ 5682 12
? 3
+ 5683 12
+ 46859 5
+ 7527 12
? 119129
+ 58611 5
+ 81587 5
+ 38435 5
+ 17807 11
+ 20387 9
+ 128136 4
+ 63931 5
+ 125283 4
+ 476...

output:

1 1
1 1
118983 4
118983 4
118983 4
118981 4
1 1
1 1
127727 1
128136 4
128136 4
1 1
64772 1
1 1
64747 1
127239 1
129837 4
129832 1
129835 4
129814 1
129837 4
127708 1
1 1
129837 4
129837 4
86420 1
128058 1
129837 4
1 1
128844 1
1 1
129837 4
129837 4
129837 4
129837 4
111194 1
1 1
129835 4
1 1
67931 1...

result:

ok ok

Test #110:

score: 0
Accepted
time: 610ms
memory: 99868kb

input:

120000
+ 576347 602196
+ 363328 345520
+ 910885 720435
+ 156522 984917
+ 939928 937749
- 482684 481924
+ 851445 813804
+ 420938 976643
- 266718 196781
+ 681841 840672
+ 556035 512106
+ 893039 110112
- 395881 723375
+ 476350 303313
+ 853145 619235
+ 382286 258670
+ 988828 216969
+ 917164 566727
+ 155...

output:

1 7541523505
1 7541933474
1 7542343456
1 7542343457
1 7542325062
1 3771116791
1 7542334259
1 1
1 7541523505
1 7541933474
1 1
1 7542334259
1 7541523505
1 7542343456
1 3771116791
1 1
1 7542343457
1 1
1 7542343456
1 7542343457
1 1
1 7542334259
1 7542325062
1 3771116791
1 7542343457
1 1
1 1
1 3771116791...

result:

ok ok

Subtask #6:

score: 10
Accepted

Test #111:

score: 10
Accepted
time: 83ms
memory: 5720kb

input:

300000
? 308230551
? 154394919
? 77796824
? 523232316
? 601650936815206607
? 986805724
? 283169431815882827
? 781223930
? 785380179984309713
? 36818911074958611
? 452850684
? 392810692
? 812929344
? 9753139
? 236758865441063408
? 448106017
? 382652997142237763
? 667762111
? 201388730
? 433119061
? 6...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok ok

Test #112:

score: 0
Accepted
time: 80ms
memory: 5788kb

input:

300000
? 694621109955041627
? 142117945123014130
? 271105710887553798
? 588870805
? 596999104759770886
? 559345155
? 913509137
? 863050204268429730
? 121648910055156360
? 27539423
? 237739281
? 102014055246481880
? 918066897
? 150630127417587162
? 675850416
? 465834639
? 242358214
? 914838785
? 3574...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok ok

Test #113:

score: 0
Accepted
time: 1112ms
memory: 64376kb

input:

300000
- 594041 389378
+ 771465 5
+ 12646 60
+ 148838 36
+ 30991 56
+ 5527 60
+ 488 60
+ 17980 59
+ 3243 60
+ 846785 5
+ 736073 5
+ 206626 6
+ 258271 6
+ 8314 60
+ 10126 60
+ 574513 5
+ 868009 5
+ 22322 59
+ 6150 60
+ 448626 6
+ 330651 6
+ 308596 6
+ 901966 4
+ 10974 60
+ 6572 60
+ 25046 59
+ 7370 6...

output:

25061 709605
1 1
24919 696445
25061 714997
1 1953994
25089 715469
25081 715469
21551 696445
1 1
1 1953972
1 1944470
1 1906373
22393 268661
22393 268661
25089 715469
25061 709605
25081 715469
1 1951924
1 1953994
1 1953990
1 1
25089 715469
21551 696445
25061 709605
25081 715469
25089 715469
24919 6964...

result:

ok ok

Test #114:

score: 0
Accepted
time: 1183ms
memory: 14984kb

input:

300000
- 544244779 401896578
- 229459262 27082806
- 4986516 61493428
- 747404249 439501562
- 313249775 339930648
+ 725 60
+ 11377 40
+ 11356 40
+ 655 60
+ 1580 60
+ 509 60
+ 9229 51
+ 1546 60
+ 3469 56
+ 5224 56
+ 15369 38
+ 2706 59
+ 1738 60
+ 2106 59
+ 1380 60
+ 75573 7
+ 981 60
+ 761 60
+ 73413 7...

output:

1 52183
385 209952
1 186912
387 209952
1 1
1 140592
385 209232
385 209712
387 210012
387 209952
385 209952
387 186912
387 210012
385 208272
387 210012
1 232473
580 198490
1 231714
1 233229
387 198492
1 233229
1 1
390 209891
1 1
387 210012
387 209693
385 209952
1 233225
1 1
387 209952
1 52183
1 23019...

result:

ok ok

Test #115:

score: 0
Accepted
time: 1146ms
memory: 70168kb

input:

300000
- 940754 627319
- 547131 401811
- 469808 360399
- 885538 886691
- 442130 420883
- 668555 344909
- 326050 871625
- 363559 488126
- 738546 429119
- 367654 579621
+ 16493 60
+ 7756 60
+ 559725 6
+ 31268 59
+ 24926 59
+ 534865 6
+ 44038 56
+ 889664 5
+ 7191 60
+ 29338 59
+ 485200 6
+ 144559 36
+ ...

output:

1 1
728945 22502
684929 22552
726817 22552
728945 22612
118285 1
1 2363391
713489 22042
695457 20202
669697 22042
727657 22387
1 2360248
713489 22042
727041 22552
595441 22552
1 2309210
721777 22552
634921 14797
728833 22612
1 2363053
1 1
728721 22552
118285 1
1 1
1 2363437
1 2363415
1 2363435
66969...

result:

ok ok

Test #116:

score: 0
Accepted
time: 939ms
memory: 29536kb

input:

300000
- 983699889 144650481
- 805639905 849113323
- 1562000 12909585
+ 264548 4
+ 119 60
+ 1897 60
+ 412862 4
+ 9986 56
+ 260615 4
+ 16578 55
+ 267854 4
+ 384590 4
+ 15666 55
+ 8080 59
+ 51337 35
+ 988 60
+ 7736 59
+ 224135 4
+ 4497 60
+ 22608 49
+ 411950 4
+ 364070 4
+ 123986 4
+ 168788 4
+ 1633 6...

output:

389037 4721
389208 4717
97482 1
348852 3781
388353 4705
384762 1
241122 1
384762 4321
388866 4705
389037 4681
379632 4321
1 1
456580 1
389151 4705
389208 4721
388353 4537
384762 4681
388182 4561
389208 4705
384762 4621
388752 4705
456372 1
21361 1
388752 4621
388182 4721
384762 4201
384762 3361
4563...

result:

ok ok

Test #117:

score: 0
Accepted
time: 1237ms
memory: 49224kb

input:

300000
- 691888041 560547304
+ 77483 39
+ 220918 8
+ 687043 4
+ 2132 60
+ 180850 8
+ 11169 60
+ 8035 60
+ 165957 8
+ 10113 60
+ 109372 36
+ 120597 36
+ 5587 60
+ 15778 59
+ 15586 59
+ 4029 60
+ 13244 59
+ 11600 60
+ 26965 56
+ 7630 60
+ 91044 38
+ 13984 59
+ 622462 4
+ 29045 56
+ 549786 5
+ 11409 60...

output:

275 1454748
271 1454148
271 1454508
1 1228548
271 1452348
1 1471248
274 1454688
1 1
271 1454748
1 1325628
1 1422708
1 743148
1 1034388
271 1454148
1 1471246
271 1454148
271 1454748
1 1435440
1 1
1 1
275 1454748
274 1454688
1 743148
1 1034388
275 1454748
274 1454688
1 743148
275 1454748
275 1454748
2...

result:

ok ok

Test #118:

score: 0
Accepted
time: 1160ms
memory: 58368kb

input:

300000
+ 833662 4
+ 10224 60
+ 7980 60
+ 211291 8
+ 70888 51
+ 12550 60
+ 16366 59
+ 41988 51
+ 4505 60
+ 675886 5
+ 405 60
+ 894 60
+ 361 60
+ 1053 60
+ 195868 8
+ 799702 5
+ 43708 51
+ 22313 56
+ 49038 51
+ 3688 60
+ 14098 60
+ 36848 56
+ 338498 7
+ 4669 60
+ 664686 5
+ 48998 51
+ 28283 56
+ 12232...

output:

1 1
10329 1122167
9499 982127
1 429418
10329 1122227
10319 1122047
9499 1077107
1 1077107
10329 1122167
10305 1122047
11082 1077105
10329 1122227
10326 1122047
10305 1122047
10329 1122047
9499 982127
6333 982127
1 1735739
1 1741967
10329 1122227
10329 1122227
9499 1077107
10329 1122167
10329 1122227...

result:

ok ok

Test #119:

score: 0
Accepted
time: 1186ms
memory: 64768kb

input:

300000
- 726676487 864274333
+ 3398 60
+ 3890 60
+ 534555 5
+ 218007 6
+ 43144 56
+ 8155 60
+ 4153 60
+ 59394 51
+ 4037 60
+ 276637 6
+ 7455 60
+ 1062133 4
+ 851461 4
+ 121298 37
+ 7416 60
+ 41029 56
+ 11893 60
+ 14398 60
+ 180268 34
+ 11178 60
+ 438942 6
+ 25331 59
+ 405997 6
+ 11788 60
+ 271742 6
...

output:

71724 209102
1 1
51965 209102
90237 218830
39570 1
90094 218230
90226 218830
90237 218230
82361 209102
39570 1
39574 506824
90094 217158
39570 59726
82361 209102
1066236 16
1064602 1
71724 209102
51965 209102
1063612 200
90226 218730
1 1
82361 209102
90094 218230
90226 218830
1 1
51965 209102
90237 ...

result:

ok ok

Test #120:

score: 0
Accepted
time: 68ms
memory: 5708kb

input:

300000
? 370258194
? 257028910
? 777092949513297634
? 423453060
? 521538082620634276
? 300650091451720493
? 628309223796234202
? 331707118970812852
? 188337343343097036
? 42780289224863237
? 605436692
? 254197361
? 247822295
? 562535640
? 747501990754280808
? 425396627743296367
? 241657729
? 9511443...

output:

-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

result:

ok ok

Test #121:

score: 0
Accepted
time: 1031ms
memory: 22064kb

input:

300000
- 111937273 506541919
- 593946312 29694729
- 507706336 962746978
- 522477680 700335053
- 255548369 420743772
- 508357068 958309741
- 40421254 920653282
- 304642144 646267096
- 634208796 932202123
- 1366575 766590343
- 966231072 292949428
- 333693807 70262246
+ 924 30
+ 85 30
+ 4037 30
+ 14193...

output:

88038 1
111229 4841
111125 4836
107225 2382
107225 3386
11086 1
111203 4836
70943 14402
36173 1
107225 1
1 271863
1 1
110579 4836
111047 4836
110813 4836
109877 4836
107225 4390
111229 4836
1 1
123364 2973
111229 4841
1 1
111203 4836
107225 2382
36173 1
1 1
107225 1
111047 4836
111047 4836
1 1
11122...

result:

ok ok

Test #122:

score: 0
Accepted
time: 976ms
memory: 38688kb

input:

300000
- 195143845 345564372
- 145294474 535583225
- 886576997 392420261
- 339601359 919220234
- 156836791 223904496
- 150385505 509018815
+ 158859 5
+ 7366 30
+ 912 30
+ 150435 5
+ 131169 5
+ 20263 26
+ 3880 30
+ 98442 6
+ 4444 30
+ 205185 4
+ 51574 19
+ 325197 3
+ 8840 30
+ 12359 29
+ 133977 5
+ 4...

output:

24259 1
333373 3
44656 63299
1 1
44656 63279
1 490053
44656 63299
1 1
24259 1
1 1
333372 3
1 1
44656 63299
44656 63299
1 1
1 1
1 1
44656 63279
1 1
24259 1
1 1
1 1
1 1
44656 63279
1 1
320993 1
44656 63279
44656 63279
1 1
44656 63299
1 1
1 1
44656 63299
1 1
44656 63299
44656 63279
44656 63299
44656 63...

result:

ok ok

Test #123:

score: 0
Accepted
time: 1112ms
memory: 56124kb

input:

300000
- 108911323 275022738
- 730160952 138230002
+ 6518 30
+ 12946 30
+ 10185 30
+ 432203 3
+ 326777 5
+ 38910 26
+ 6158 30
+ 6835 30
+ 11124 30
+ 20273 29
+ 64430 21
+ 75140 21
+ 9550 30
+ 4112 30
+ 5792 30
+ 135437 9
+ 430411 3
+ 86312 10
+ 240352 7
+ 457179 3
+ 13621 30
+ 4428 30
+ 193982 8
+ 2...

output:

1 1
4955 666493
1 815143
1 1
1 815143
4955 666493
1 774643
1 1
1 1
4955 666493
1 815143
1 1
1 1
4955 666493
1 1
1 1
1 1
4955 666493
1 774643
1 1
4955 666493
4955 666493
1 1
4955 666493
1 1
1 1
1 1
1 1
4955 666493
4955 666493
4955 666493
4955 666493
4955 666493
4955 666493
1 1
1 1
4955 666493
1 1
1 1...

result:

ok ok

Test #124:

score: 0
Accepted
time: 966ms
memory: 69180kb

input:

300000
+ 107692 10
+ 6550 30
+ 18166 30
+ 201009 9
+ 486965 3
+ 24905 29
+ 32883 26
+ 24507 29
+ 287113 7
+ 53503 26
+ 354134 6
+ 21 30
+ 17533 30
+ 27761 29
+ 21032 30
+ 19084 30
+ 16028 30
+ 50093 26
+ 341634 6
+ 32448 26
+ 1288 30
+ 6123 30
+ 87993 21
+ 202 30
+ 7074 30
+ 16875 30
+ 169593 9
+ 48...

output:

1 1
516114 3121
265946 1
515974 3076
485370 1
516226 3121
1 1105084
1 1063607
1 1
516226 3121
265946 1
516226 3121
1 1115453
265946 1
1 1
1 1
265946 1
265946 1
515974 3076
516226 3121
265946 1
1 1
516226 3121
265946 1
516226 3121
515974 3076
1 1
515974 3076
265946 1
516226 3121
515974 3076
1 1
51622...

result:

ok ok

Test #125:

score: 0
Accepted
time: 1075ms
memory: 83660kb

input:

300000
- 71565805 376201929
- 686468903 240673099
- 167580519 745698860
+ 3234 30
+ 21664 30
+ 207459 9
+ 18227 30
+ 80478 21
+ 113448 21
+ 22747 30
+ 23785 30
+ 637145 3
+ 19716 30
+ 455995 6
+ 4186 30
+ 662793 3
+ 674917 3
+ 65668 21
+ 660049 3
+ 223255 9
+ 625721 3
+ 15993 30
+ 374925 7
+ 17653 3...

output:

1 923579
131 1309769
8011 1073219
8014 1073249
1 1
1 1
1 1
1 923579
1 1
8011 1073219
8011 1073219
1 1
1 1
1 923579
1 1
1 1
8011 1073219
8011 1073219
8014 1073249
1 1
1 1
1 1313665
1 1
1 1
1 1
1 923579
1 1
1 1
1 1
8390 1049415
8014 1073249
8014 1073249
1 1
8014 1073249
1 923579
1 1
8014 1073249
8014 ...

result:

ok ok

Test #126:

score: 0
Accepted
time: 1211ms
memory: 53812kb

input:

300000
+ 1318 12
+ 16265 11
+ 89337 5
+ 17611 11
+ 16003 11
+ 107638 4
+ 42137 5
+ 9189 12
+ 18255 11
+ 10354 12
+ 11905 12
+ 16415 11
+ 78737 5
+ 8639 12
+ 138949 4
+ 103937 5
+ 94457 5
+ 79273 5
+ 132676 4
+ 127033 4
+ 172249 4
+ 14159 12
+ 154456 4
+ 1207 12
+ 12564 12
+ 146707 4
+ 94161 5
+ 1078...

output:

1 1
11499 136451
15429 156925
15429 156997
11499 136451
1 342145
11499 136451
15429 156997
11499 136451
1 336839
15429 156997
1 1
11499 136451
15429 156925
15429 156997
11499 136451
15429 156925
15429 156997
1 342139
15429 156997
153156 1
11499 136451
15429 156925
15429 156997
11499 136451
1 342145
...

result:

ok ok

Test #127:

score: 0
Accepted
time: 1183ms
memory: 60860kb

input:

300000
- 198456732 138355635
- 563130110 280075165
+ 137215 4
+ 9198 12
+ 63781 5
+ 787 12
+ 5818 12
+ 9426 12
+ 11708 12
+ 54469 5
+ 108077 5
+ 14063 12
+ 23201 11
+ 123499 4
+ 194104 4
+ 6923 12
+ 15059 12
+ 106053 5
+ 10183 12
+ 129007 4
+ 28877 9
+ 2863 12
+ 32353 9
+ 90253 5
+ 82229 5
+ 7622 12...

output:

1 1
9812 287903
9812 287903
1 405647
1 361839
1 1
1 1
1 1
9812 287903
1 1
9812 287903
9812 287903
1 1
9812 287903
9812 287903
1 1
9812 287903
9812 287903
1 1
1 1
1 1
9812 287903
1 1
9812 287903
1 1
1 1
1 361839
1 1
9812 287903
1 405647
9812 287903
1 1
9812 287903
1 1
1 1
1 1
9812 287903
1 405647
981...

result:

ok ok

Test #128:

score: 0
Accepted
time: 1061ms
memory: 65456kb

input:

300000
- 938122062 187354006
- 358207311 380818118
+ 2500 12
+ 56599 8
+ 188609 3
+ 19934 12
+ 208009 3
+ 24492 11
+ 4357 12
+ 1007 12
+ 21518 11
+ 142939 3
+ 17702 12
+ 67909 3
+ 137089 3
+ 134819 3
+ 23888 11
+ 215809 3
+ 241529 3
+ 55139 8
+ 54044 8
+ 103239 3
+ 400 12
+ 241159 3
+ 182449 3
+ 688...

output:

20827 154580
18919 177500
1 1
19970 152396
1 106152
20809 154532
16817 152396
18919 152396
20828 154580
20825 154580
20827 154532
20817 154532
18919 140835
16817 106152
18919 106152
12613 106152
20785 154532
20827 154568
20821 154532
16817 50449
20825 154532
12613 106152
20827 154580
20785 154532
20...

result:

ok ok

Test #129:

score: 0
Accepted
time: 1061ms
memory: 79336kb

input:

300000
- 383505589 619759437
- 862139690 107259435
- 515357701 353354793
+ 146796 3
+ 30094 11
+ 7861 12
+ 26173 12
+ 247986 3
+ 239356 3
+ 26401 12
+ 167106 3
+ 7793 12
+ 26115 12
+ 106856 3
+ 20215 12
+ 214076 3
+ 56966 8
+ 171916 3
+ 3684 12
+ 177886 3
+ 18699 12
+ 10781 12
+ 273826 3
+ 15232 12
...

output:

10584 379118
10423 378962
2 506330
1 1
10593 379226
10337 378434
10592 379046
1 502958
9844 348854
7335 374330
1 506044
1 506164
1 1
10593 379226
1 1
10337 378434
10593 379226
7335 374330
10593 379226
10593 379226
7335 374330
1 1
7335 374330
10423 378962
9844 348854
10593 379226
10593 379226
284583 ...

result:

ok ok

Test #130:

score: 0
Accepted
time: 1146ms
memory: 90444kb

input:

300000
+ 157666 5
+ 284077 4
+ 5541 12
+ 19987 12
+ 250003 4
+ 50406 9
+ 98090 5
+ 22612 12
+ 61402 9
+ 284419 4
+ 259696 4
+ 29578 12
+ 173466 5
+ 24221 12
+ 22827 12
+ 8095 12
+ 25682 12
+ 173058 5
+ 249958 4
+ 278893 4
+ 19894 12
+ 141754 5
+ 27594 12
+ 118250 5
+ 25639 12
+ 160194 5
+ 153010 5
+...

output:

254297 19889
1 1
1 627185
1 1
1 561417
254297 19889
1 1
254297 19889
1 1
1 1
254297 19889
254297 19889
254297 19889
1 1
1 1
254297 19889
254297 19889
254297 19889
1 1
1 1
1 1
1 1
254297 19889
254297 19889
1 1
1 1
1 1
1 627185
1 1
254297 19889
1 1
254297 19889
254297 19889
1 1
254297 19889
254297 198...

result:

ok ok

Test #131:

score: 0
Accepted
time: 1112ms
memory: 94772kb

input:

300000
- 775652617 278826207
- 78807891 273051077
+ 335163 3
+ 7507 12
+ 82008 8
+ 304833 3
+ 16694 12
+ 321963 3
+ 30388 11
+ 69208 8
+ 373353 3
+ 29688 12
+ 36952 11
+ 43636 11
+ 38338 11
+ 72238 8
+ 170603 3
+ 32390 11
+ 3477 12
+ 756 12
+ 377303 3
+ 22295 12
+ 279063 3
+ 62043 8
+ 373753 3
+ 264...

output:

20177 349308
18813 252996
20191 349308
20189 349308
20191 349320
24398 298846
1 150388
1 1
18813 150388
3529 549269
18813 150388
20185 349308
1 1
18813 150388
19254 360576
1 1
328732 1
20185 349308
20260 331139
20191 349308
1 150388
18813 309432
1 150388
20189 349308
20185 349308
20260 313774
20185 ...

result:

ok ok

Test #132:

score: 0
Accepted
time: 1698ms
memory: 237796kb

input:

300000
+ 808184 507588
+ 463956 862737
+ 219866 341710
+ 668154 699928
+ 143511 517404
- 116476 193919
+ 756157 765281
+ 473627 783871
+ 530526 793087
+ 82730 572621
+ 282177 311446
+ 938125 338634
+ 507502 41746
- 372590 437249
+ 795219 370021
+ 871788 531806
- 523720 309627
+ 348363 844469
+ 53404...

output:

1 19070185219
1 1
1 19070184704
1 18848432710
1 19070185217
1 18626680178
1 19070185214
1 18996267758
1 12713382139
1 9535036422
1 19070185218
1 19070184962
1 18922350171
1 18959308911
1 19033226462
1 19070185177
1 14302556583
1 14302556583
1 15891756510
1 19070185134
1 19070185208
1 19070185091
1 1...

result:

ok ok

Subtask #7:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #133:

score: 20
Accepted
time: 1720ms
memory: 118684kb

input:

300000
- 1 999995
+ 1 1
? 1
? 1
? 1
? 1
+ 1 1
? 2
- 1 1
? 1
? 1
? 1
? 1
? 1
? 1
- 1 1
? 930688071
+ 1 1
- 1 1
? 8254386840328011
? 231777271
? 428621712
? 620606606
? 352477757
- 1 1
- 1 1
+ 1 1
? 1
? 1
? 1
? 1
? 1
+ 1 1
? 1
? 2
? 1
? 1
- 1 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
? 1
+ 1 1
- 1 1
? 1
? 1
?...

output:

1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 1
1 1
1 1
1 2
1 1
1 2
1 2
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 1
1 1
1 2
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
-1 -1
-1 -1
-1 -1
-1 -1
-1...

result:

ok ok

Test #134:

score: 0
Accepted
time: 2614ms
memory: 119560kb

input:

300000
- 1 999999992
? 852664355109377391
? 776197530
+ 433 400
? 416
? 104
+ 594 690
? 153
? 33
? 1683
? 187
? 99
? 17
? 561
? 3
? 1
? 51
? 11
? 99
? 51
? 3
? 1683
? 1
+ 407 882
R 1
+ 516 605
? 2288
? 4
? 13
- 168 147
? 572
? 104
? 16
- 728 689
? 2
+ 552 342
? 5
- 645 264
? 10
? 5
? 2630
+ 29 225
?...

output:

-1 -1
-1 -1
417 1
417 313
519 613
591 661
1 1
536 562
591 595
587 681
1 962
594 688
594 690
570 664
591 683
591 595
570 664
594 688
1 1
594 690
1 1
433 1692
430 1686
426 1067
105 1654
430 1536
432 1548
429 1890
424 1890
429 1890
1 1
433 1890
1 1
1 1
1 1300
1 1758
29 2407
1 1
405 3522
396 4718
424 44...

result:

ok ok

Test #135:

score: 0
Accepted
time: 1350ms
memory: 145912kb

input:

300000
- 934884 338693
- 451424 299175
- 692987 445681
? 367285607
+ 3285 60
? 38
? 1672
? 4
+ 9058 60
+ 166834 34
+ 7094 60
+ 53695 51
+ 16157 60
+ 11724 60
? 1
+ 554561 4
+ 943130 4
? 943522
+ 110508 37
+ 852158 4
? 1
+ 597767 4
+ 182971 33
? 4
+ 10644 60
+ 701108 4
+ 1812 60
? 3602
? 2
+ 197855 4...

output:

-1 -1
3269 39
1673 1
3285 57
166834 34
1 1
943130 4
943130 1
939532 1
943130 3
943128 1
943130 4
943128 4
628373 1
1 1
943128 4
942209 1
825066 1
1 1
943130 4
917599 1
943130 4
942949 1
974761 1
910167 1
975335 4
975210 1
975335 4
975268 1
975335 3
975302 1
965645 1
975326 1
1 1
975316 1
974732 1
97...

result:

ok ok

Test #136:

score: 0
Accepted
time: 2450ms
memory: 122148kb

input:

300000
+ 21512 36
+ 101316 5
? 2
+ 1098 60
? 50708
+ 4262 56
? 1
+ 2716 59
+ 14490 38
+ 55419 8
+ 10534 50
+ 738 60
+ 99188 5
+ 114373 4
+ 12420 38
+ 746 60
+ 1734 60
? 761
? 1
+ 1323 60
? 1
+ 11073 50
+ 70601 7
+ 79781 7
? 3
? 115035
? 5
+ 1277 60
+ 28585 10
+ 1952 60
+ 1896 60
? 2095
+ 51625 9
? 1...

output:

101315 5
50613 1
101316 5
113616 1
114373 4
114373 4
114371 4
1 1
114372 1
112282 1
1 1
1 1
114373 4
114373 4
75872 1
103587 1
129820 4
103575 1
1 1
129820 4
117879 1
119705 1
129819 1
117847 1
128113 1
129820 4
126684 1
1 1
129820 4
129820 4
129820 4
129816 1
63660 1
63630 1
129820 1
129820 4
1 1
1...

result:

ok ok

Test #137:

score: 0
Accepted
time: 1287ms
memory: 149704kb

input:

300000
- 178483 807776
- 896401 63859
- 279388 501570
- 660965 505453
? 507007539374980556
+ 2901 60
? 740
+ 5803 60
+ 94185 51
+ 145545 39
+ 665846 10
+ 14748 60
+ 23159 59
+ 505377 12
? 666196
? 2
+ 534948 11
? 666207
+ 306984 14
+ 687 60
? 95183
+ 22819 59
? 1
+ 12721 60
+ 443245 12
+ 46240 56
+ ...

output:

-1 -1
2221 1
1 1
665846 9
1 1
570673 1
665846 10
665844 10
1 1
665846 10
665846 10
646229 1
665846 10
532331 1
665846 10
665844 7
665846 10
662376 1
665846 10
665846 6
1 1
665677 1
1 1
802571 1
1 1
805925 1
804355 1
1 1
806325 9
806325 9
787053 1
806292 1
1 1
1 1
1 1
1 1
971411 7
971412 7
971402 1
9...

result:

ok ok

Test #138:

score: 0
Accepted
time: 2157ms
memory: 129572kb

input:

300000
- 171683069 374253602
? 187096517
+ 7474 59
+ 14345 56
? 1
+ 30493 50
+ 16140 51
+ 353361 5
? 7523
? 47
+ 176845 8
? 353589
? 43
? 8223
+ 45408 37
+ 335329 5
? 353631
+ 5808 59
+ 2293 60
+ 104976 10
+ 81618 10
? 1
+ 61908 36
+ 5348 60
+ 21690 51
+ 333761 5
+ 18090 51
+ 169372 8
+ 190466 8
? 1...

output:

-1 -1
14345 56
345843 1
353319 1
1 1
353323 1
345143 1
1 1
353361 5
353347 1
353361 5
353071 1
1 1
353361 5
176023 1
343219 1
353361 5
353331 1
348501 1
334676 1
282340 1
1 1
366181 4
365504 1
1 1
362044 1
355654 1
401509 1
402889 3
402889 4
1 1
1 1
402885 1
402889 4
301405 1
402889 4
1 1
402799 1
4...

result:

ok ok

Test #139:

score: 0
Accepted
time: 1710ms
memory: 139500kb

input:

300000
- 975964420 441089971
? 173532901
+ 2526 60
+ 1629 60
+ 648764 5
+ 309875 7
? 648895
? 1
+ 7362 60
? 6065
+ 4903 60
+ 16288 59
+ 3172 60
+ 6482 60
+ 297347 7
+ 11434 60
? 1
+ 11534 60
+ 48535 51
+ 538 60
? 8
? 92776
+ 654084 5
+ 2343 60
+ 1418 60
+ 20645 56
+ 67023 38
+ 13676 59
? 2113
+ 1350...

output:

-1 -1
1 1
648764 5
642704 1
648764 5
648761 1
555993 1
651976 1
1 1
1 1
744862 1
747039 1
1 1
1 1
378678 1
1 1
781354 4
781354 4
781354 4
764304 1
389104 1
781345 1
1 1
781354 4
781352 4
781354 4
1 1
1 1
681423 1
795639 1
795661 4
785538 1
1 1
1 1
595516 1
795661 3
794825 1
795661 4
795552 1
795192 ...

result:

ok ok

Test #140:

score: 0
Accepted
time: 1519ms
memory: 140980kb

input:

300000
? 339238542410440219
? 77188267
- 73621069 262089016
- 792139116 29810824
- 899039694 531714575
+ 51767 51
+ 32877 56
+ 261352 6
+ 18582 59
+ 486369 5
? 15695
+ 43237 51
+ 652802 4
+ 4621 60
? 93299
+ 675944 4
+ 345722 6
? 3
+ 19738 59
? 338152
+ 47327 51
+ 661409 4
+ 15056 59
+ 27287 56
+ 31...

output:

-1 -1
-1 -1
470679 1
559507 1
675942 4
337811 1
675944 4
675749 1
674899 1
675942 4
675839 1
1 1
873965 1
869049 1
806815 1
1 1
1 1
862138 1
874000 1
874084 1
857608 1
748942 1
874028 1
870275 1
873926 1
874133 4
819301 1
874105 1
874133 4
843873 1
874111 1
835980 1
1 1
882626 4
882626 3
1 1
882626 ...

result:

ok ok

Test #141:

score: 0
Accepted
time: 1384ms
memory: 145700kb

input:

300000
+ 25980 56
+ 243774 14
+ 23033 59
? 2
+ 488109 10
+ 13983 60
? 1
+ 357652 12
+ 12622 60
+ 23393 59
+ 40935 56
+ 6168 60
? 44414
+ 9561 60
? 34901
+ 119290 40
+ 3684 60
? 1
? 2
+ 691203 7
+ 75735 51
+ 238604 14
+ 19069 59
+ 69525 51
+ 929209 4
+ 6903 60
+ 254833 13
+ 12870 60
+ 104254 40
+ 198...

output:

243774 13
488109 10
443705 1
453218 1
243774 36
488109 9
929140 1
1 1
1 1
929209 4
1 1
743008 1
923006 1
742935 1
742885 1
1 1
1 1
929209 4
929206 1
928752 1
1 1
929096 1
742697 1
929097 1
1 1
929209 3
929207 1
928931 1
1 1
929194 1
1 1
929209 4
1 1
1 1
1 1
911599 1
795824 1
929199 1
1 1
929209 3
1 ...

result:

ok ok

Test #142:

score: 0
Accepted
time: 2626ms
memory: 120944kb

input:

300000
- 1 999999989
? 704297131123020441
+ 935 182
? 31
? 1116
? 372
? 62
+ 907 188
? 652
? 163
- 428 10
? 8
? 1304
? 2
? 1
? 652
? 4
+ 816 923
- 896 559
- 137 826
? 62
- 750 104
? 2108
- 784 80
? 68
? 31
+ 118 248
+ 206 827
? 3183
? 3
? 1061
? 3
? 1
+ 309 91
? 3274
? 1637
? 1
- 113 209
- 257 243
+...

output:

-1 -1
931 156
1 1
745 1
931 125
653 1
816 299
903 357
1 1
907 359
907 360
643 1
907 357
777 435
1 1
729 410
746 430
1 1
118 2366
222 1
118 2366
118 2368
1 1
1 1028
118 2459
1 3092
1 1773
136 3425
1 3609
93 3879
128 3367
1 1
112 3989
1 1796
111 3989
1 1
111 3989
1 1
112 3989
1 1
111 3989
87 4338
82 4...

result:

ok ok

Test #143:

score: 0
Accepted
time: 2273ms
memory: 126460kb

input:

300000
- 840910658 646975162
? 300831414
+ 417 30
+ 12038 26
+ 5022 30
+ 93280 4
+ 143707 3
+ 5637 29
+ 108265 4
+ 79501 5
+ 1361 30
+ 84545 5
+ 6739 29
+ 7219 29
? 28786
+ 9198 26
+ 2959 30
+ 4594 30
? 36004
+ 85923 5
+ 94819 4
+ 4582 30
+ 2938 30
+ 1929 30
+ 45374 6
? 144121
+ 502 30
+ 67697 5
+ 4...

output:

-1 -1
114924 1
107710 1
1 1
153031 3
152914 1
153030 3
1 1
76040 1
1 1
122220 1
156307 3
156307 3
156307 3
143164 1
124742 1
156203 1
153327 1
156307 3
124704 1
1 1
1 1
150858 1
156307 3
1 1
124686 1
1 1
1 1
156307 3
156284 1
1 1
156307 3
156307 1
156307 3
156307 3
156300 1
156307 3
1 1
1 1
160339 1...

result:

ok ok

Test #144:

score: 0
Accepted
time: 1926ms
memory: 131924kb

input:

300000
? 658996203837331784
- 736446623 575830990
- 395743741 984081197
- 149406046 268841679
- 448816013 39661207
- 918448238 739224716
- 30300241 304487231
- 552197068 220736529
+ 14039 28
+ 174716 5
? 4
+ 30236 25
+ 16088 28
? 174801
+ 101470 6
? 19423
? 174807
+ 19796 25
? 174832
+ 5917 30
? 125...

output:

-1 -1
174713 5
1 1
155298 1
1 1
1 1
173463 1
306286 3
1 1
1 1
306286 3
1 1
1 1
152898 1
306126 1
1 1
152733 1
1 1
244863 1
306014 1
306286 3
306276 1
255075 1
1 1
1 1
313566 1
1 1
313566 3
313566 3
1 1
1 1
311790 1
313566 3
313552 1
313162 1
284935 1
234828 1
313565 3
1 1
313565 1
1 1
313564 1
25056...

result:

ok ok

Test #145:

score: 0
Accepted
time: 1702ms
memory: 139432kb

input:

300000
+ 119601 8
? 29902
+ 8718 30
+ 423661 3
+ 354294 4
+ 198618 6
+ 7350 30
+ 385290 4
? 423745
+ 29840 26
+ 18717 29
+ 11343 30
+ 371223 4
+ 18263 29
+ 6884 30
+ 196702 7
+ 18701 29
+ 16789 29
+ 462861 3
+ 21605 26
? 4099
+ 199818 6
+ 66392 20
+ 30085 26
+ 467761 3
? 46
+ 33370 26
+ 37575 26
? 3...

output:

89707 1
1 1
458765 1
467718 1
464190 1
456878 1
1 1
467761 3
374062 1
1 1
1 1
1 1
467760 3
467760 1
431689 1
1 1
467761 1
467760 3
1 1
1 1
1 1
467761 3
467761 3
1 1
467761 3
467761 1
1 1
467760 3
465140 1
467723 1
467406 1
1 1
232988 1
467442 1
467761 3
373834 1
467761 3
1 1
1 1
466373 1
1 1
415537 ...

result:

ok ok

Test #146:

score: 0
Accepted
time: 1459ms
memory: 145764kb

input:

300000
+ 8649 30
+ 592513 3
+ 85456 19
? 4
+ 471722 4
+ 17022 30
+ 58420 25
+ 452552 4
+ 13292 30
+ 681889 3
+ 344312 5
+ 1728 30
+ 70516 19
? 136418
? 1
? 2
+ 10958 30
+ 18081 30
+ 656969 3
+ 255574 5
+ 14234 30
+ 284980 5
+ 242003 6
+ 136053 6
+ 1282 30
? 136447
+ 16108 30
+ 79024 19
+ 103780 19
+...

output:

592512 1
545477 1
681889 3
681888 3
545451 1
681889 3
684157 3
684157 1
455840 1
1 1
684157 3
1 1
693257 3
1 1
554349 1
693257 3
693257 3
693251 1
461680 1
1 1
693241 1
554312 1
693257 3
1 1
643634 1
577444 1
693254 1
693230 1
691729 1
692997 1
692379 1
693256 3
1 1
693257 3
461501 1
692973 1
678151...

result:

ok ok

Test #147:

score: 0
Accepted
time: 1269ms
memory: 145704kb

input:

300000
? 663551583760370959
? 466111466
+ 469874 5
+ 344495 7
+ 530568 4
+ 168656 10
+ 256005 8
+ 9458 30
+ 32330 29
+ 143981 10
? 10830
? 75810
+ 8444 30
+ 208949 9
? 3
+ 21149 30
+ 57624 26
+ 30840 29
+ 19968 30
+ 2612 30
? 530854
+ 46284 26
+ 10702 30
+ 81209 21
+ 6673 30
+ 472136 5
+ 7054 30
+ 2...

output:

-1 -1
-1 -1
519742 1
454767 1
530566 4
1 1
520917 1
530566 4
353555 1
535290 1
536454 4
536454 4
469273 1
1 1
536306 1
1 1
536454 4
267530 1
504822 1
1 1
1 1
577504 1
591607 3
1 1
552026 1
1 1
591379 1
591608 3
591608 3
590595 1
537613 1
1 1
591608 3
591608 3
577468 1
1 1
591608 3
549166 1
591608 3
...

result:

ok ok

Test #148:

score: 0
Accepted
time: 1814ms
memory: 133532kb

input:

300000
? 631393154942236892
- 681662341 6533446
+ 10495 12
? 1
? 309
? 6
+ 16045 11
+ 137428 4
+ 9429 12
? 6
+ 60217 5
+ 1832 12
+ 36197 9
+ 128275 4
+ 18113 11
+ 175831 4
+ 166822 4
? 87959
+ 70153 5
+ 130624 4
+ 13438 12
? 175939
? 1
+ 33101 9
+ 133765 4
+ 12389 12
? 43991
+ 9521 12
+ 6842 12
+ 10...

output:

-1 -1
10495 12
10198 1
10495 7
137426 1
87888 1
1 1
175831 4
131856 1
1 1
175831 4
175831 4
1 1
175831 4
1 1
175831 4
175831 4
175822 1
1 1
1 1
177586 4
1 1
177586 4
152166 1
177165 1
177577 1
177586 4
177530 1
177586 4
155334 1
177586 1
177586 4
177586 3
177579 1
177586 4
1 1
177586 4
177586 3
1775...

result:

ok ok

Test #149:

score: 0
Accepted
time: 1684ms
memory: 136392kb

input:

300000
+ 208265 3
+ 8470 12
? 1
+ 50465 3
+ 6148 12
+ 220765 3
+ 13088 12
+ 17183 12
+ 28555 8
? 31547
+ 35825 8
? 220837
+ 216095 3
+ 581 12
+ 104485 3
+ 12770 12
+ 207165 3
+ 198425 3
+ 6955 12
+ 68655 3
+ 24686 11
+ 16318 12
? 1
? 220911
? 73637
+ 28620 8
+ 146335 3
+ 12171 12
+ 5624 12
+ 13197 1...

output:

208265 3
189224 1
1 1
220765 3
1 1
147143 1
110304 1
220765 3
1 1
218580 1
220765 3
223805 3
234115 3
234114 3
234112 1
234115 3
231149 1
1 1
233763 1
208059 1
1 1
234515 3
234481 1
228166 1
233004 1
234515 3
1 1
234515 3
234515 3
1 1
1 1
240095 3
159817 1
1 1
240013 1
239089 1
240095 3
240095 3
240...

result:

ok ok

Test #150:

score: 0
Accepted
time: 1521ms
memory: 141748kb

input:

300000
? 123628508893739885
- 438898647 28291323
? 615247541733955800
- 728223047 528230081
+ 10840 12
+ 352 12
+ 129346 5
+ 21006 12
+ 240066 4
+ 52590 9
+ 3346 12
+ 13207 12
+ 19207 12
+ 128826 5
+ 21952 11
? 1
+ 244251 4
+ 54034 9
+ 227673 4
+ 218016 4
+ 95698 5
+ 6255 12
? 244394
+ 111554 5
+ 34...

output:

-1 -1
-1 -1
240066 4
1 1
243809 1
122068 1
244251 4
1 1
244242 1
244249 4
1 1
244251 4
251387 1
240025 1
251460 4
251460 4
251385 1
1 1
248277 1
251460 4
251460 3
251331 1
125506 1
251458 4
238214 1
1 1
251460 4
209463 1
251460 4
125457 1
251363 1
251396 1
251460 4
251460 4
167411 1
251417 1
1 1
251...

result:

ok ok

Test #151:

score: 0
Accepted
time: 1415ms
memory: 144716kb

input:

300000
? 858506833
- 786740664 312640737
- 357980337 491480577
- 113319661 832180375
- 721005357 52864178
? 660801395
+ 33264 11
+ 76750 3
+ 314910 3
+ 4901 12
+ 44480 8
+ 131060 3
+ 27802 11
+ 55725 8
+ 241830 3
+ 58375 8
+ 5760 12
+ 26129 12
? 533
+ 238800 3
+ 242790 3
+ 264530 3
+ 287980 3
+ 4380...

output:

-1 -1
-1 -1
314380 1
314910 3
314875 1
314894 1
1 1
327472 1
218473 1
327719 1
280908 1
327740 3
305882 1
1 1
218407 1
327740 3
1 1
327726 1
1 1
280861 1
1 1
1 1
163620 1
327740 3
327740 3
1 1
327740 3
1 1
1 1
1 1
1 1
262031 1
327472 1
1 1
326657 1
327740 1
297866 1
323114 1
320896 1
245528 1
318857...

result:

ok ok

Test #152:

score: 0
Accepted
time: 1314ms
memory: 147996kb

input:

300000
? 773885330114617378
- 658059421 480206
? 549911106674941957
? 814864574
+ 286122 3
+ 304842 3
+ 37805 11
+ 5109 12
+ 77302 8
? 17934
+ 16320 12
+ 57372 8
+ 18596 12
+ 141302 3
+ 277992 3
+ 18265 12
? 76232
+ 37069 11
? 304939
+ 286182 3
+ 3682 12
+ 338072 3
+ 38255 11
? 238
+ 258582 3
+ 1562...

output:

-1 -1
-1 -1
-1 -1
286911 1
228619 1
1 1
337837 1
1 1
338072 3
338072 3
338072 3
338071 3
168967 1
338072 3
1 1
253513 1
1 1
225310 1
342352 3
273818 1
330929 1
342340 1
342350 1
342342 1
304261 1
1 1
337459 1
1 1
322184 1
1 1
342345 1
342351 3
330533 1
228057 1
342352 1
342348 1
1 1
170868 1
1 1
338...

result:

ok ok

Test #153:

score: 0
Accepted
time: 1173ms
memory: 153336kb

input:

300000
- 260405063 59476117
- 177718174 168227675
? 88895911554449942
- 73651820 448392773
- 968265391 197933984
- 564207078 451485370
- 872057880 34569578
- 233396441 719571208
- 104632024 899052946
+ 19546 12
+ 11131 12
+ 110835 3
? 1
+ 18183 12
? 329
? 47
+ 10114 12
? 110885
+ 47241 11
? 110896
+...

output:

-1 -1
110835 3
110509 1
110791 1
1 1
1 1
252365 3
1 1
252364 1
238904 1
318585 3
295819 1
159203 1
1 1
159185 1
309478 1
318585 3
1 1
341522 1
1 1
398504 3
398445 1
398505 3
388007 1
398504 3
398505 3
398494 1
398505 3
1 1
391626 1
318681 1
1 1
398502 1
1 1
398504 3
198917 1
398505 3
1 1
398504 3
39...

result:

ok ok

Test #154:

score: 0
Accepted
time: 1712ms
memory: 237192kb

input:

300000
- 275479 147288
+ 796669 566260
+ 483999 142413
- 669157 262277
+ 429327 909037
+ 686535 71588
+ 195392 469735
+ 447542 382724
+ 795704 926996
+ 818640 564078
+ 155426 635333
- 303463 450615
- 161614 7518
+ 253037 828185
- 10213 495287
+ 849010 37141
+ 304330 442365
+ 194500 843198
- 810307 4...

output:

1 18942631212
1 18939785600
1 18942868344
1 18942788460
1 18651431450
1 18941682676
1 18942868340
1 1
1 18942868332
1 18927454679
1 17485691768
1 18942862200
1 18942867116
1 18942868280
1 18942868344
1 15154218996
1 1
1 18942868344
1 18942788460
1 1
1 18942867116
1 1
1 18942631212
1 18942852368
1 1
...

result:

ok ok

Extra Test:

score: -3
Extra Test Failed : Runtime Error on 3

input:

9
+ 1000000000 1
+ 1000000000 1000000000
+ 1000000000 1000000000
+ 1000000000 1000000000
+ 1000000000 1000000000
+ 1000000000 1000000000
? 3000000000
R 4
? 3000000000

output:


result: