QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#318010#5449. 楼梯catagory#30 1596ms185184kbC++232.6kb2024-01-30 10:30:242024-07-04 03:21:49

Judging History

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

  • [2024-07-04 03:21:49]
  • 评测
  • 测评结果:30
  • 用时:1596ms
  • 内存:185184kb
  • [2024-01-30 10:30:24]
  • 提交

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

#define PLL pair<LL,LL>
#define mp(a,b) make_pair(a,b)
#define fir first
#define sec second
const long long N = 300000+95;
long long T;vector<PLL>vc,tr[N];LL n;

void add(LL a,LL b){
  vector<PLL>nt;LL SUM=0;
  for(LL i=0;i<SZ(vc);i++){
    LL l=SUM+1,r=SUM+vc[i].fir;SUM+=vc[i].fir;
    if(r<a)nt.push_back(mp(vc[i].fir,vc[i].sec));
    else if(l<=a&&a<=r){
      if(a==r)nt.push_back(mp(vc[i].fir,vc[i].sec+b));
      else {
	nt.push_back(mp(a-l+1,b));
	nt.push_back(mp((r-a),vc[i].sec));
      }
    }
    else nt.push_back(mp(vc[i].fir,vc[i].sec));
  }
  if(SUM<a)nt.push_back(mp(a-SUM,b));
  vc=nt;return ;
}
void del(LL a,LL b){
  if(a>1)add(a-1,b);
  while(SZ(vc)&&vc.back().sec<=b){b-=vc.back().sec;vc.pop_back();}
  if(SZ(vc))vc.back().sec-=b;
  return ;
}
int main(){
  T=read();
  for(LL TC=1;TC<=T;TC++){
    char opt;cin>>opt;
    if(opt=='+'){
      LL a=read(),b=read();
      add(a,b);
    }
    else if(opt=='-'){
      LL a=read(),b=read();
      del(a,b);
    }
    else if(opt=='R'){
      LL u=read();
      vc=tr[TC-u-1];
    }
    else if(opt=='?'){
      LL q=read();q++;PLL ans=mp(-1,-1);LL fl=0;
      for(LL i=0;i<SZ(vc)&&(!fl);i++){
	LL SUM=0;
	for(LL j=i;j<SZ(vc)&&(!fl);j++){
	  LL l=SUM+2,r=SUM+vc[i].fir+vc[j].sec;
	  if(l<=q&&q<=r){
	    //	    cout<<" - > i = "<<i<<" j = "<<j<<" l = "<<l<<" r = "<<r<<endl;
	    LL x=0,y=0;
	    for(LL k=0;k<i;k++)x+=vc[k].fir;
	    for(LL k=SZ(vc)-1;k>j;k--)y+=vc[k].sec;
	    LL X=min(((q-1)-SUM),vc[i].fir);
	    LL Y=min((q-(SUM+X)),vc[j].sec);
	    //	    cout<<" x = "<<x<<" y = "<<y<<" X = "<<X<<" Y = "<<Y<<" SUM = "<<SUM<<endl;
	    ans=mp(x+(vc[i].fir-X+1),y+(vc[j].sec-Y+1));fl=1;break;
	  }
	  SUM+=vc[j].sec;
	  if(j+1<SZ(vc))SUM+=vc[j+1].fir;
	}
      }
      if(!fl){puts("-1 -1");continue;}
      writecs(ans.fir);writeln(ans.sec);
      /*      for(LL i=0;i<SZ(vc);i++)
	cout<<" i = "<<i<<" vc[i].fir = "<<vc[i].fir<<" vc[i].sec = "<<vc[i].sec<<endl;
	cout<<endl;*/
    }
    tr[TC]=vc;
  }
  return 0;
}
/*
my test data:
input:
3
+ 2 8
- 2 1
? 7
output:
1 3
*/

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

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: 2ms
memory: 4076kb

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: 4ms
memory: 4964kb

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
18 219
1 813
1 907
1 831
2 1149
2 1208
2 1377
1 2057
1 1
2 2177
1 1
1 1363
2 2469
1 1
1 2495
1 1
2 2924
1 3261
1 3322
1 3320
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 4612
1 6...

result:

ok ok

Test #4:

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

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
1 141
1 34
1 300
1 649
1 1
1 626
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
1 566
1 565
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
1 611
1...

result:

ok ok

