QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#350546#8208. Beer Circuitsucup-team1198#AC ✓1174ms54324kbC++207.8kb2024-03-10 20:04:242024-03-10 20:04:25

Judging History

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

  • [2024-03-10 20:04:25]
  • 评测
  • 测评结果:AC
  • 用时:1174ms
  • 内存:54324kb
  • [2024-03-10 20:04:24]
  • 提交

answer

#pragma GCC optimize("Ofast,unroll-loops")

#include <map>
#include <set>
#include <array>
#include <cmath>
#include <deque>
#include <bitset>
#include <random>
#include <string>
#include <vector>
#include <cassert>
#include <complex>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;

struct Point{
    long long x, y;
    Point(long long x, long long y): x(x), y(y) {}
    Point(): x(0), y(0) {}
};

Point operator+(const Point& a, const Point& b) {
    return Point(a.x + b.x, a.y + b.y);
}

Point operator-(const Point& a, const Point& b) {
    return Point(a.x - b.x, a.y - b.y);
}

long long cross(const Point& a, const Point& b) {
    return a.x * b.y - a.y * b.x;
}

long long square_len(const Point& P) {
    return P.x * P.x + P.y * P.y;
}

const double EPS = 1e-8;

const int MAXN = 200200;

vector<int> G[MAXN];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int n, k;
    cin >> n >> k;
    vector<Point> A(n);
    for (int i = 0; i < n; ++i)
        cin >> A[i].x >> A[i].y;
    random_shuffle(A.begin(), A.end());

    auto get_triangle_sz = [](const Point& A, const Point& B, const Point& C) {
        return max(square_len(A - B), max(square_len(B - C), square_len(C - A)));
    };

    long long min_d = get_triangle_sz(A[0], A[1], A[2]);
    int total = 0;
    double sz = sqrt(min_d) + EPS;
    vector<int> near;
    map<pair<int, int>, vector<int>> points;
    for (int i = 0; i < n; ++i) {
        int cur_x = floor(A[i].x / sz), cur_y = floor(A[i].y / sz);
        for (int dx = -1; dx <= 1; ++dx) {
            for (int dy = -1; dy <= 1; ++dy) {
                auto tmp = points.find(make_pair(cur_x + dx, cur_y + dy));
                if (tmp != points.end()) {
                    for (int j : tmp->second)
                        near.emplace_back(j);
                }
            }
        }
        long long bbest = min_d;
        int best_cnt = 0;
        for (int j = 0; j < near.size(); ++j) {
            for (int k = j + 1; k < near.size(); ++k) {
                long long cur = get_triangle_sz(A[i], A[near[j]], A[near[k]]);
                if (cur == bbest) {
                    ++best_cnt;
                } else if (cur < bbest) {
                    bbest = cur;
                    best_cnt = 1;
                }
            }
        }
        near.clear();
        if (bbest < min_d) {
            min_d = bbest;
            total = best_cnt;
            sz = sqrt(min_d) + EPS;
            points.clear();
            for (int j = 0; j <= i; ++j) {
                int cur_x = floor(A[j].x / sz), cur_y = floor(A[j].y / sz);
                points[make_pair(cur_x, cur_y)].emplace_back(j);
            }
        } else {
            total += best_cnt;
            points[make_pair(cur_x, cur_y)].emplace_back(i);
        }
    }
    vector<pair<int, int>> edges;
    for (int i = 0; i < n; ++i) {
        int cur_x = floor(A[i].x / sz), cur_y = floor(A[i].y / sz);
        for (int dx = -1; dx <= 1; ++dx) {
            for (int dy = -1; dy <= 1; ++dy) {
                auto tmp = points.find(make_pair(cur_x + dx, cur_y + dy));
                if (tmp != points.end()) {
                    for (int j : tmp->second) {
                        if (j < i && square_len(A[i] - A[j]) < min_d)
                            edges.emplace_back(j, i);
                    }
                }
            }
        }
    }

    long long ans_d = min_d;
    int ans_len = 3;
    long long ans_cnt = total;

    sort(edges.begin(), edges.end(), [&A](const pair<int, int>& a, const pair<int, int>& b) {
        return square_len(A[a.first] - A[a.second]) < square_len(A[b.first] - A[b.second]);
    });
    int m = edges.size();

    vector<vector<pair<int, int>>> all_edges(n);
    for (int i = 0; i < m; ++i) {
        all_edges[edges[i].first].emplace_back(edges[i].second, i);
        all_edges[edges[i].second].emplace_back(edges[i].first, i);   
    }

    int max_tier = k;

    vector<pair<int, int>> dps(m);
    // len, cnt
    // (0, 0) - NONE
    vector<int> dist1(n);
    vector<int> path_cnt1(n);
    vector<int> timer_used1(n, -1);
    vector<int> dist2(n);
    vector<int> path_cnt2(n);
    vector<int> timer_used2(n, -1);
    deque<int> Q;
    vector<int> interesting;
    long long mx_len = ans_d;
    for (int i = 0; i < m; ++i) {
        auto [u, v] = edges[i];
        long long cur_len = square_len(A[u] - A[v]);
        if (cur_len > mx_len)
            break;
        if (dps[i].second) {
            mx_len = cur_len;
            if (cur_len < ans_d) {
                ans_d = cur_len;
                ans_len = dps[i].first;
                max_tier = dps[i].first;
                ans_cnt = dps[i].second;
            } else if (cur_len == ans_d) {
                if (ans_len > dps[i].first) {
                    ans_len = dps[i].first;
                    max_tier = dps[i].first;
                    ans_cnt = dps[i].second;
                } else if (ans_len == dps[i].first) {
                    ans_cnt += dps[i].second;
                }
            }
        }
        G[u].emplace_back(v);
        G[v].emplace_back(u);

        timer_used1[u] = i;
        Q.emplace_back(u);
        dist1[u] = 0;
        path_cnt1[u] = 1;
        while (!Q.empty()) {
            int cur = Q.front();
            interesting.emplace_back(cur);
            Q.pop_front();
            if (dist1[cur] == max_tier - 2)
                continue;
            for (int x : G[cur]) {
                if (timer_used1[x] != i) {
                    timer_used1[x] = i;
                    dist1[x] = dist1[cur] + 1;
                    path_cnt1[x] = path_cnt1[cur];
                    Q.emplace_back(x);
                } else if (dist1[x] == dist1[cur] + 1) {
                    path_cnt1[x] += path_cnt1[cur];
                }
            }
        }

        timer_used2[v] = i;
        Q.emplace_back(v);
        dist2[v] = 0;
        path_cnt2[v] = 1;
        while (!Q.empty()) {
            int cur = Q.front();
            Q.pop_front();
            if (dist2[cur] == max_tier - 2)
                continue;
            for (int x : G[cur]) {
                if (timer_used2[x] != i) {
                    timer_used2[x] = i;
                    dist2[x] = dist2[cur] + 1;
                    path_cnt2[x] = path_cnt2[cur];
                    Q.emplace_back(x);
                } else if (dist2[x] == dist2[cur] + 1) {
                    path_cnt2[x] += path_cnt2[cur];
                }
            }
        }

        sort(interesting.begin(), interesting.end());
        interesting.resize(unique(interesting.begin(), interesting.end()) - interesting.begin());
        for (int a : interesting) {
            for (auto [b, j] : all_edges[a]) {
                if (j <= i)
                    continue;
                if (timer_used2[b] == i) {
                    if (dist1[a] + dist2[b] <= k - 1) {
                        pair<int, int> cur(dist1[a] + dist2[b] + 2, path_cnt1[a] * path_cnt2[b]);
                        //cout << "trying " << a << ' ' << b << ' ' << cur.first << ' ' << cur.second << '\n';
                        if (dps[j].first == 0) {
                            dps[j] = cur;
                        } else if (dps[j].first > cur.first) {
                            dps[j] = cur;
                        } else if (dps[j].first == cur.first)
                            dps[j].second += cur.second;
                    }
                }
            }
        }
        interesting.clear();
    }

    cout << ans_d << '\n' << ans_len << '\n' << ans_cnt * 2 * ans_len << '\n';
    return 0;
}

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

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3632kb

