QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#318643#5449. 楼梯catagory40 2343ms20216kbC++233.7kb2024-01-31 16:34:322024-01-31 16:34:33

Judging History

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

  • [2024-01-31 16:34:33]
  • 评测
  • 测评结果:40
  • 用时:2343ms
  • 内存:20216kb
  • [2024-01-31 16:34:32]
  • 提交

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);
  }
}

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 -1;
  return (X+Y-1);
}

#define ull unsigned long long
namespace GenHelper{
  ull seed=19260817ull;
  void Get(){
    seed^=(seed<<7);
    seed^=(seed>>11);
    seed^=(seed<<13);
    return ;
  }
  ull Rand(){Get();return (seed^(seed<<32ull));}
}using GenHelper::Rand;
#define random(a,b) (Rand()%(b-a+1)+a)

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;
  vector<LL>ord={0,1};
  if(random(0,1))swap(ord[0],ord[1]);
  for(auto op:ord){
    if(!op){//x
      LL l=x,r=lim,ans=-1;
      while(l<=r){
	LL mid=(l+r)>>1;
	if(GET(mid,y)>=k){l=mid+1;ans=mid;}
	else {r=mid-1;}
      }
      if(ans!=-1&&GET(ans,y)==k){solve(ans,y,q);return ;}
    }
    else {//y
      LL l=y,r=lim*lim,ans=-1;
      while(l<=r){
	LL mid=(l+r)>>1;
	if(GET(x,mid)>=(p-k)){l=mid+1;ans=mid;}
	else {r=mid-1;}
      }
      if(ans!=-1&&GET(x,ans)==(p-k)){solve(x,ans,q);return ;}
    }
  }
  assert(0);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;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 34ms
memory: 5924kb

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: 75ms
memory: 5688kb

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: 26ms
memory: 5920kb

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: 59ms
memory: 7728kb

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: 20ms
memory: 5924kb

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: 48ms
memory: 5892kb

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: 41ms
memory: 7736kb

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: 33ms
memory: 5580kb

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: 30ms
memory: 5656kb

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: 74ms
memory: 5928kb

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: 61ms
memory: 5920kb

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: 51ms
memory: 5632kb

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: 39ms
memory: 5688kb

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: 31ms
memory: 5692kb

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: 21ms
memory: 5684kb

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: 43ms
memory: 5688kb

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: 44ms
memory: 5928kb

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: 35ms
memory: 5620kb

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: 32ms
memory: 5688kb

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: 27ms
memory: 5632kb

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: 21ms
memory: 5692kb

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: 50ms
memory: 7736kb

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: 36ms
memory: 7620kb

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: 59ms
memory: 5892kb

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: 20ms
memory: 5888kb

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: 60ms
memory: 5924kb

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: 18ms
memory: 5696kb

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: 46ms
memory: 5852kb

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: 34ms
memory: 5664kb

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: 29ms
memory: 7684kb

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: 33ms
memory: 5688kb

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: 63ms
memory: 7712kb

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: 51ms
memory: 5620kb

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: 44ms
memory: 5660kb

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: 36ms
memory: 5696kb

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: 28ms
memory: 5696kb

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: 26ms
memory: 5628kb

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: 36ms
memory: 5892kb

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: 34ms
memory: 5684kb

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: 21ms
memory: 5684kb

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: 29ms
memory: 5572kb

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: 26ms
memory: 5624kb

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: 22ms
memory: 5636kb

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: 52ms
memory: 7972kb

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: 514ms
memory: 7804kb

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: 879ms
memory: 9892kb

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: 329ms
memory: 9804kb

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: 795ms
memory: 10088kb

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: 297ms
memory: 12064kb

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: 629ms
memory: 9796kb

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: 481ms
memory: 9828kb

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: 433ms
memory: 10092kb

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: 375ms
memory: 10088kb

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: 797ms
memory: 10064kb

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: 723ms
memory: 9744kb

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: 605ms
memory: 10088kb

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: 487ms
memory: 9792kb

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: 377ms
memory: 10056kb

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: 340ms
memory: 9892kb

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: 551ms
memory: 10052kb

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: 480ms
memory: 9844kb

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: 429ms
memory: 9892kb

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: 369ms
memory: 9744kb

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: 333ms
memory: 9792kb

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: 310ms
memory: 11892kb

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: 613ms
memory: 14124kb

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: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #67:

score: 20
Accepted
time: 2343ms
memory: 20216kb

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: -20
Time Limit Exceeded

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:


Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%

Subtask #6:

score: 0
Time Limit Exceeded

Test #111:

score: 10
Accepted
time: 96ms
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: 116ms
memory: 5684kb

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: -10
Time Limit Exceeded

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:


Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%