Test #5:

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

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
76 61
64 259
2 1030
1 1364
1 1545
1 1841
1 1901
1 1849
1 2140
1 692
1 2195
1 1
1 2164
1 2433
1 2313
1 2653
1 1
1 3216
1 3246
1 1
1 1
1 3879
1 1
1 4229
1 1
1 4327
1 1
1 4473
1 1
1 5000
1 1
1 5218
1 5611
1 5612
1 5292
1 5026
1 6623
1 1
1 6743
1 1
1 7253
1 7383
37 5595
1 1
25 5595
37 5595
1 1
27 ...

result:

ok ok

Test #6:

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

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:

1 28
6 66
6 165
1 497
6 502
1 1
1 1
4 627
1 1
4 632
4 750
1 1
1 716
1 870
1 698
1 531
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
18 1114
19 1114
1 1
1 708
16 1114
1 2254
7 1114
16 1114
1 2229
19 1114
18 1114
1 2253
16 1114
1 708
19 1114
19 1114
1 1
1 2203
18 1114
...

result:

ok ok

Test #7:

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

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
1 710
1 1
13 889
1 1
14 889
13 1065
14 1065
12 1190
1 629
10 1244
1 1448
1 1532
1 1739
1 1794
1 1854
1 1
1 1831
1 2088
1 1
1 2489
1 1
1 1
1 2927
1 3180
1 1
1 3329
1 4289
1 1
1 1885
1 1
358 115
1 4584
1 4693
1 3591
1 1
1 4863
59 1877
32 1877
51 1877
1 4572
1 4206
1 1
687 1
270 1
881 1
1...

result:

ok ok

Test #8:

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

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
1 434
1 211
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
37 1737
1 1
73 1737
11 1737
75 1737
69 1737
1 5340
75 1737
51 1737
69 1737
61 1737
1 5442
73 1737
37 1737
75 1737
75 1737
51 173...

result:

ok ok

Test #9:

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

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
19 349
1 1
1 629
24 677
6 924
1 1
1 1286
6 1670
6 1786
1 1
1 1
1 2024
1 2273
1 2360
1 2692
1 1
3 2262
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
1 4938
1 1
1 5054
1 2172
1 5280
1 3756
1 5462
1 ...

result:

ok ok

Test #10:

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

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: 2ms
memory: 4148kb

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
399 3
60 10
1 109
1 1
1 250
1 290
1 1
1 445
1 603
4 419
1 1
1 788
1 844
1 402
1 820
1 849
28 7
318 7
450 7
370 7
81 7
1 1
165 7
423 7
396 7
1 950
1 1
266 7
1 957
1 956
1 844
266 39
1 956
140 39
1 1
16 39
240 39
190 39
1 889
1 908
1 253
18 389
20 389
8 389
16 389
14 389
1 1
18 389
1 253
1 956
1...

result:

ok ok

Test #12:

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

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
26 59
1 93
14 137
14 166
1 1
1 277
1 1
2 434
1 519
1 608
1 1
1 1
1 1
1 803
1 713
1 1
1 1008
1 1
1 1431
1 1434
1 1499
1 1556
1 1
1 1535
1 1628
1 1
1 1701
1 1
1 1731
1 1768
1 942
1 1
1 1819
1 942
1 1817
1 1
1 942
1 1
1 1817
1 1817
1 1
1 1819
1 1
1 1817
1 1819
1 1
1 942
1 1819
1 1817
1 1457
1...

result:

ok ok

Test #13:

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

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
1 156
1 1
4 476
1 467
4 587
1 1
4 649
1 394
4 704
1 542
1 263
1 888
1 1
1 1
1 1273
1 1398
1 964
1 1428
1 1
1 1
1 1492
1 1059
1 1
1 1572
1 1
1 1802
1 1866
1 1
1 1
1 2082
1 2094
1 1
1 2210
1 2216
1 2334
1 2440
1 2457
1 1
1 2576
1 964
398 56
548 56
598 56
1 1
310 56
1 236334
1 236311
1 ...

result:

ok ok

Test #14:

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

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
2 261
2 581
1 200
1 604
2 641
7 177
1 493
1 706
2 737
1 1
1 1
1 1
1 432
1 1546
1 1
1 1
1 1676
1 1
1 1778
1 1
1 2022
2 2055
3 1587
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
1 3039
1 1770
1 1
1 1
1 3259
1 3249
1 1
38 2197
1 1
1 1
38 2197
38 ...

result:

ok ok

Test #15:

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

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:

54 87
9 38
1 1
1 264
1 1
1 1
3 545
3 571
1 1
3 694
3 805
3 889
1 250
2 1162
1 1
1 1247
1 1339
1 1362
1 1
1 1387
1 1
1 1621
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
1 2973
1 2999
1 3073
1 3288
1 2311
1 3368
1 3476
1 3522
1 3541
1 3009
13 3249
1 1
7...

result:

ok ok

Test #16:

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

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
1 14
1 1
3 85
3 196
1 1
1 1
1 1
1 1
1 328
1 500
1 416
1 515
1 1
3 574
2 596
4 154
1 1
1 1
3 530
1 759
1 1
1 809
1 857
1 870
1 869
1 1
1 885
1 904
1 903
1 921
1 1
1 589
1 1
1 1
1 1
1 1096
1 1129
1 1
1 384
48 600
33 600
46 600
1 1188
1 1
49 600
1 1126
1 1187
16 600
1 1185
49 600
42 600
49 600
1 ...

result:

ok ok

Test #17:

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

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
6 44
3 44
11 47
1 45
11 77
7 21
1 1
1 1
120 12
8 24
1 167
4 209
1 1
1 1
1 237
4 245
1 282
4 283
1 1
1 229
1 359
2 345
1 1
1 429
1 478
1 1
1 534
1 551
6 449
1 572
1 575
1 577
1 584
1 1
1 634
1 635
1 647
1 745
1 732
1 679
1 780
1 859
1 1
1 1
1 914
2 212
1 1
1 991
1 1017
1 1
1 1041
1 1047
1 1...

result:

ok ok

Test #18:

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

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
32 33
111 9
1 1
1 52
67 14
1 178
1 1
1 1
17 250
1 1
17 262
9 299
1 344
1 1
1 1
9 526
3 530
6 585
1 1
1 578
1 1
6 628
1 1
7 126
1 531
6 675
1 616
1 536
2 709
1 1
3 714
3 714
1 1
1 740
3 742
2 771
1 1
1 793
1 807
1 817
1 1
2 880
3 899
3 928
1 832
1 828
1 633
2 271
3 1063
3 1120
1 768
1 1
1 365
1...

result:

ok ok

Test #19:

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

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
418 3
120 17
98 39
1 1
1 1
63 68
1 1
62 77
1 1
8 132
1 16
8 274
6 289
18 39
1 291
8 313
7 351
8 365
4 307
6 394
8 406
8 494
1 1
1 1
7 543
8 543
7 555
8 578
1 84
7 714
3 115
1 631
1 1
1 1
1 1
2 971
1 847
2 1008
2 1099
1 1
2 1148
2 1148
1 1109
2 1208
1 1229
1 1
1 1
2 1296
1 1342
1 1359
1 1
1 136...

result:

ok ok

Test #20:

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

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
1 45
7 115
1 1
1 1
7 209
1 1
1 1
7 221
1 1
7 239
1 1
6 338
1 1
1 351
1 1
1 1
1 369
7 381
1 1
20 26
7 396
2 359
1 1
1 1
1 260
4 499
4 514
1 1
1 1
4 570
1 583
1 1
5 235
4 710
1 774
1 1
1 652
4 793
1 832
1 712
1 584
1 925
2 932
1 954
1 1
3 958
1 1
1 972
1 197
1 966
1 852
2 1136
4 1163
1 1194
1 1193...

result:

ok ok

Test #21:

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

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:

1 49
1 71
2 100
1 1
1 1
1 125
1 1
1 1
1 243
1 176
1 1
1 341
1 1
1 1
6 374
1 1
1 1
1 433
1 377
6 470
1 1
1 1
6 654
1 709
1 701
1 1
6 757
4 820
1 830
1 391
6 948
6 996
1 1
1 1119
1 1
1 1158
1 1
1 1181
1 1048
1 1
1 587
1 825
1 1
1 1
1 1026
1 1
1 1511
1 1499
1 1419
1 1576
1 1
1 1
1 1654
1 1266
1 1704
1 ...

result:

ok ok

Test #22:

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

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: 0ms
memory: 4068kb

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: 2ms
memory: 4140kb

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
1 412
1 1
26 635
28 635
1 412
26 635
26 635
1 1
28 635...

result:

ok ok