input:

3 3
0 0
2 2
1000000000 1000000000

output:

2000000000000000000
3
6

result:

ok 3 number(s): "2000000000000000000 3 6"

Test #2:

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

input:

8 5
5 5
5 7
7 7
3 7
2 5
8 5
3 4
7 4

output:

5
5
20

result:

ok 3 number(s): "5 5 20"

Test #3:

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

input:

10 5
1 4
4 4
3 8
5 1
6 5
7 1
0 6
2 2
2 1
3 0

output:

5
3
6

result:

ok 3 number(s): "5 3 6"

Test #4:

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

input:

10 5
4 9
3 8
4 8
3 0
1 4
2 0
10 1
9 10
0 10
3 5

output:

2
3
6

result:

ok 3 number(s): "2 3 6"

Test #5:

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

input:

10 5
2 0
5 1
2 7
5 0
1 10
0 7
5 8
7 3
6 2
0 4

output:

5
3
6

result:

ok 3 number(s): "5 3 6"

Test #6:

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

input:

10 5
8 1
3 2
7 3
10 4
4 1
7 6
3 1
7 2
10 0
6 7

output:

2
3
6

result:

ok 3 number(s): "2 3 6"

Test #7:

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

input:

10 5
6 6
9 10
8 3
1 0
3 0
1 1
5 9
4 1
4 6
8 6

