QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#326092#4277. Simple PolygonToboAC ✓2ms3820kbC++203.9kb2024-02-12 11:14:082024-02-12 11:14:08

Judging History

This is the latest submission verdict.

  • [2024-02-12 11:14:08]
  • Judged
  • Verdict: AC
  • Time: 2ms
  • Memory: 3820kb
  • [2024-02-12 11:14:08]
  • Submitted

answer

#include <bits/stdc++.h>
// #pragma GCC optimize(3, "Ofast", "inline")
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> s;
using i64 = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128_t;
using namespace std;
const int N = 3e5 + 5;
// const int B = 3e6;
// const int M = 2e6 + 5;
// const int base = 13131;
// const int base = 17171;
// const int mod = 998244353;
// const int mod = 1e9 + 7;
// const i64 mod = 1000000000000000003LL;
// const double pi = acos(-1);
// mt19937 rnd(chrono::duration_cast<chrono::nanoseconds>(chrono::system_clock::now().time_since_epoch()).count());

template <int mod>
unsigned int down(unsigned int x)
{
    return x >= mod ? x - mod : x;
}
template <int mod>
struct Modint
{
    unsigned int x;
    Modint() = default;
    Modint(unsigned int x) : x(x) {}
    friend istream &operator>>(istream &in, Modint &a) { return in >> a.x; }
    friend ostream &operator<<(ostream &out, Modint a) { return out << a.x; }
    friend Modint operator+(Modint a, Modint b) { return down<mod>(a.x + b.x); }
    friend Modint operator-(Modint a, Modint b) { return down<mod>(a.x - b.x + mod); }
    friend Modint operator*(Modint a, Modint b) { return 1ULL * a.x * b.x % mod; }
    friend Modint operator/(Modint a, Modint b) { return a * ~b; }
    friend Modint operator^(Modint a, int b)
    {
        Modint ans = 1;
        for (; b; b >>= 1, a *= a)
            if (b & 1)
                ans *= a;
        return ans;
    }
    friend Modint operator~(Modint a) { return a ^ (mod - 2); }
    friend Modint operator-(Modint a) { return down<mod>(mod - a.x); }
    friend Modint &operator+=(Modint &a, Modint b) { return a = a + b; }
    friend Modint &operator-=(Modint &a, Modint b) { return a = a - b; }
    friend Modint &operator*=(Modint &a, Modint b) { return a = a * b; }
    friend Modint &operator/=(Modint &a, Modint b) { return a = a / b; }
    friend Modint &operator^=(Modint &a, int b) { return a = a ^ b; }
    friend Modint &operator++(Modint &a) { return a += 1; }
    friend Modint operator++(Modint &a, int)
    {
        Modint x = a;
        a += 1;
        return x;
    }
    friend Modint &operator--(Modint &a) { return a -= 1; }
    friend Modint operator--(Modint &a, int)
    {
        Modint x = a;
        a -= 1;
        return x;
    }
    friend bool operator==(Modint a, Modint b) { return a.x == b.x; }
    friend bool operator!=(Modint a, Modint b) { return !(a == b); }
};
typedef Modint<998244353> mint;

void solve()
{
    int l, s;
    cin >> l >> s;
    if (l & 1)
    {
        cout << -1 << '\n';
        return;
    }
    l >>= 1;
    int a = l >> 1, b = l - a;
    if (s < l - 1 || s > (i64)a * b)
    {
        cout << -1 << '\n';
        return;
    }
    if ((i64)a * b == s)
    {
        cout << 4 << '\n'
             << "0 0\n";
        cout << a << ' ' << 0 << '\n';
        cout << a << ' ' << b << '\n';
        cout << 0 << ' ' << b << '\n';
        return;
    }
    i64 r = (i64)a * b - s;
    int x = r / (b - 1), y = r % (b - 1);
    vector<pair<int, int>> ans;
    ans.push_back({0, 0});
    ans.push_back({0, a});
    int cur = a;
    if (x)
    {
        ans.push_back({1, cur});
        cur -= x;
        ans.push_back({1, cur});
    }
    if (y)
    {
        ans.push_back({b - y, cur});
        cur--;
        ans.push_back({b - y, cur});
    }
    ans.push_back({b, cur});
    ans.push_back({b, 0});
    cout << ans.size() << '\n';
    for (auto [x, y] : ans)
        cout << x << ' ' << y << '\n';
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    cout << fixed << setprecision(10);
    while (t--)
        solve();
}

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