Test #25:

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

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
74 177
1 126
1 283
1 1
397 11
19 297
206 17
19 363
1 469
9 602
1 1
1 759
1 841
1 1
1 965
1 889
1 1020
6 38
1 920
1 782
1 1
1 1137
102 44
1 1119
1 1256
1 1220
1 1
1 1415
2 1388
1 1622
1 1
1 755
1 1900
1 1
35 89
1 1
1 1
1 2571
1 2631
1 2712
1 2330
1 2772
1 1
1 2950
1 1
1 239
7 1272
1 1
1 1...

result:

ok ok

Test #26:

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

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
46 2
1 79
2 66
1 66
1 226
1 1
1 1
1 1
1 1
1 929
31 96
41 96
1 1
1 711
1 950
1 1
5 118
62 118
41 118
1 929
1 949
5 118
62 118
62 118
41 118
1 940
1 528
1 656
1 716
1 827
1 829
1 940
13 294
1 1
11 294
1 294
11 294
1 294
1 294
13 294
13 294
1 294
1 1
1 1
1 929
1 950
1 949
1 1
1 940
13 294
11 294
1 ...

result:

ok ok

Test #27:

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

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:

42 152
6 272
1 1
647 28
1 457
573 28
1 676
14 123
1 741
1 1
1 942
1 1
1 1206
2 1387
1 1
1 1
2 2015
2 2310
2 2476
1 2761
1 2810
2 2965
1 1
2 3535
1 3710
1 4299
1 4228
1 3510
2 4571
1 1
2 4742
1 2900
1 1
1 4842
2 5056
1 1
2 5056
1 1
2 5094
1 1926
2 5150
2 5266
1 1
2 5574
1 803
1 5710
1 5764
1 5734
1 5...

result:

ok ok

Test #28:

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

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
6 141
6 320
1 1
1 493
1 824
1 1
2 953
1 279
1 1
1 1054
1 1302
1 1298
1 1
1 771
1 1302
1 1
1 1120
1 1542
1 1
1 1
1 2276
1 1
1 2278
29 40
551 40
766 40
207 40
931 40
876 40
1 1
1 2468
876 40
1 1
876 40
1 2471
766 40
551 40
876 40
29 40
931 40
766 40
207 40
207 40
1 1
551 40
1 2409
207 40
876 40
...

result:

ok ok

Test #29:

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

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:

2 60
1 1
4 232
1 1
1 293
1 353
3 385
2 457
4 513
1 154
1 1284
1 1
1 1
1 1
1 1854
1 1
1 2146
1 1
1 2577
1 1
1 2944
1 2289
1 1
1 1
1 3913
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
44 175
1 1
1 5047
1 1
1 1367
1 5218
1 3448
1 4578
1 4935
1 4954
1 420...

result:

ok ok

Test #30:

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

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
70 128
28 128
29 190
32 249
1 1
10 249
1 1
1 599
1 1
1 626
1 1
1 551
1 727
1 735
1 31
2 460
16 45
1 1
1 989
1 1542
1 1443
24 44
1 1048
1 1715
1 1803
1 1888
1 1949
1 1956
1 1
1 2301
1 2447
1 2610
1 2547
1 2919
1 350
1 382
1 3202
1 3189
1 2877
1 1
1 3633
1 3610
1 1
1 3837
1 5050
1 53...

result:

ok ok

Test #31:

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

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
215 19
6 354
17 31
5 359
1 401
1 1
1 1
4 764
1 1
2 1219
1 191
1 1292
1 1346
1 1
1 1
1 2297
1 2376
1 2416
1 2397
1 1
1 1
2 3387
2 3387
1 3402
1 3522
2 3587
1 1
1 1
2 3942
1 3915
2 4249
1 2763
1 3951
1 1
1 4258
2 4309
1 2810
1 1
7 779
1 5051
1 3501
1 1
1 5235
1 1
1 4925
1 5266
1 5487
1...

result:

ok ok

Test #32:

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

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
799 728
858 728
834 728
859 728
738 728
67 728
847 728
85 1522
194 1522
203 1522
1 1249
1 1130
170 1522
134 1522
187 1522
190 1522
197 1522
204 194
1 1
1 1385
186 1522
1 1479
186 1522
163 1522
1 1
81 1522
201 1522
203 1646
190 1646
1 1
204 131
1 1503
202 1646
31 1646
1 1
...

result:

ok ok

Test #33:

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

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:

277 7
1 1
14 37
1 34
14 46
1 128
1 150
1 335
3 541
1 1
1 617
1 649
1 1
450 4
1 799
1 1
1 1
258 27
1 1
232 27
16 27
1 1
1 778
1 1
19 322
1 212
1 859
17 322
1 1
1 1
8 322
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: 3ms
memory: 4368kb

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:

823 7
1 103
1 1
9 21
1 324
2 341
1 461
1 573
1 678
1 674
1 709
1 708
1 776
1 643
1 1
3 744
1 914
1 1
1 930
1 1016
1 1
1 616
1 1
1 1358
1 1
3 280
1 1460
1 1129
1 734
1 839
1 1762
51 510
1 1790
1 1
47 510
15 510
47 510
1 1706
51 510
15 510
47 510
51 510
51 510
1 1
47 510
1 1762
1 1
51 510
1 1
15 510
4...

result:

ok ok

Test #35:

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

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
1 75
461 19
1 183
1 274
1 342
1 776
1 631
1 710
1 794
1 989
1 1019
1 1
1 1
1 1038
1 1
1 1068
1 1
1 1126
14 92
2 115
1 1
1 1408
1 1
1 1498
1 1
1 1496
1 1642
1 1404
1 1
2 619
1 1725
1 1816
1 1865
1 1
1 1
1 1980
1 1
1 2100
1 1
1 2129
1 1
1 2142
1 1235
1 1945
1 2177
1 1720
1 2280
1 1
1 2379
...

result:

ok ok

Test #36:

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

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
8 49
4 167
1 203
11 416
10 469
11 29
8 650
9 702
1 1
1 800
1 763
1 866
1 1
3 510
1 1024
1 1
2 1027
1 1032
2 1033
2 1066
1 1
1 1
1 1194
1 1245
1 1
1 1
1 1
1 1369
1 1373
5 479
1 1
1 2039
1 2021
1 1
1 1
1 2087
1 1
1 2267
1 2386
1 2352
1 2477
1 2603
1 2743
1 1198
1 1
1 1
1 1337
1 1339
1 3171...

result:

ok ok

Test #37:

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

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
22 41
22 160
1 1
10 86
7 350
1 1
37 36
4 626
1 319
1 694
1 1
9 783
9 783
1 1
1 1
1 890
1 90
9 900
1 944
9 988
1 1
56 65
1 1
9 1377
9 1523
1 1634
1 1439
1 1645
1 1865
1 1
1 1814
1 2131
1 2152
1 1
1 2493
1 2605
1 2845
1 2750
1 2875
1 2924
1 2970
1 2048
1 2789
1 3080
1 3171
1 1
1 1
1 3213
1 1515
3 ...

result:

ok ok

Test #38:

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

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
8 65
6 41
1 1
12 106
13 15
1 1
12 203
3 249
1 249
1 270
3 336
2 72
3 424
3 435
1 374
1 1
1 458
3 464
2 490
1 484
3 517
1 397
2 688
1 784
3 732
1 1
48 375
1 949
1 949
1 963
1 1
532 34
562 34
322 34
572 34
1 1
60 34
1 1000
452 34
1 957
1 1
24 675
26 675
1 955
1 962
1 1
127 163
54 163
102 163
147...

result:

ok ok

Test #39:

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

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
11 30
12 18
4 45
1 1
8 71
1 1
22 23
3 109
1 1
5 138
18 27
2 142
1 167
1 67
1 172
1 1
1 1
1 351
1 1
2 283
57 36
1 382
1 415
1 441
1 452
1 451
1 455
1 481
1 146
1 507
18 76
1 1
1 372
1 625
23 96
1 651
1 1
1 1
1 701
1 713
1 728
1 1
1 1
1 819
1 872
1 1
1 967
1 1014
1 468
2 1019
1 828
1...

result:

ok ok

Test #40:

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

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
31 17
30 37
2 52
1 1
1 1
2 90
1 1
1 133
1 1
1 116
1 183
1 1
6 211
2 241
1 1
3 311
1 1
2 372
1 1
4 463
1 1
1 1
1 621
1 1
1 1
1 720
1 798
3 286
1 809
1 1
1 321
1 982
1 981
1 827
1 1
1 1016
1 444
1 1
1 846
1 1088
1 1
1 1094
1 1
39 124
1 1
1 1221
1 1
1 290
17 1018
1 1248
1 1211
22 960
1 1270
35 147
...

result:

ok ok

