QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#422174#4277. Simple PolygonlinakAC ✓4ms3944kbC++171.6kb2024-05-26 21:21:472024-05-26 21:21:47

Judging History

This is the latest submission verdict.

  • [2024-05-26 21:21:47]
  • Judged
  • Verdict: AC
  • Time: 4ms
  • Memory: 3944kb
  • [2024-05-26 21:21:47]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

map<pll, int> sv;
map<int, pll> inv;
void point(ll y, ll x, ll t) {
    if (sv.count({y, x}))
        sv.erase({y, x});
    else
        sv[{y, x}] = t;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll a, b;
    cin >> a >> b;

    ll p = 1, q = 1;
    while (p * q < b) {
        if (p == q)
            p++;
        else
            q++;
    }
    ll x = 0, y = 1e9;
    if (a % 2 == 0 && 2 * (p + q) <= a && a <= 2 * (b + 1)) {
        ll k[p], s = 2 * (p + q);
        for (int i = 0; i < p; i++) {
            k[i] = min(q, b);
            b -= k[i];
        }
        ll m = k[0], r = 0;
        point(0, 0, x++);
        point(0, 1, x++);
        point(k[0], 0, y--);
        point(k[0], 1, y--);
        for (int i = 1; i < p; i++) {
            if (2 * (k[i] - 1) + s <= a) {
                s += 2 * (k[i] - 1);
                m += k[i];
            } else {
                r++;
                m += (a - s) / 2;
                s = a;
            }
            point(m, r, y--);
            point(m, r + 1, y--);
            point(m - k[i], r, x++);
            point(m - k[i], r + 1, x++);
        }
        cout << sv.size() << "\n";
        for (auto u : sv) inv[u.second] = u.first;
        for (auto u : inv) cout << u.second.first << " " << u.second.second << "\n";
    } else
        cout << -1;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3712kb

input:

4 1

output:

4
0 0
0 1
1 1
1 0

result:

ok good plan

Test #2:

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

input:

4 2

output:

-1

result:

ok NO SOLUTION

Test #3:

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

input:

656762045 149404634

output:

-1

result:

ok NO SOLUTION

Test #4:

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

input:

596732449 547492870

output:

-1

result:

ok NO SOLUTION

Test #5:

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

input:

490585606 197031926

output:

-1

result:

ok NO SOLUTION

Test #6:

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

input:

205935334 671544129

output:

10
0 0
0 1
102919809 1
102919809 21943
102936990 21943
102936990 21944
102945723 21944
102945723 1
102930408 1
102930408 0

result:

ok good plan

Test #7:

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

input:

122904120 825319663

output:

10
0 0
0 1
61396740 1
61396740 26591
61403789 26591
61403789 26592
61425468 26592
61425468 1
61420464 1
61420464 0

result:

ok good plan

Test #8:

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

input:

372662678 542854072

output:

10
0 0
0 1
186292735 1
186292735 15304
186305363 15304
186305363 15305
186316034 15305
186316034 1
186298804 1
186298804 0

result:

ok good plan

Test #9:

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

input:

743004999 188616704

output:

-1

result:

ok NO SOLUTION

Test #10:

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

input:

842473769 181343779

output:

-1

result:

ok NO SOLUTION

Test #11:

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

input:

850562596 980099219

output:

10
0 0
0 1
425232266 1
425232266 17724
425261296 17724
425261296 17725
425263573 17725
425263573 1
425242981 1
425242981 0

result:

ok good plan

Test #12:

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

input:

753747532 906770708

output:

10
0 0
0 1
376826053 1
376826053 17599
376848114 17599
376848114 17600
376856166 17600
376856166 1
376834082 1
376834082 0

result:

ok good plan

Test #13:

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

input:

421448642 685416185

output:

10
0 0
0 1
210680007 1
210680007 18133
210682402 18133
210682402 18134
210706187 18134
210706187 1
210696640 1
210696640 0

result:

ok good plan

Test #14:

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

input:

233439847 311101797

output:

-1

result:

ok NO SOLUTION

Test #15:

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

input:

251152449 177137892

output:

-1

result:

ok NO SOLUTION

Test #16:

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

input:

770588658 78245838

output:

-1

result:

ok NO SOLUTION

Test #17:

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

input:

820350607 531778846

output:

-1

result:

ok NO SOLUTION

Test #18:

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

input:

796111246 786209428

output:

10
0 0
0 1
398013739 1
398013739 13844
398017871 13844
398017871 13845
398041778 13845
398041778 1
398041644 1
398041644 0

result:

ok good plan

Test #19:

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

input:

936453726 441481755

output:

-1

result:

ok NO SOLUTION

Test #20:

score: 0
Accepted
time: 1ms
memory: 3792kb

input:

109411058 100658595

output:

10
0 0
0 1
54690914 1
54690914 4581
54693408 4581
54693408 4582
54700947 4582
54700947 1
54699916 1
54699916 0

result:

ok good plan

Test #21:

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

input:

720248693 974609485

output:

-1

result:

ok NO SOLUTION

Test #22:

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

input:

596992030 134373467

output:

-1

result:

ok NO SOLUTION

Test #23:

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

input:

277127289 907592028

output:

-1

result:

ok NO SOLUTION

Test #24:

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

input:

292844698 273681769

output:

10
0 0
0 1
146398111 1
146398111 7694
146403734 7694
146403734 7695
146414654 7695
146414654 1
146405550 1
146405550 0

result:

ok good plan

Test #25:

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

input:

335514279 73605709

output:

-1

result:

ok NO SOLUTION

Test #26:

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

input:

676664106 632143236

output:

10
0 0
0 1
338295223 1
338295223 11687
338297293 11687
338297293 11688
338320365 11688
338320365 1
338310752 1
338310752 0

result:

ok good plan

Test #27:

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

input:

888393402 19178143

output:

-1

result:

ok NO SOLUTION

Test #28:

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

input:

409352440 130292170

output:

-1

result:

ok NO SOLUTION

Test #29:

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

input:

390499700 267683852

output:

10
0 0
0 1
195229059 1
195229059 4429
195243889 4429
195243889 4430
195245420 4430
195245420 1
195235813 1
195235813 0

result:

ok good plan

Test #30:

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

input:

304232966 470743421

output:

10
0 0
0 1
152080098 1
152080098 14687
152096486 14687
152096486 14688
152101795 14688
152101795 1
152095970 1
152095970 0

result:

ok good plan

Test #31:

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

input:

748287082 766283467

output:

10
0 0
0 1
374101691 1
374101691 14167
374111348 14167
374111348 14168
374129373 14168
374129373 1
374122230 1
374122230 0

result:

ok good plan

Test #32:

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

input:

20018876 381657326

output:

10
0 0
0 1
9970875 1
9970875 19026
9988381 19026
9988381 19027
9990411 19027
9990411 1
9982896 1
9982896 0

result:

ok good plan

Test #33:

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

input:

525757814 846189716

output:

10
0 0
0 1
262829763 1
262829763 20054
262839057 20054
262839057 20055
262858852 20055
262858852 1
262848204 1
262848204 0

result:

ok good plan

Test #34:

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

input:

713603990 466683797

output:

10
0 0
0 1
356775304 1
356775304 5087
356781116 5087
356781116 5088
356796907 5088
356796907 1
356795148 1
356795148 0

result:

ok good plan

Test #35:

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

input:

274030892 438235130

output:

10
0 0
0 1
136980120 1
136980120 14391
136998280 14391
136998280 14392
137001054 14392
137001054 1
136992096 1
136992096 0

result:

ok good plan

Test #36:

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

input:

89061264 641898409

output:

10
0 0
0 1
44481715 1
44481715 23580
44496202 23580
44496202 23581
44507051 23581
44507051 1
44490016 1
44490016 0

result:

ok good plan

Test #37:

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

input:

531224402 120862474

output:

-1

result:

ok NO SOLUTION

Test #38:

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

input:

773240724 645857013

output:

10
0 0
0 1
386584745 1
386584745 10202
386599128 10202
386599128 10203
386610159 10203
386610159 1
386597768 1
386597768 0

result:

ok good plan

Test #39:

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

input:

708598658 620359198

output:

10
0 0
0 1
354263737 1
354263737 10684
354288095 10684
354288095 10685
354288644 10685
354288644 1
354277168 1
354277168 0

result:

ok good plan

Test #40:

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

input:

423968720 535749933

output:

10
0 0
0 1
211947223 1
211947223 13990
211957752 13990
211957752 13991
211970369 13991
211970369 1
211947922 1
211947922 0

result:

ok good plan

Test #41:

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

input:

530909092 728244562

output:

10
0 0
0 1
265410408 1
265410408 17151
265437028 17151
265437028 17152
265437394 17152
265437394 1
265434296 1
265434296 0

result:

ok good plan

Test #42:

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

input:

421139062 273115655

output:

10
0 0
0 1
210549218 1
210549218 3786
210558765 3786
210558765 3787
210565744 3787
210565744 1
210557766 1
210557766 0

result:

ok good plan

Test #43:

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

input:

604812834 777566583

output:

10
0 0
0 1
302361490 1
302361490 17041
302368132 17041
302368132 17042
302389375 17042
302389375 1
302384940 1
302384940 0

result:

ok good plan

Test #44:

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

input:

687797172 845256343

output:

10
0 0
0 1
343852266 1
343852266 17246
343864325 17246
343864325 17247
343881339 17247
343881339 1
343875444 1
343875444 0

result:

ok good plan

Test #45:

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

input:

779271936 373171148

output:

-1

result:

ok NO SOLUTION

Test #46:

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

input:

358898894 178215693

output:

-1

result:

ok NO SOLUTION

Test #47:

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

input:

182138052 729277997

output:

10
0 0
0 1
91018385 1
91018385 23635
91037418 23635
91037418 23636
91045390 23636
91045390 1
91033855 1
91033855 0

result:

ok good plan

Test #48:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

299640094 747781349

output:

10
0 0
0 1
149770831 1
149770831 21869
149793198 21869
149793198 21870
149798177 21870
149798177 1
149774042 1
149774042 0

result:

ok good plan

Test #49:

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

input:

199831800 657838219

output:

10
0 0
0 1
99868496 1
99868496 21755
99875829 21755
99875829 21756
99894144 21756
99894144 1
99873312 1
99873312 0

result:

ok good plan

Test #50:

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

input:

801971048 609973980

output:

10
0 0
0 1
400952362 1
400952362 8463
400969586 8463
400969586 8464
400977060 8464
400977060 1
400972030 1
400972030 0

result:

ok good plan

Test #51:

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

input:

410125446 499319768

output:

10
0 0
0 1
205027207 1
205027207 13170
205028809 13170
205028809 13171
205049552 13171
205049552 1
205037720 1
205037720 0

result:

ok good plan

Test #52:

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

input:

664337258 326232892

output:

-1

result:

ok NO SOLUTION

Test #53:

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

input:

198336320 502993871

output:

10
0 0
0 1
99127723 1
99127723 18008
99149036 18008
99149036 18009
99150151 18009
99150151 1
99131760 1
99131760 0

result:

ok good plan

Test #54:

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

input:

770483154 911695281

output:

10
0 0
0 1
385193945 1
385193945 17437
385206494 17437
385206494 17438
385224139 17438
385224139 1
385215052 1
385215052 0

result:

ok good plan

Test #55:

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

input:

968522752 905800329

output:

10
0 0
0 1
484217270 1
484217270 14008
484246350 14008
484246350 14009
484247367 14009
484247367 1
484230633 1
484230633 0

result:

ok good plan

Test #56:

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

input:

549864526 688851806

output:

10
0 0
0 1
274890244 1
274890244 15772
274890954 15772
274890954 15773
274916490 15773
274916490 1
274900604 1
274900604 0

result:

ok good plan

Test #57:

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

input:

694964358 273025751

output:

-1

result:

ok NO SOLUTION

Test #58:

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

input:

755213882 589915763

output:

10
0 0
0 1
377573909 1
377573909 8743
377589378 8743
377589378 8744
377598197 8744
377598197 1
377581248 1
377581248 0

result:

ok good plan

Test #59:

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

input:

853008566 261279048

output:

-1

result:

ok NO SOLUTION

Test #60:

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

input:

648529822 825071874

output:

10
0 0
0 1
324218749 1
324218749 17437
324243775 17437
324243775 17438
324247473 17438
324247473 1
324236512 1
324236512 0

result:

ok good plan

Test #61:

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

input:

109304282 232982785

output:

10
0 0
0 1
54625191 1
54625191 11685
54632102 11685
54632102 11686
54640455 11686
54640455 1
54629856 1
54629856 0

result:

ok good plan

Test #62:

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

input:

869585024 959944584

output:

10
0 0
0 1
434744577 1
434744577 16951
434746282 16951
434746282 16952
434775560 16952
434775560 1
434753456 1
434753456 0

result:

ok good plan

Test #63:

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

input:

507663674 88365136

output:

-1

result:

ok NO SOLUTION

Test #64:

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

input:

257793806 90998243

output:

-1

result:

ok NO SOLUTION

Test #65:

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

input:

919393432 666825571

output:

10
0 0
0 1
459662870 1
459662870 8022
459664628 8022
459664628 8023
459688693 8023
459688693 1
459675223 1
459675223 0

result:

ok good plan

Test #66:

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

input:

853903384 329850703

output:

-1

result:

ok NO SOLUTION

Test #67:

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

input:

335441670 284253394

output:

10
0 0
0 1
167697061 1
167697061 6913
167703267 6913
167703267 6914
167713921 6914
167713921 1
167706420 1
167706420 0

result:

ok good plan

Test #68:

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

input:

24544786 390070009

output:

10
0 0
0 1
12233511 1
12233511 19131
12245752 19131
12245752 19132
12253261 19132
12253261 1
12245000 1
12245000 0

result:

ok good plan

Test #69:

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

input:

323614096 699447036

output:

10
0 0
0 1
161760269 1
161760269 20331
161783489 20331
161783489 20332
161786716 20332
161786716 1
161776299 1
161776299 0

result:

ok good plan

Test #70:

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

input:

502837028 109125531

output:

-1

result:

ok NO SOLUTION

Test #71:

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

input:

664812904 365409364

output:

10
0 0
0 1
332385607 1
332385607 1728
332397699 1728
332397699 1729
332404723 1729
332404723 1
332389008 1
332389008 0

result:

ok good plan

Test #72:

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

input:

514667768 945027774

output:

10
0 0
0 1
257280770 1
257280770 22372
257292818 22372
257292818 22373
257311511 22373
257311511 1
257302170 1
257302170 0

result:

ok good plan

Test #73:

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

input:

655380202 337558629

output:

10
0 0
0 1
327671189 1
327671189 538
327679689 538
327679689 539
327689562 539
327689562 1
327682455 1
327682455 0

result:

ok good plan

Test #74:

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

input:

371491572 386802836

output:

10
0 0
0 1
185715894 1
185715894 10224
185723614 10224
185723614 10225
185735561 10225
185735561 1
185735148 1
185735148 0

result:

ok good plan

Test #75:

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

input:

370506158 366579356

output:

10
0 0
0 1
185224460 1
185224460 9472
185233566 9472
185233566 9473
185243606 9473
185243606 1
185237550 1
185237550 0

result:

ok good plan

Test #76:

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

input:

177655230 841310478

output:

10
0 0
0 1
88772664 1
88772664 25945
88781216 25945
88781216 25946
88801669 25946
88801669 1
88784305 1
88784305 0

result:

ok good plan

Test #77:

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

input:

135251342 579650917

output:

10
0 0
0 1
67580325 1
67580325 21269
67583184 21269
67583184 21270
67604401 21270
67604401 1
67581332 1
67581332 0

result:

ok good plan

Test #78:

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

input:

707764652 452687293

output:

10
0 0
0 1
353856404 1
353856404 4645
353858563 4645
353858563 4646
353877680 4646
353877680 1
353862432 1
353862432 0

result:

ok good plan

Test #79:

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

input:

870115800 430673599

output:

-1

result:

ok NO SOLUTION

Test #80:

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

input:

869686730 712395212

output:

10
0 0
0 1
434806273 1
434806273 10400
434820542 10400
434820542 10401
434832964 10401
434832964 1
434823081 1
434823081 0

result:

ok good plan

Test #81:

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

input:

948113264 941600913

output:

10
0 0
0 1
474010707 1
474010707 15238
474040390 15238
474040390 15239
474041393 15239
474041393 1
474037328 1
474037328 0

result:

ok good plan

Test #82:

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

input:

395441280 381620213

output:

10
0 0
0 1
197691688 1
197691688 9416
197707235 9416
197707235 9417
197711223 9417
197711223 1
197694200 1
197694200 0

result:

ok good plan

Test #83:

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

input:

397094130 636488993

output:

10
0 0
0 1
198504475 1
198504475 17360
198517923 17360
198517923 17361
198529704 17361
198529704 1
198527001 1
198527001 0

result:

ok good plan

Test #84:

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

input:

932433740 406519991

output:

-1

result:

ok NO SOLUTION

Test #85:

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

input:

768238442 525193487

output:

10
0 0
0 1
384090146 1
384090146 6157
384108465 6157
384108465 6158
384113063 6158
384113063 1
384111837 1
384111837 0

result:

ok good plan

Test #86:

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

input:

659791902 699488585

output:

10
0 0
0 1
329855526 1
329855526 13976
329863645 13976
329863645 13977
329881974 13977
329881974 1
329859456 1
329859456 0

result:

ok good plan

Test #87:

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

input:

249244600 310497662

output:

10
0 0
0 1
124594128 1
124594128 10550
124596107 10550
124596107 10551
124611749 10551
124611749 1
124598091 1
124598091 0

result:

ok good plan

Test #88:

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

input:

945387452 838174829

output:

10
0 0
0 1
472652148 1
472652148 12626
472666671 12626
472666671 12627
472681099 12627
472681099 1
472654026 1
472654026 0

result:

ok good plan

Test #89:

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

input:

365428734 126751007

output:

-1

result:

ok NO SOLUTION

Test #90:

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

input:

371260250 528530702

output:

10
0 0
0 1
185592217 1
185592217 14917
185601615 14917
185601615 14918
185615207 14918
185615207 1
185598270 1
185598270 0

result:

ok good plan

Test #91:

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

input:

872462082 360555751

output:

-1

result:

ok NO SOLUTION

Test #92:

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

input:

386375240 895400111

output:

10
0 0
0 1
193134227 1
193134227 23469
193149968 23469
193149968 23470
193164150 23470
193164150 1
193152965 1
193152965 0

result:

ok good plan

Test #93:

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

input:

945210142 542830818

output:

10
0 0
0 1
472578756 1
472578756 3015
472591339 3015
472591339 3016
472602055 3016
472602055 1
472596916 1
472596916 0

result:

ok good plan

Test #94:

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

input:

62895378 546576937

output:

10
0 0
0 1
31402274 1
31402274 22035
31402978 22035
31402978 22036
31425653 22036
31425653 1
31421376 1
31421376 0

result:

ok good plan

Test #95:

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

input:

311830080 660126790

output:

10
0 0
0 1
155869720 1
155869720 19626
155873179 19626
155873179 19627
155895413 19627
155895413 1
155879431 1
155879431 0

result:

ok good plan

Test #96:

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

input:

806503838 281477730

output:

-1

result:

ok NO SOLUTION

Test #97:

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

input:

302765796 428469874

output:

10
0 0
0 1
151348809 1
151348809 13388
151368935 13388
151368935 13389
151369509 13389
151369509 1
151358400 1
151358400 0

result:

ok good plan

Test #98:

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

input:

33545294 25336837

output:

10
0 0
0 1
16765909 1
16765909 1703
16770228 1703
16770228 1704
16770943 1704
16770943 1
16768254 1
16768254 0

result:

ok good plan

Test #99:

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

input:

879363252 692179827

output:

10
0 0
0 1
439645717 1
439645717 9599
439655680 9599
439655680 9600
439672026 9600
439672026 1
439649699 1
439649699 0

result:

ok good plan

Test #100:

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

input:

671000162 234266218

output:

-1

result:

ok NO SOLUTION

Test #101:

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

input:

576003508 153049489

output:

-1

result:

ok NO SOLUTION

Test #102:

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

input:

771313838 730168850

output:

10
0 0
0 1
385617145 1
385617145 12751
385636779 12751
385636779 12752
385644167 12752
385644167 1
385630962 1
385630962 0

result:

ok good plan

Test #103:

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

input:

836384904 432562321

output:

10
0 0
0 1
418170961 1
418170961 692
418186242 692
418186242 693
418191759 693
418191759 1
418185386 1
418185386 0

result:

ok good plan

Test #104:

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

input:

60293922 420693205

output:

10
0 0
0 1
30107406 1
30107406 19043
30115322 19043
30115322 19044
30127917 19044
30127917 1
30110148 1
30110148 0

result:

ok good plan

Test #105:

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

input:

338984060 404031611

output:

10
0 0
0 1
169460258 1
169460258 11670
169478848 11670
169478848 11671
169480359 11671
169480359 1
169471531 1
169471531 0

result:

ok good plan

Test #106:

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

input:

845909332 459008785

output:

10
0 0
0 1
422931558 1
422931558 1683
422931973 1683
422931973 1684
422952982 1684
422952982 1
422952608 1
422952608 0

result:

ok good plan

Test #107:

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

input:

801550650 756988125

output:

10
0 0
0 1
400734863 1
400734863 12948
400739420 12948
400739420 12949
400762376 12949
400762376 1
400754358 1
400754358 0

result:

ok good plan

Test #108:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

12239258 74994942

output:

10
0 0
0 1
6103013 1
6103013 7955
6103671 7955
6103671 7956
6111673 7956
6111673 1
6105300 1
6105300 0

result:

ok good plan

Test #109:

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

input:

689920978 647138514

output:

10
0 0
0 1
344923169 1
344923169 11880
344927376 11880
344927376 11881
344948608 11881
344948608 1
344927401 1
344927401 0

result:

ok good plan

Test #110:

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

input:

184342820 355672159

output:

10
0 0
0 1
92138576 1
92138576 13974
92147157 13974
92147157 13975
92157435 13975
92157435 1
92145074 1
92145074 0

result:

ok good plan

Test #111:

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

input:

302283400 155643880

output:

10
0 0
0 1
151128861 1
151128861 362
151135557 362
151135557 363
151141337 363
151141337 1
151134264 1
151134264 0

result:

ok good plan

Test #112:

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

input:

756062228 683554608

output:

10
0 0
0 1
377993281 1
377993281 11687
377999698 11687
377999698 11688
378019426 11688
378019426 1
378004410 1
378004410 0

result:

ok good plan

Test #113:

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

input:

291690990 659611467

output:

10
0 0
0 1
145799805 1
145799805 20006
145804827 20006
145804827 20007
145825488 20007
145825488 1
145802391 1
145802391 0

result:

ok good plan

Test #114:

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

input:

10173072 225574233

output:

10
0 0
0 1
5056833 1
5056833 14683
5067980 14683
5067980 14684
5071852 14684
5071852 1
5061403 1
5061403 0

result:

ok good plan

Test #115:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

116613708 99788090

output:

10
0 0
0 1
58292710 1
58292710 4154
58294730 4154
58294730 4155
58302699 4155
58302699 1
58295804 1
58295804 0

result:

ok good plan

Test #116:

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

input:

413403874 420363396

output:

10
0 0
0 1
206671011 1
206671011 10422
206680624 10422
206680624 10423
206691514 10423
206691514 1
206690743 1
206690743 0

result:

ok good plan

Test #117:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

104922974 68977141

output:

10
0 0
0 1
52451191 1
52451191 1990
52455380 1990
52455380 1991
52459496 1991
52459496 1
52454380 1
52454380 0

result:

ok good plan

Test #118:

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

input:

814481846 347162734

output:

-1

result:

ok NO SOLUTION

Test #119:

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

input:

401674718 224548659

output:

10
0 0
0 1
200820790 1
200820790 1583
200822356 1583
200822356 1584
200835775 1584
200835775 1
200828970 1
200828970 0

result:

ok good plan

Test #120:

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

input:

406976738 881568779

output:

10
0 0
0 1
203435837 1
203435837 22840
203452230 22840
203452230 22841
203465528 22841
203465528 1
203442732 1
203442732 0

result:

ok good plan

Test #121:

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

input:

926980270 622679155

output:

10
0 0
0 1
463458799 1
463458799 6381
463481760 6381
463481760 6382
463483753 6382
463483753 1
463470642 1
463470642 0

result:

ok good plan

Test #122:

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

input:

216852084 338679783

output:

10
0 0
0 1
108395125 1
108395125 12513
108404154 12513
108404154 12514
108413528 12514
108413528 1
108412073 1
108412073 0

result:

ok good plan

Test #123:

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

input:

610219914 207118079

output:

-1

result:

ok NO SOLUTION

Test #124:

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

input:

328457454 25931709

output:

-1

result:

ok NO SOLUTION

Test #125:

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

input:

915520690 118684974

output:

-1

result:

ok NO SOLUTION

Test #126:

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

input:

568229720 488525085

output:

10
0 0
0 1
284083506 1
284083506 9250
284101030 9250
284101030 9251
284105609 9251
284105609 1
284089859 1
284089859 0

result:

ok good plan

Test #127:

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

input:

531827830 685694401

output:

10
0 0
0 1
265871696 1
265871696 16032
265883891 16032
265883891 16033
265897882 16033
265897882 1
265892644 1
265892644 0

result:

ok good plan

Test #128:

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

input:

452409802 715329957

output:

10
0 0
0 1
226159864 1
226159864 18290
226178423 18290
226178423 18291
226186610 18291
226186610 1
226164176 1
226164176 0

result:

ok good plan

Test #129:

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

input:

739357828 243587585

output:

-1

result:

ok NO SOLUTION

Test #130:

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

input:

909250486 881008890

output:

10
0 0
0 1
454581194 1
454581194 14366
454593428 14366
454593428 14367
454610876 14367
454610876 1
454609512 1
454609512 0

result:

ok good plan

Test #131:

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

input:

190124236 623425506

output:

10
0 0
0 1
95015986 1
95015986 21163
95016472 21163
95016472 21164
95040954 21164
95040954 1
95028208 1
95028208 0

result:

ok good plan

Test #132:

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

input:

651638822 573089381

output:

10
0 0
0 1
325785140 1
325785140 10331
325795419 10331
325795419 10332
325809079 10332
325809079 1
325785851 1
325785851 0

result:

ok good plan

Test #133:

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

input:

118977068 383269885

output:

10
0 0
0 1
59452415 1
59452415 16541
59461036 16541
59461036 16542
59471992 16542
59471992 1
59455349 1
59455349 0

result:

ok good plan

Test #134:

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

input:

390751760 878353816

output:

10
0 0
0 1
195323195 1
195323195 23047
195350785 23047
195350785 23048
195352832 23048
195352832 1
195337467 1
195337467 0

result:

ok good plan