詳細信息

Test #1:

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

input:

4 1

output:

4
0 0
1 0
1 1
0 1

result:

ok good plan

Test #2:

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

input:

4 2

output:

-1

result:

ok NO SOLUTION

Test #3:

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

input:

656762045 149404634

output:

-1

result:

ok NO SOLUTION

Test #4:

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

input:

596732449 547492870

output:

-1

result:

ok NO SOLUTION

Test #5:

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

input:

490585606 197031926

output:

-1

result:

ok NO SOLUTION

Test #6:

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

input:

205935334 671544129

output:

8
0 0
0 51483833
1 51483833
1 13
2254301 13
2254301 12
51483834 12
51483834 0

result:

ok good plan

Test #7:

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

input:

122904120 825319663

output:

8
0 0
0 30726030
1 30726030
1 26
26442909 26
26442909 25
30726030 25
30726030 0

result:

ok good plan

Test #8:

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

input:

372662678 542854072

output:

8
0 0
0 93165669
1 93165669
1 5
77025728 5
77025728 4
93165670 4
93165670 0

result:

ok good plan

Test #9:

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

input:

743004999 188616704

output:

-1

result:

ok NO SOLUTION

Test #10:

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

input:

842473769 181343779

output:

-1

result:

ok NO SOLUTION

Test #11:

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

input:

850562596 980099219

output:

8
0 0
0 212640649
1 212640649
1 4
129536627 4
129536627 3
212640649 3
212640649 0

result:

ok good plan

Test #12:

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

input:

753747532 906770708

output:

8
0 0
0 188436883
1 188436883
1 4
153023180 4
153023180 3
188436883 3
188436883 0

result:

ok good plan

Test #13:

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

input:

421448642 685416185

output:

8
0 0
0 105362160
1 105362160
1 6
53243226 6
53243226 5
105362161 5
105362161 0

result:

ok good plan

Test #14:

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

input:

233439847 311101797

output:

-1

result:

ok NO SOLUTION

Test #15:

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

input:

251152449 177137892

output:

-1

result:

ok NO SOLUTION

Test #16:

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

input:

770588658 78245838

output:

-1

result:

ok NO SOLUTION

Test #17:

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

input:

820350607 531778846

output:

-1

result:

ok NO SOLUTION

Test #18:

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

input:

796111246 786209428

output:

8
0 0
0 199027811
1 199027811
1 3
189125996 3
189125996 2
199027812 2
199027812 0

result:

ok good plan

Test #19:

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

input:

936453726 441481755

output:

-1

result:

ok NO SOLUTION

Test #20:

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

input:

109411058 100658595

output:

8
0 0
0 27352764
1 27352764
1 3
18600304 3
18600304 2
27352765 2
27352765 0

result:

ok good plan

Test #21:

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

input:

720248693 974609485

output:

-1

result:

ok NO SOLUTION

Test #22:

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

input:

596992030 134373467

output:

-1

result:

ok NO SOLUTION

Test #23:

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

input:

277127289 907592028

output:

-1

result:

ok NO SOLUTION

Test #24:

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

input:

292844698 273681769

output:

8
0 0
0 73211174
1 73211174
1 3
54048248 3
54048248 2
73211175 2
73211175 0

result:

ok good plan

Test #25:

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

input:

335514279 73605709

output:

-1

result:

ok NO SOLUTION

Test #26:

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

input:

676664106 632143236

output:

8
0 0
0 169166026
1 169166026
1 3
124645159 3
124645159 2
169166027 2
169166027 0

result:

ok good plan

Test #27:

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

input:

888393402 19178143

output:

-1

result:

ok NO SOLUTION

Test #28:

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

input:

409352440 130292170

output:

-1

result:

ok NO SOLUTION

Test #29:

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

input:

390499700 267683852

output:

8
0 0
0 97624925
1 97624925
1 2
72434004 2
72434004 1
97624925 1
97624925 0

result:

ok good plan

Test #30:

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

input:

304232966 470743421

output:

8
0 0
0 76058241
1 76058241
1 6
14393976 6
14393976 5
76058242 5
76058242 0

result:

ok good plan

Test #31:

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

input:

748287082 766283467

output:

8
0 0
0 187071770
1 187071770
1 4
17996388 4
17996388 3
187071771 3
187071771 0

result:

ok good plan

Test #32:

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

input:

20018876 381657326

output:

8
0 0
0 5004719
1 5004719
1 76
1298758 76
1298758 75
5004719 75
5004719 0

result:

ok good plan

Test #33:

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

input:

525757814 846189716

output:

8
0 0
0 131439453
1 131439453
1 6
57552999 6
57552999 5
131439454 5
131439454 0

result:

ok good plan

Test #34:

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

input:

713603990 466683797

output:

8
0 0
0 178400997
1 178400997
1 2
109881804 2
109881804 1
178400998 1
178400998 0

result:

ok good plan

Test #35:

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

input:

274030892 438235130

output:

8
0 0
0 68507723
1 68507723
1 6
27188798 6
27188798 5
68507723 5
68507723 0

result:

ok good plan

Test #36:

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

input:

89061264 641898409

output:

8
0 0
0 22265316
1 22265316
1 28
18469589 28
18469589 27
22265316 27
22265316 0

result:

ok good plan

Test #37:

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

input:

531224402 120862474

output:

-1

result:

ok NO SOLUTION

Test #38:

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

input:

773240724 645857013

output:

8
0 0
0 193310181
1 193310181
1 3
65926473 3
65926473 2
193310181 2
193310181 0

result:

ok good plan

Test #39:

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

input:

708598658 620359198

output:

8
0 0
0 177149664
1 177149664
1 3
88910207 3
88910207 2
177149665 2
177149665 0

result:

ok good plan

Test #40:

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

input:

423968720 535749933

output:

8
0 0
0 105992180
1 105992180
1 5
5789038 5
5789038 4
105992180 4
105992180 0

result:

ok good plan

Test #41:

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

input:

530909092 728244562

output:

8
0 0
0 132727273
1 132727273
1 5
64608202 5
64608202 4
132727273 4
132727273 0

result:

ok good plan

Test #42:

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

input:

421139062 273115655

output:

8
0 0
0 105284765
1 105284765
1 2
62546126 2
62546126 1
105284766 1
105284766 0

result:

ok good plan

Test #43:

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

input:

604812834 777566583

output:

8
0 0
0 151203208
1 151203208
1 5
21550544 5
21550544 4
151203209 4
151203209 0

result:

ok good plan

Test #44:

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

input:

687797172 845256343

output:

8
0 0
0 171949293
1 171949293
1 4
157459175 4
157459175 3
171949293 3
171949293 0

result:

ok good plan

Test #45:

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

input:

779271936 373171148

output:

-1

result:

ok NO SOLUTION

Test #46:

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

input:

358898894 178215693

output:

-1

result:

ok NO SOLUTION

Test #47:

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

input:

182138052 729277997

output:

8
0 0
0 45534513
1 45534513
1 16
725805 16
725805 15
45534513 15
45534513 0

result:

ok good plan

Test #48:

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

input:

299640094 747781349

output:

8
0 0
0 74910023
1 74910023
1 9
73591143 9
73591143 8
74910024 8
74910024 0

result:

ok good plan

Test #49:

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

input:

199831800 657838219

output:

8
0 0
0 49957950
1 49957950
1 13
8384882 13
8384882 12
49957950 12
49957950 0

result:

ok good plan

Test #50:

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

input:

801971048 609973980

output:

8
0 0
0 200492762
1 200492762
1 3
8495697 3
8495697 2
200492762 2
200492762 0

result:

ok good plan

Test #51:

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

input:

410125446 499319768

output:

8
0 0
0 102531361
1 102531361
1 4
89194325 4
89194325 3
102531362 3
102531362 0

result:

ok good plan

Test #52:

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

input:

664337258 326232892

output:

-1

result:

ok NO SOLUTION

Test #53:

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

input:

198336320 502993871

output:

8
0 0
0 49584080
1 49584080
1 10
7153081 10
7153081 9
49584080 9
49584080 0

result:

ok good plan

Test #54:

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

input:

770483154 911695281

output:

8
0 0
0 192620788
1 192620788
1 4
141212130 4
141212130 3
192620789 3
192620789 0

result:

ok good plan

Test #55:

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

input:

968522752 905800329

output:

8
0 0
0 242130688
1 242130688
1 3
179408268 3
179408268 2
242130688 2
242130688 0

result:

ok good plan

Test #56:

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

input:

549864526 688851806

output:

8
0 0
0 137466131
1 137466131
1 5
1521152 5
1521152 4
137466132 4
137466132 0

result:

ok good plan

Test #57:

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

input:

694964358 273025751

output:

-1

result:

ok NO SOLUTION

Test #58:

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

input:

755213882 589915763

output:

8
0 0
0 188803470
1 188803470
1 3
23505354 3
23505354 2
188803471 2
188803471 0

result:

ok good plan

Test #59:

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

input:

853008566 261279048

output:

-1

result:

ok NO SOLUTION

Test #60:

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

input:

648529822 825071874

output:

8
0 0
0 162132455
1 162132455
1 5
14409600 5
14409600 4
162132456 4
162132456 0

result:

ok good plan

Test #61:

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

input:

109304282 232982785

output:

8
0 0
0 27326070
1 27326070
1 8
14374226 8
14374226 7
27326071 7
27326071 0

result:

ok good plan

Test #62:

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

input:

869585024 959944584

output:

8
0 0
0 217396256
1 217396256
1 4
90359564 4
90359564 3
217396256 3
217396256 0

result:

ok good plan

Test #63:

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

input:

507663674 88365136

output:

-1

result:

ok NO SOLUTION

Test #64:

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

input:

257793806 90998243

output:

-1

result:

ok NO SOLUTION

Test #65:

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

input:

919393432 666825571

output:

8
0 0
0 229848358
1 229848358
1 2
207128857 2
207128857 1
229848358 1
229848358 0

result:

ok good plan

Test #66:

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

input:

853903384 329850703

output:

-1

result:

ok NO SOLUTION

Test #67:

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

input:

335441670 284253394

output:

8
0 0
0 83860417
1 83860417
1 3
32672144 3
32672144 2
83860418 2
83860418 0

result:

ok good plan

Test #68:

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

input:

24544786 390070009

output:

8
0 0
0 6136196
1 6136196
1 63
3489662 63
3489662 62
6136197 62
6136197 0

result:

ok good plan

Test #69:

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

input:

323614096 699447036

output:

8
0 0
0 80903524
1 80903524
1 8
52218852 8
52218852 7
80903524 7
80903524 0

result:

ok good plan

Test #70:

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

input:

502837028 109125531

output:

-1

result:

ok NO SOLUTION

Test #71:

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

input:

664812904 365409364

output:

8
0 0
0 166203226
1 166203226
1 2
33002914 2
33002914 1
166203226 1
166203226 0

result:

ok good plan

Test #72:

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

input:

514667768 945027774

output:

8
0 0
0 128666942
1 128666942
1 7
44359187 7
44359187 6
128666942 6
128666942 0

result:

ok good plan

Test #73:

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

input:

655380202 337558629

output:

8
0 0
0 163845050
1 163845050
1 2
9868530 2
9868530 1
163845051 1
163845051 0

result:

ok good plan

Test #74:

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

input:

371491572 386802836

output:

8
0 0
0 92872893
1 92872893
1 4
15311268 4
15311268 3
92872893 3
92872893 0

result:

ok good plan

Test #75:

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

input:

370506158 366579356

output:

8
0 0
0 92626539
1 92626539
1 3
88699740 3
88699740 2
92626540 2
92626540 0

result:

ok good plan

Test #76:

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

input:

177655230 841310478

output:

8
0 0
0 44413807
1 44413807
1 18
41861953 18
41861953 17
44413808 17
44413808 0

result:

ok good plan

Test #77:

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

input:

135251342 579650917

output:

8
0 0
0 33812835
1 33812835
1 17
4832723 17
4832723 16
33812836 16
33812836 0

result:

ok good plan

Test #78:

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

input:

707764652 452687293

output:

8
0 0
0 176941163
1 176941163
1 2
98804969 2
98804969 1
176941163 1
176941163 0

result:

ok good plan

Test #79:

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

input:

870115800 430673599

output:

-1

result:

ok NO SOLUTION

Test #80:

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

input:

869686730 712395212

output:

8
0 0
0 217421682
1 217421682
1 3
60130167 3
60130167 2
217421683 2
217421683 0

result:

ok good plan

Test #81:

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

input:

948113264 941600913

output:

8
0 0
0 237028316
1 237028316
1 3
230515968 3
230515968 2
237028316 2
237028316 0

result:

ok good plan

Test #82:

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

input:

395441280 381620213

output:

8
0 0
0 98860320
1 98860320
1 3
85039256 3
85039256 2
98860320 2
98860320 0

result:

ok good plan

Test #83:

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

input:

397094130 636488993

output:

8
0 0
0 99273532
1 99273532
1 6
40847802 6
40847802 5
99273533 5
99273533 0