output:

5
3
6

result:

ok 3 number(s): "5 3 6"

Test #8:

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

input:

10 5
8 4
0 3
2 3
10 0
3 6
0 4
8 3
8 8
0 2
0 1

output:

4
3
12

result:

ok 3 number(s): "4 3 12"

Test #9:

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

input:

10 5
6 6
5 8
3 6
0 0
2 8
6 8
10 7
1 7
5 7
6 7

output:

1
4
8

result:

ok 3 number(s): "1 4 8"

Test #10:

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

input:

10 5
1 8
7 8
8 6
6 0
9 6
8 10
9 0
5 9
4 2
8 2

output:

8
3
6

result:

ok 3 number(s): "8 3 6"

Test #11:

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

input:

10 5
10 9
1 2
1 9
8 7
8 2
7 2
1 8
9 8
9 7
3 1

output:

2
3
6

result:

ok 3 number(s): "2 3 6"

Test #12:

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

input:

10 5
0 10
6 6
10 8
9 7
0 9
8 3
5 0
7 10
3 2
3 4

output:

13
3
6

result:

ok 3 number(s): "13 3 6"

Test #13:

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

input:

10 5
9 4
5 0
5 4
0 3
6 0
6 6
3 7
2 3
0 1
5 9

output:

8
3
6

result:

ok 3 number(s): "8 3 6"

Test #14:

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

input:

10 5
7 10
6 5
9 3
6 3
4 5
6 4
2 2
7 0
7 4
5 3

output:

2
3
18

result:

ok 3 number(s): "2 3 18"

Test #15:

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

input:

10 5
2 0
5 9
3 3
7 3
5 5
3 0
4 9
0 1
8 2
2 2

output:

5
3
12

result:

ok 3 number(s): "5 3 12"

Test #16:

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

input:

10 5
0 1
3 2
4 10
5 3
1 7
9 0
6 6
0 0
8 0
4 1

output:

5
3
6

result:

ok 3 number(s): "5 3 6"

Test #17:

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

input:

10 5
2 7
1 7
9 10
7 10
0 9
8 7
5 6
8 10
5 2
0 0

output:

4
3
6

result:

ok 3 number(s): "4 3 6"

Test #18:

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

input:

10 5
0 4
3 7
3 3
4 3
10 8
3 5
9 9
9 8
2 10
0 8

output:

2
3
6

result:

ok 3 number(s): "2 3 6"

Test #19:

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

input:

10 5
6 6
9 1
8 6
3 3
6 3
1 1
6 7
5 0
2 7
4 1

output:

5
3
6

result:

ok 3 number(s): "5 3 6"

Test #20:

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