Test #41:

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

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
25 36
1 86
1 132
1 164
1 1
14 44
1 290
1 1
2 128
1 337
1 341
1 1
1 379
1 1
23 60
1 407
1 1
1 1
1 677
1 716
1 1
1 605
1 1
3 140
1 746
3 799
1 841
1 842
10 160
1 899
1 900
1 939
10 183
1 948
1 935
1 949
1 931
1 1
1 1033
1 1067
1 1086
1 1091
1 1
1 1128
1 533
1 1206
1 1313
1 1111
1 1368
1 1238
1 1
1...

result:

ok ok

Test #42:

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

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
25 41
25 61
1 71
1 125
1 166
2 209
1 251
1 162
2 229
1 321
1 322
1 147
1 1
1 367
1 1
1 312
1 461
1 1
1 509
1 302
2 477
1 1
1 529
18 86
1 554
1 154
1 553
4 571
1 604
1 401
1 1
1 1
1 1
1 622
1 461
1 699
1 1
1 745
1 1
1 1
1 807
1 845
3 422
1 700
1 892
1 1
1 830
1 984
1 1008
1 1
1 1062
1 1058
3 836
...

result:

ok ok

Test #43:

score: 0
Accepted
time: 9ms
memory: 6516kb

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
366 10
56 46
58 74
1 107
1 140
28 146
1 195
1 1
2 271
1 1
1 276
1 1
2 304
2 315
1 1
3 428
1 1
1 1
1 1
1 516
1 1
2 569
1 341
2 585
1 1
1 447
1 1
1 1
1 1
2 743
1 1
2 748
1 506
9 248
2 756
1 760
2 836
1 1
1 1
1 864
1 877
2 914
1 1
1 1
1 1
2 1002
1 1
1 903
1 1100
3 272
1 1
1 297
4 901
2 1235
1 126...

result:

ok ok

Test #44:

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

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
28 69273147
1 69265799
34 69273147
34 69273147
1 69263819
1 1
1 1
1 69272137
28 69273147
1 1
34 69273147
28 69273147
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: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #45:

score: 10
Accepted
time: 8ms
memory: 39084kb

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

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
1 780
1 1
48 791
32 791
48 791
1 780
32 791
1 1
1 780
48 791
32 791
48 1473
1 1
48 1933
1 1
46 2570
1 1948
1 1
21 2570
25 2570
1 2400
1 2068
17 2790
1 1593
1 1
25 2790
1 2770
24 3263
24 3263
1 1
1 2314
18 3263
1 1528
1 2801...

result:

ok ok

Test #47:

score: 0
Accepted
time: 1596ms
memory: 185184kb

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
1 382
25 941
32 1511
1973 81
1 1
32 1768
1 1
1108 90
1 1
32 1973
26 1973
406 229
32 2033
338 68
1 1
1 1
32 2469
1 1
32 2483
1 1
1 1
825 104
32 2746
18 2814
1 1
779 116
1 1
25 3641
26 3641
571 91
1 1
133 132
26 3954
26 4005
25 4005
1 1
26 4014
26 4024
1 1
1 2462
26 4330
170 150
153 241
21 5...

result:

ok ok

Test #48:

score: 0
Accepted
time: 24ms
memory: 81056kb

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:

1 176
28 32
13 553
2 733
1 763
3 652
1 1
1 948
1 550
1 786
1 1
2 1570
1 1
1 1615
1 1723
1 841
1 1893
1 1
3 2012
2 2430
1 2429
2 2480
2 2527
134 60
1 2824
94 68
4 140
1 3589
2 3593
1 1
2 3681
1 1
2 4412
1 4470
2 4479
1 4758
1 3495
1 1
2 5083
1 2871
1 4759
1 3915
1 5587
2 5638
2 5748
1 4618
1 5795
1 6...

result:

ok ok

Test #49:

score: -10
Time Limit Exceeded

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
57 418
1 1
627 183
1 1
51 1294
39 1234
1 1
35 1580
35 1763
32 1823
4091 42
1 1
5 2017
14 2443
7 1632
1 1
1 2487
14 3241
1 1
14 3314
13 3631
14 3680
1 1
14 3939
9 3939
1 1
859 148
14 3977
1 4032
14 4636
1 1
1 482
1 1
428 222
1 5578
1 1
1 5635
1 1
1 2407
1 5992
1 6153
474 159
1 1
1 1
1 6397...

result:


Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%

Subtask #6:

score: 0
Time Limit Exceeded

Test #111:

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

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: 95ms
memory: 3812kb

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:


result:


Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%