result:

ok good plan

Test #84:

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

input:

932433740 406519991

output:

-1

result:

ok NO SOLUTION

Test #85:

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

input:

768238442 525193487

output:

8
0 0
0 192059610
1 192059610
1 2
141074268 2
141074268 1
192059611 1
192059611 0

result:

ok good plan

Test #86:

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

input:

659791902 699488585

output:

8
0 0
0 164947975
1 164947975
1 4
39696686 4
39696686 3
164947976 3
164947976 0

result:

ok good plan

Test #87:

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

input:

249244600 310497662

output:

8
0 0
0 62311150
1 62311150
1 4
61253066 4
61253066 3
62311150 3
62311150 0

result:

ok good plan

Test #88:

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

input:

945387452 838174829

output:

8
0 0
0 236346863
1 236346863
1 3
129134243 3
129134243 2
236346863 2
236346863 0

result:

ok good plan

Test #89:

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

input:

365428734 126751007

output:

-1

result:

ok NO SOLUTION

Test #90:

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

input:

371260250 528530702

output:

8
0 0
0 92815062
1 92815062
1 5
64455393 5
64455393 4
92815063 4
92815063 0

result:

ok good plan

Test #91:

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

input:

872462082 360555751

output:

-1

result:

ok NO SOLUTION

Test #92:

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

input:

386375240 895400111

output:

8
0 0
0 96593810
1 96593810
1 9
26055830 9
26055830 8
96593810 8
96593810 0

result:

ok good plan

Test #93:

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

input:

945210142 542830818

output:

8
0 0
0 236302535
1 236302535
1 2
70225749 2
70225749 1
236302536 1
236302536 0

result:

ok good plan

Test #94:

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

input:

62895378 546576937

output:

8
0 0
0 15723844
1 15723844
1 34
11966242 34
11966242 33
15723845 33
15723845 0

result:

ok good plan

Test #95:

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

input:

311830080 660126790

output:

8
0 0
0 77957520
1 77957520
1 8
36466638 8
36466638 7
77957520 7
77957520 0

result:

ok good plan

Test #96:

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

input:

806503838 281477730

output:

-1

result:

ok NO SOLUTION

Test #97:

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

input:

302765796 428469874

output:

8
0 0
0 75691449
1 75691449
1 5
50012634 5
50012634 4
75691449 4
75691449 0

result:

ok good plan

Test #98:

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

input:

33545294 25336837

output:

8
0 0
0 8386323
1 8386323
1 3
177869 3
177869 2
8386324 2
8386324 0

result:

ok good plan

Test #99:

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

input:

879363252 692179827

output:

8
0 0
0 219840813
1 219840813
1 3
32657391 3
32657391 2
219840813 2
219840813 0

result:

ok good plan

Test #100:

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

input:

671000162 234266218

output:

-1

result:

ok NO SOLUTION

Test #101:

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

input:

576003508 153049489

output:

-1

result:

ok NO SOLUTION

Test #102:

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

input:

771313838 730168850

output:

8
0 0
0 192828459
1 192828459
1 3
151683474 3
151683474 2
192828460 2
192828460 0

result:

ok good plan

Test #103:

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

input:

836384904 432562321

output:

8
0 0
0 209096226
1 209096226
1 2
14369871 2
14369871 1
209096226 1
209096226 0

result:

ok good plan

Test #104:

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

input:

60293922 420693205

output:

8
0 0
0 15073480
1 15073480
1 27
13709246 27
13709246 26
15073481 26
15073481 0

result:

ok good plan

Test #105:

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

input:

338984060 404031611

output:

8
0 0
0 84746015
1 84746015
1 4
65047555 4
65047555 3
84746015 3
84746015 0

result:

ok good plan

Test #106:

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

input:

845909332 459008785

output:

8
0 0
0 211477333
1 211477333
1 2
36054121 2
36054121 1
211477333 1
211477333 0

result:

ok good plan

Test #107:

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

input:

801550650 756988125

output:

8
0 0
0 200387662
1 200387662
1 3
155825140 3
155825140 2
200387663 2
200387663 0

result:

ok good plan

Test #108:

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

input:

12239258 74994942

output:

8
0 0
0 3059814
1 3059814
1 24
1559407 24
1559407 23
3059815 23
3059815 0

result:

ok good plan

Test #109:

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

input:

689920978 647138514

output:

8
0 0
0 172480244
1 172480244
1 3
129697783 3
129697783 2
172480245 2
172480245 0