input:

10 5
4 8
3 1
1 5
4 10
0 8
8 5
6 6
6 2
10 0
2 8

output:

8
3
6

result:

ok 3 number(s): "8 3 6"

Test #21:

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

input:

10 5
6 9
5 9
3 5
2 3
1 4
6 7
0 9
2 5
3 7
1 6

output:

4
3
12

result:

ok 3 number(s): "4 3 12"

Test #22:

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

input:

10 5
2 10
9 5
7 7
6 2
7 2
5 9
3 8
7 10
6 0
1 1

output:

5
3
6

result:

ok 3 number(s): "5 3 6"

Test #23:

score: 0
Accepted
time: 811ms
memory: 50548kb

input:

199692 3
500136792 500000000
499931604 500118465
499931604 499881535
500557553 499600008
500352365 499718473
500352365 499481543
500978314 499200016
500773126 499318481
500773126 499081551
501399075 498800024
501193887 498918489
501193887 498681559
501819836 498400032
501614648 498518497
501614648 4...

output:

56136071569
3
399384

result:

ok 3 number(s): "56136071569 3 399384"

Test #24:

score: 0
Accepted
time: 872ms
memory: 52056kb

input:

198916 4
500024820 500000000
500000000 500024820
499975180 500000000
500000000 499975180
500110708 499936963
500085888 499961783
500061068 499936963
500085888 499912143
500196596 499873926
500171776 499898746
500146956 499873926
500171776 499849106
500282484 499810889
500257664 499835709
500232844 4...

output:

1232064800
4
397832

result:

ok 3 number(s): "1232064800 4 397832"

Test #25:

score: 0
Accepted
time: 857ms
memory: 50480kb

input:

200000 5
500243124 500000000
500075129 500231225
499803309 500142905
499803309 499857095
500075129 499768775
500748155 499046283
500580160 499277508
500308340 499189188
500308340 498903378
500580160 498815058
501253186 498092566
501085191 498323791
500813371 498235471
500813371 497949661
501085191 4...

output:

81687356100
5
400000

result:

ok 3 number(s): "81687356100 5 400000"

Test #26:

score: 0
Accepted
time: 799ms
memory: 49440kb

input:

198744 6
500157690 500000000
500078845 500136563
499921155 500136563
499842310 500000000
499921155 499863437
500078845 499863437
500935173 499831340
500856328 499967903
500698638 499967903
500619793 499831340
500698638 499694777
500856328 499694777
501712656 499662680
501633811 499799243
501476121 4...

output:

24866136100
6
397488

result:

ok 3 number(s): "24866136100 6 397488"

Test #27:

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

input:

199927 7
500278028 500000000
500173347 500217371
499938133 500271057
499749505 500120632
499749505 499879368
499938133 499728943
500173347 499782629
501459060 499512861
501354379 499730232
501119165 499783918
500930537 499633493
500930537 499392229
501119165 499241804
501354379 499295490
502640092 4...

output:

58208317696
7
399854

result:

ok 3 number(s): "58208317696 7 399854"

Test #28:

score: 0
Accepted
time: 844ms
memory: 49164kb

input:

199712 8
500197494 500000000
500139649 500139649
500000000 500197494
499860351 500139649
499802506 500000000
499860351 499860351
500000000 499802506
500139649 499860351
501140007 499757547
501082162 499897196
500942513 499955041
500802864 499897196
500745019 499757547
500802864 499617898
500942513 4...

output:

22847887226
8
399424

result:

ok 3 number(s): "22847887226 8 399424"

Test #29:

score: 0
Accepted
time: 870ms
memory: 49000kb

input:

199809 9
500517211 500000000
500396206 500332456
500089812 500509353
499741395 500447918
499513981 500176896
499513981 499823104
499741395 499552082
500089812 499490647
500396206 499667544
502059676 498439198
501938671 498771654
501632277 498948551
501283860 498887116
501056446 498616094
501056446 4...

output:

125170051880
9
399618

result:

ok 3 number(s): "125170051880 9 399618"

Test #30:

score: 0
Accepted
time: 884ms
memory: 48364kb

input:

198810 10
500213830 500000000
500172992 500125686
500066077 500203364
499933923 500203364
499827008 500125686
499786170 500000000
499827008 499874314
499933923 499796636
500066077 499796636
500172992 499874314
500868929 499372119
500828091 499497805
500721176 499575483
500589022 499575483
500482107 ...

output:

17464712840
10
397620

result:

ok 3 number(s): "17464712840 10 397620"

Test #31:

score: 0
Accepted
time: 926ms
memory: 47880kb

input:

197516 11
500355273 500000000
500298874 500192075
500147585 500323167
499949440 500351656
499767346 500268497
499659118 500100092
499659118 499899908
499767346 499731503
499949440 499648344
500147585 499676833
500298874 499807925
501503078 499016166
501446679 499208241
501295390 499339333
501097245 ...

output:

40073652826
11
395032

result:

ok 3 number(s): "40073652826 11 395032"

Test #32:

score: 0
Accepted
time: 934ms
memory: 48552kb

input:

199692 12
500287748 500000000
500249197 500143874
500143874 500249197
500000000 500287748
499856126 500249197
499750803 500143874
499712252 500000000
499750803 499856126
499856126 499750803
500000000 499712252
500143874 499750803
500249197 499856126
501616606 499602368
501578055 499746242
501472732 ...

output:

22185907477
12
399384

result:

ok 3 number(s): "22185907477 12 399384"

Test #33:

score: 0
Accepted
time: 889ms
memory: 48388kb

input:

199888 13
500214891 500000000
500190276 500099864
500122072 500176851
500025902 500213324
499923799 500200926
499839152 500142499
499791354 500051426
499791354 499948574
499839152 499857501
499923799 499799074
500025902 499786676
500122072 499823149
500190276 499900136
500400819 498896581
500376204 ...

output:

10578948629
13
399776

result:

ok 3 number(s): "10578948629 13 399776"

Test #34:

score: 0
Accepted
time: 849ms
memory: 48056kb

input:

198254 14
500466462 500000000
500420268 500202390
500290834 500364695
500103797 500454767
499896203 500454767
499709166 500364695
499579732 500202390
499533538 500000000
499579732 499797610
499709166 499635305
499896203 499545233
500103797 499545233
500290834 499635305
500420268 499797610
501174191 ...

output:

43096073381
14
396508

result:

ok 3 number(s): "43096073381 14 396508"

Test #35:

score: 0
Accepted
time: 835ms
memory: 48060kb

input:

198375 15
500469143 500000000
500428583 500190817
500313918 500348641
500144973 500446181
499950962 500466573
499765429 500406289
499620456 500275755
499541109 500097540
499541109 499902460
499620456 499724245
499765429 499593711
499950962 499533427
500144973 499553819
500313918 499651359
500428583 ...

output:

38056654745
15
396750

result:

ok 3 number(s): "38056654745 15 396750"

Test #36:

score: 0
Accepted
time: 860ms
memory: 47632kb

input:

197136 16
500209439 500000000
500193496 500080148
500148095 500148095
500080148 500193496
500000000 500209439
499919852 500193496
499851905 500148095
499806504 500080148
499790561 500000000
499806504 499919852
499851905 499851905
499919852 499806504
500000000 499790561
500080148 499806504
500148095 ...

output:

6678045610
16
394272

result:

ok 3 number(s): "6678045610 16 394272"

Test #37:

score: 0
Accepted
time: 887ms
memory: 47764kb

input:

198288 17
500145782 500000000
500135938 500052662
500107734 500098213
500064980 500130499
500013451 500145160
499960105 500140217
499912147 500116336
499876054 500076744
499856700 500026787
499856700 499973213
499876054 499923256
499912147 499883664
499960105 499859783
500013451 499854840
500064980 ...

output:

2870359217
17
396576

result:

ok 3 number(s): "2870359217 17 396576"

Test #38:

score: 0
Accepted
time: 856ms
memory: 47852kb

input:

198450 18
500408063 500000000
500383453 500139565
500312594 500262297
500204031 500353392
500070859 500401863
499929141 500401863
499795969 500353392
499687406 500262297
499616547 500139565
499591937 500000000
499616547 499860435
499687406 499737703
499795969 499646608
499929141 499598137
500070859 ...

output:

20084223994
18
396900

result:

ok 3 number(s): "20084223994 18 396900"

Test #39:

score: 0
Accepted
time: 879ms
memory: 47856kb

input:

197676 19
500266376 500000000
500251943 500086492
500210208 500163612
500145694 500223001
500065391 500258225
499978003 500265467
499892998 500243940
499819588 500195979
499765729 500126781
499737257 500043844
499737257 499956156
499765729 499873219
499819588 499804021
499892998 499756060
499978003 ...

output:

7689304625
19
395352

result:

ok 3 number(s): "7689304625 19 395352"

Test #40:

score: 0
Accepted
time: 871ms
memory: 48280kb

input:

200000 20
500471804 500000000
500448712 500145795
500381697 500277319
500277319 500381697
500145795 500448712
500000000 500471804
499854205 500448712
499722681 500381697
499618303 500277319
499551288 500145795
499528196 500000000
499551288 499854205
499618303 499722681
499722681 499618303
499854205 ...

output:

21789572801
20
400000

result:

ok 3 number(s): "21789572801 20 400000"

Test #41:

score: 0
Accepted
time: 870ms
memory: 47652kb

input:

196830 30
500478309 500000000
500467856 500099446
500436957 500194545
500386960 500281142
500320051 500355452
500239154 500414227
500147805 500454898
500049996 500475688
499950004 500475688
499852195 500454898
499760846 500414227
499679949 500355452
499613040 500281142
499563043 500194545
499532144 ...

output:

9998825234
30
393660

result:

ok 3 number(s): "9998825234 30 393660"

Test #42:

score: 0
Accepted
time: 762ms
memory: 47732kb

input:

199980 30
187518 500000000
187501 500001125
184276 500015254
183803 500016275
175109 500027870
174262 500028610
161604 500035667
160529 500035999
146095 500037298
144978 500037163
131264 500032479
130298 500031901
119674 500022044
119027 500021124
113332 500007797
113114 500006693
113332 499992203
1...

output:

210044785
30
120

result:

ok 3 number(s): "210044785 30 120"

Test #43:

score: 0
Accepted
time: 791ms
memory: 46992kb

input:

199976 28
175020 500000000
175004 500001050
171554 500015188
171084 500016127
161841 500027367
161010 500028010
147805 500034126
146778 500034345
132227 500034126
131207 500033877
118191 500027367
117380 500026700
108478 500015188
108037 500014235
105012 500000000
105028 499998950
108478 499984812
1...

output:

211796356
28
399952

result:

ok 3 number(s): "211796356 28 399952"

Test #44:

score: 0
Accepted
time: 798ms
memory: 46636kb

input:

199992 26
162506 500000000
162491 500000975
158783 500015104
158317 500015960
148468 500026748
147657 500027290
133923 500032264
132953 500032367
118480 500030389
117574 500030030
105678 500021552
105042 500020813
98448 500007778
98229 500006828
98448 499992222
98696 499991279
105678 499978448
10633...

output:

213392061
26
399984

result:

ok 3 number(s): "213392061 26 399984"

Test #45:

score: 0
Accepted
time: 209ms
memory: 15736kb

input:

49729 30
500000000 500000000
500753821 498954062
501507642 497908124
502261463 496862186
503015284 495816248
503769105 494770310
504522926 493724372
505276747 492678434
506030568 491632496
506784389 490586558
507538210 489540620
508292031 488494682
509045852 487448744
509799673 486402806
510553494 4...

output:

1662232399885
4
394272

result:

ok 3 number(s): "1662232399885 4 394272"

Test #46:

score: 0
Accepted
time: 494ms
memory: 28324kb

input:

99856 30
500000000 500000000
500777497 499969354
501554994 499938708
502332491 499908062
503109988 499877416
503887485 499846770
504664982 499816124
505442479 499785478
506219976 499754832
506997473 499724186
507774970 499693540
508552467 499662894
509329964 499632248
510107461 499601602
510884958 4...