result:

ok good plan

Test #110:

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

input:

184342820 355672159

output:

8
0 0
0 46085705
1 46085705
1 7
33072231 7
33072231 6
46085705 6
46085705 0

result:

ok good plan

Test #111:

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

input:

302283400 155643880

output:

8
0 0
0 75570850
1 75570850
1 2
4502182 2
4502182 1
75570850 1
75570850 0

result:

ok good plan

Test #112:

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

input:

756062228 683554608

output:

8
0 0
0 189015557
1 189015557
1 3
116507940 3
116507940 2
189015557 2
189015557 0

result:

ok good plan

Test #113:

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

input:

291690990 659611467

output:

8
0 0
0 72922747
1 72922747
1 9
3306745 9
3306745 8
72922748 8
72922748 0

result:

ok good plan

Test #114:

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

input:

10173072 225574233

output:

8
0 0
0 2543268
1 2543268
1 88
1766737 88
1766737 87
2543268 87
2543268 0

result:

ok good plan

Test #115:

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

input:

116613708 99788090

output:

8
0 0
0 29153427
1 29153427
1 3
12327812 3
12327812 2
29153427 2
29153427 0

result:

ok good plan

Test #116:

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

input:

413403874 420363396

output:

8
0 0
0 103350968
1 103350968
1 4
6959525 4
6959525 3
103350969 3
103350969 0

result:

ok good plan

Test #117:

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

input:

104922974 68977141

output:

8
0 0
0 26230743
1 26230743
1 2
16515656 2
16515656 1
26230744 1
26230744 0

result:

ok good plan

Test #118:

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

input:

814481846 347162734

output:

-1

result:

ok NO SOLUTION

Test #119:

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

input:

401674718 224548659

output:

8
0 0
0 100418679
1 100418679
1 2
23711302 2
23711302 1
100418680 1
100418680 0

result:

ok good plan

Test #120:

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

input:

406976738 881568779

output:

8
0 0
0 101744184
1 101744184
1 8
67615308 8
67615308 7
101744185 7
101744185 0

result:

ok good plan

Test #121:

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

input:

926980270 622679155

output:

8
0 0
0 231745067
1 231745067
1 2
159189022 2
159189022 1
231745068 1
231745068 0

result:

ok good plan

Test #122:

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

input:

216852084 338679783

output:

8
0 0
0 54213021
1 54213021
1 6
13401663 6
13401663 5
54213021 5
54213021 0

result:

ok good plan

Test #123:

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

input:

610219914 207118079

output:

-1

result:

ok NO SOLUTION

Test #124:

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

input:

328457454 25931709

output:

-1

result:

ok NO SOLUTION

Test #125:

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

input:

915520690 118684974

output:

-1

result:

ok NO SOLUTION

Test #126:

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

input:

568229720 488525085

output:

8
0 0
0 142057430
1 142057430
1 3
62352798 3
62352798 2
142057430 2
142057430 0

result:

ok good plan

Test #127:

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

input:

531827830 685694401

output:

8
0 0
0 132956957
1 132956957
1 5
20909617 5
20909617 4
132956958 4
132956958 0

result:

ok good plan

Test #128:

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

input:

452409802 715329957

output:

8
0 0
0 113102450
1 113102450
1 6
36715258 6
36715258 5
113102451 5
113102451 0

result:

ok good plan

Test #129:

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

input:

739357828 243587585

output:

-1

result:

ok NO SOLUTION

Test #130:

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

input:

909250486 881008890

output:

8
0 0
0 227312621
1 227312621
1 3
199071028 3
199071028 2
227312622 2
227312622 0

result:

ok good plan

Test #131:

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

input:

190124236 623425506

output:

8
0 0
0 47531059
1 47531059
1 13
5521752 13
5521752 12
47531059 12
47531059 0

result:

ok good plan

Test #132:

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

input:

651638822 573089381

output:

8
0 0
0 162909705
1 162909705
1 3
84360267 3
84360267 2
162909706 2
162909706 0

result:

ok good plan

Test #133:

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

input:

118977068 383269885

output:

8
0 0
0 29744267
1 29744267
1 12
26338693 12
26338693 11
29744267 11
29744267 0

result:

ok good plan

Test #134:

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

input:

390751760 878353816

output:

8
0 0
0 97687940
1 97687940
1 8
96850304 8
96850304 7
97687940 7
97687940 0

result:

ok good plan