output:

605440762325
4
793800

result:

ok 3 number(s): "605440762325 4 793800"

Test #47:

score: 0
Accepted
time: 1174ms
memory: 53484kb

input:

199809 30
500000000 500000000
500139442 499563552
500278884 499127104
500418326 498690656
500557768 498254208
500697210 497817760
500836652 497381312
500976094 496944864
501115536 496508416
501254978 496071968
501394420 495635520
501533862 495199072
501673304 494762624
501812746 494326176
501952188 ...

output:

209930928068
4
1591328

result:

ok 3 number(s): "209930928068 4 1591328"

Test #48:

score: 0
Accepted
time: 1158ms
memory: 54324kb

input:

199809 30
500000000 500000000
500184735 499643289
500369470 499286578
500554205 498929867
500738940 498573156
500923675 498216445
501108410 497859734
501293145 497503023
501477880 497146312
501662615 496789601
501847350 496432890
502032085 496076179
502216820 495719468
502401555 495362757
502586290 ...

output:

161369757746
4
1591328

result:

ok 3 number(s): "161369757746 4 1591328"

Test #49:

score: 0
Accepted
time: 183ms
memory: 15872kb

input:

49729 30
500000000 500000000
500430450 500105515
500773132 499824464
501203582 499929979
501546264 499648928
501976714 499754443
502319396 499473392
502749846 499578907
503092528 499297856
503522978 499403371
503865660 499122320
504296110 499227835
504638792 498946784
505069242 499052299
505411924 4...

output:

196420617725
3
591408

result:

ok 3 number(s): "196420617725 3 591408"

Test #50:

score: 0
Accepted
time: 419ms
memory: 28460kb

input:

99856 30
500000000 500000000
500527456 500187113
500993620 499877416
501521076 500064529
501987240 499754832
502514696 499941945
502980860 499632248
503508316 499819361
503974480 499509664
504501936 499696777
504968100 499387080
505495556 499574193
505961720 499264496
506489176 499451609
506955340 4...

output:

313221106705
3
1190700

result:

ok 3 number(s): "313221106705 3 1190700"

Test #51:

score: 0
Accepted
time: 1141ms
memory: 53416kb

input:

199809 30
500000000 500000000
500395973 499905264
500557768 499531644
500953741 499436908
501115536 499063288
501511509 498968552
501673304 498594932
502069277 498500196
502231072 498126576
502627045 498031840
502788840 497658220
503184813 497563484
503346608 497189864
503742581 497095128
503904376 ...

output:

165769526425
3
2386992

result:

ok 3 number(s): "165769526425 3 2386992"

Test #52:

score: 0
Accepted
time: 1145ms
memory: 53432kb

input:

199809 30
500000000 500000000
500448002 500027671
500738940 499685872
501186942 499713543
501477880 499371744
501925882 499399415
502216820 499057616
502664822 499085287
502955760 498743488
503403762 498771159
503694700 498429360
504142702 498457031
504433640 498115232
504881642 498142903
505172580 ...

output:

201471476245
3
2386992

result:

ok 3 number(s): "201471476245 3 2386992"

Test #53:

score: 0
Accepted
time: 153ms
memory: 13080kb

input:

50000 30
373962205 151492771
195673060 584347290
753109469 337425829
199326482 160748207
55829410 188275250
683223810 484611038
888033895 710558504
678810676 960495394
865708356 935216074
344029733 778882325
875218676 97077775
574641504 619031772
288416649 526490984
29026787 172594044
683554707 6742...

output:

68870770226
3
6

result:

ok 3 number(s): "68870770226 3 6"

Test #54:

score: 0
Accepted
time: 380ms
memory: 22504kb

input:

100000 30
560211568 49850603
350124505 81049550
837774253 503517546
810383503 243527562
954385037 720668282
307789064 125442870
689769438 30540772
809231519 835835676
473336074 63215053
76644231 765953482
850296989 831237981
654455969 553650662
309669168 202359709
344991115 377069601
201053142 60144...

output:

26770842909
3
6

result:

ok 3 number(s): "26770842909 3 6"

Test #55:

score: 0
Accepted
time: 1102ms
memory: 39372kb

input:

200000 30
804081614 556427635
423073344 83918195
246124723 752311319
803982158 426082742
83377163 588438190
730695312 544465607
537870092 563911105
389009215 886992846
770952565 656491214
89832060 508504971
866475386 617485708
388392144 534946943
136000138 353991853
85529297 42110147
375334362 84124...

output:

4670173649
3
6

result:

ok 3 number(s): "4670173649 3 6"

Test #56:

score: 0
Accepted
time: 931ms
memory: 41340kb

input:

200000 30
686371503 988714815
422143373 396402760
640064285 279813909
941214233 59467731
636647656 832308236
237272344 322447154
540738736 45890504
711431916 544155012
732169380 195548756
957601970 5040146
990530832 875651779
921762478 114724638
482124600 356641052
678805458 718861489
117885850 8574...

output:

15214029736
3
6

result:

ok 3 number(s): "15214029736 3 6"

Test #57:

score: 0
Accepted
time: 1029ms
memory: 41796kb

input:

200000 30
863628685 126034701
52617181 118952742
665407626 470880011
857107945 282787304
484885440 781210990
38816668 395395993
838574672 454240975
255192980 832720959
914724560 398169810
530404586 427946395
778149788 355156213
823729030 399535042
828249062 727886472
977114327 27016610
229033558 463...

output:

19016140130
3
6

result:

ok 3 number(s): "19016140130 3 6"

Test #58:

score: 0
Accepted
time: 756ms
memory: 40156kb

input:

200000 30
40885865 263354589
93156407 136470016
59347187 998382602
699372728 916172294
333123225 25081036
545393700 878410248
62781679 936220374
577615681 826319614
465875958 937227353
398174494 924481572
197172525 908289576
725695582 979312738
879406232 394099182
275423196 335171732
266552339 47971...

output:

8514591093
3
6

result:

ok 3 number(s): "8514591093 3 6"

Test #59:

score: 0
Accepted
time: 847ms
memory: 40064kb

input:

200000 30
218143046 695641768
92226436 227616217
748254040 820852484
910233731 844524575
591426426 563918374
346938024 582762867
65650324 49603552
121376745 114885560
648431138 844881116
265944402 715984040
616195262 461422937
627662135 264123141
930563402 691715673
868699357 716955782
377700047 127...

output:

6352889338
3
6

result:

ok 3 number(s): "6352889338 3 6"

Test #60:

score: 0
Accepted
time: 887ms
memory: 41304kb

input:

200000 30
100432935 169398143
722700245 245133491
773597382 716951293
752498515 67844147
439664211 512821128
148482347 360744414
363486260 531582952
443799446 403451507
199582536 678905950
543779727 138890287
740250708 645960080
161032467 212497057
276687863 357928383
167008225 320078195
193880463 1...

output:

13958938825
3
6

result:

ok 3 number(s): "13958938825 3 6"

Test #61:

score: 0
Accepted
time: 903ms
memory: 40552kb

input:

200000 30
572657408 306718031
426802982 967683473
167536942 244453883
299796006 701229137
287901995 756691174
581430452 433693252
661322196 308529642
987560511 692017454
87170424 881527004
411549635 340458172
527869664 904126151
62999019 497307461
622812325 729173803
760284386 333266025
231399244 15...

output:

10140163945
3
6

result:

ok 3 number(s): "10140163945 3 6"

Test #62:

score: 0
Accepted
time: 979ms
memory: 39496kb

input:

200000 30
454947297 739005210
57276791 985200747
266509212 66923765
805624301 998177638
841172489 295528512
382974776 916707508
664190841 421912821
236354283 349179620
974758312 715551838
984352252 131960640
946892402 457259513
964965573 77085156
673969495 26790293
763625963 10017366
342546952 47079...

output:

4797645833
3
6

result:

ok 3 number(s): "4797645833 3 6"

Extra Test:

score: 0
Extra Test Passed