QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#615916#9440. Train Seatsucup-team4435#WA 2789ms22752kbC++209.6kb2024-10-05 20:56:342024-10-05 20:56:35

Judging History

This is the latest submission verdict.

  • [2024-10-05 20:56:35]
  • Judged
  • Verdict: WA
  • Time: 2789ms
  • Memory: 22752kb
  • [2024-10-05 20:56:34]
  • Submitted

answer

#pragma GCC optimize("Ofast")

#include "bits/stdc++.h"

#ifdef LOCAL
    #include "debug.h"
#else
    #define dbg(...)
    #define dprint(...)
    #define debug if constexpr (false)
    #define draw_tree(...)
    #define draw_array(...)
#endif // LOCAL

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
#define rep1n(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = (n) - 1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define each(x, a) for (auto &x : a)
#define ar array
#define vec vector
#define range(i, n) rep(i, n)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using str = string;
using pi = pair<int, int>;
using pl = pair<ll, ll>;

using vi = vector<int>;
using vl = vector<ll>;
using vpi = vector<pair<int, int>>;
using vvi = vector<vi>;

int Bit(int mask, int b) { return (mask >> b) & 1; }

template<class T>
bool ckmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool ckmax(T &a, const T &b) {
    if (b > a) {
        a = b;
        return true;
    }
    return false;
}


const ll INF = 2e18;
const int INFi = 1e9;
const int N = 2e5 + 50;
const int LG = 20;

template<typename T>
int normalize(T value, int mod) {
    if (value < -mod || value >= 2 * mod) value %= mod;
    if (value < 0) value += mod;
    if (value >= mod) value -= mod;
    return value;
}

template<int mod>
struct static_modular_int {
    using mint = static_modular_int<mod>;

    int value;

    static_modular_int() : value(0) {}

    static_modular_int(const mint &x) : value(x.value) {}

    template<typename T, typename U = std::enable_if_t<std::is_integral<T>::value>>
    static_modular_int(T value) : value(normalize(value, mod)) {}

    template<typename T>
    mint power(T degree) const {
        degree = normalize(degree, mod - 1);
        mint prod = 1, a = *this;
        for (; degree > 0; degree >>= 1, a *= a)
            if (degree & 1)
                prod *= a;

        return prod;
    }

    mint inv() const {
        return power(-1);
    }

    mint &operator=(const mint &x) {
        value = x.value;
        return *this;
    }

    mint &operator+=(const mint &x) {
        value += x.value;
        if (value >= mod) value -= mod;
        return *this;
    }

    mint &operator-=(const mint &x) {
        value -= x.value;
        if (value < 0) value += mod;
        return *this;
    }

    mint &operator*=(const mint &x) {
        value = int64_t(value) * x.value % mod;
        return *this;
    }

    mint &operator/=(const mint &x) {
        return *this *= x.inv();
    }

    friend mint operator+(const mint &x, const mint &y) {
        return mint(x) += y;
    }

    friend mint operator-(const mint &x, const mint &y) {
        return mint(x) -= y;
    }

    friend mint operator*(const mint &x, const mint &y) {
        return mint(x) *= y;
    }

    friend mint operator/(const mint &x, const mint &y) {
        return mint(x) /= y;
    }

    mint &operator++() {
        ++value;
        if (value == mod) value = 0;
        return *this;
    }

    mint &operator--() {
        --value;
        if (value == -1) value = mod - 1;
        return *this;
    }

    mint operator++(int) {
        mint prev = *this;
        value++;
        if (value == mod) value = 0;
        return prev;
    }

    mint operator--(int) {
        mint prev = *this;
        value--;
        if (value == -1) value = mod - 1;
        return prev;
    }

    mint operator-() const {
        return mint(0) - *this;
    }

    bool operator==(const mint &x) const {
        return value == x.value;
    }

    bool operator!=(const mint &x) const {
        return value != x.value;
    }

    bool operator<(const mint &x) const {
        return value < x.value;
    }

    template<typename T>
    explicit operator T() {
        return value;
    }

    friend std::istream &operator>>(std::istream &in, mint &x) {
        std::string s;
        in >> s;
        x = 0;
        for (const auto c: s)
            x = x * 10 + (c - '0');

        return in;
    }

    friend std::ostream &operator<<(std::ostream &out, const mint &x) {
        return out << x.value;
    }

    static int primitive_root() {
        if constexpr (mod == 1'000'000'007) return 5;
        if constexpr (mod == 998'244'353) return 3;
        if constexpr (mod == 786433) return 10;

        static int root = -1;
        if (root != -1)
            return root;

        std::vector<int> primes;
        int value = mod - 1;
        for (int i = 2; i * i <= value; i++)
            if (value % i == 0) {
                primes.push_back(i);
                while (value % i == 0)
                    value /= i;
            }

        if (value != 1) primes.push_back(value);
        for (int r = 2;; r++) {
            bool ok = true;
            for (auto p: primes) {
                if ((mint(r).power((mod - 1) / p)).value == 1) {
                    ok = false;
                    break;
                }
            }
            if (ok) return root = r;
        }
    }
};

constexpr int MOD = 1'000'000'009;
// constexpr int MOD = 998'244'353;
using mint = static_modular_int<MOD>;

struct Group {
    ll sum;
    ll val;
    int l, cnt;
};

bool operator<(const Group &a, const Group &b) {
    ll v = a.sum * b.cnt - b.sum * a.cnt;
    if (v != 0) return v < 0;
    return make_pair(a.l, a.val) < make_pair(b.l, b.val);
}

bool operator==(const Group &a, const Group &b) {
    return a.sum == b.sum && a.l == b.l && a.cnt == b.cnt && b.val == a.val;
}

Group Merge(const Group &a, const Group &b) {
    Group c;
    c.l = min(a.l, b.l);
    c.cnt = a.cnt + b.cnt;
    c.val = a.val + b.val + b.sum * a.cnt;
    c.sum = 1ll * a.sum + b.sum;
    return c;
}

void solve() {
    int n;
    ll m;
    cin >> n >> m;
    vl b(n + 1);
    {
        vi a(n);
        rep(i, n) cin >> a[i];
        sort(all(a));
        b[0] = a[0];
        b[n] = m + 1 - a[n - 1];
        for (int i = 1; i < n; ++i) {
            b[i] = a[i] - a[i - 1];
        }
        n++;
    }

    vector<bool> solved(n - 1);
    vector<ll> prec(n - 1);
    
    auto calc = [&](int i) -> ll {
        if (solved[i]) {
            return prec[i];
        }
        assert(0 <= i && i + 1 < n);
        vector<Group> val(n);
        rep(j, n) {
            val[j].l = j;
            val[j].cnt = 1;
            val[j].sum = b[j];
            val[j].val = b[j];
        }
        val[i].sum += b[i + 1];
        val[i].val = val[i].sum;
        priority_queue<Group> pq;
        rep(j, n) {
            if (i == j || j == i + 1) continue;
            pq.push(val[j]);
        }
        vector<bool> alive(n, true);
        while (!pq.empty()) {
            auto g = pq.top();
            pq.pop();
            if (val[g.l] != g || !alive[g.l]) {
                continue;
            }
            if (g.l < i) {
                int to = g.l + g.cnt;
                if (to == val[i].l) {
                    alive[g.l] = false;
                    val[i] = Merge(g, val[i]);
                    continue;
                }
                assert(alive[to]);
                val[g.l] = Merge(g, val[to]);
                alive[to] = false;
                pq.push(val[g.l]);
                assert(val[g.l].l == g.l);
                continue;
            }
            if (g.l > i + 1) {
                int to = g.l - g.cnt;
                if (to == val[i].l + val[i].cnt) {
                    alive[g.l] = false;
                    val[i] = Merge(g, val[i]);
                    continue;
                }
                assert(alive[to]);
                auto nw = Merge(g, val[to]);
                nw.l = g.l;
                val[g.l] = nw;
                alive[to] = false;
                pq.push(val[g.l]);
                assert(val[g.l].l == g.l);
                continue;
            }
            assert(0);
        }
        assert(val[i].cnt == n - 1);
        solved[i] = true;
        return prec[i] = val[i].val;
    };

    // debug {
    //     for (int i = 0; i < n - 1; i++) {
    //         cerr << calc(i) << '\n';
    //     }
    // }

    ll ans = -1e18;
    int who = -1;

    auto update = [&](int i) {
        ll now = calc(i);
        if (now > ans) {
            ans = now;
            who = i;
        }
    };

    for (int i = 0; i < n - 1; i++) {
        if (min(i, n - i) <= 10) {
            update(i);
        }
    }

    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    while (double(clock()) / CLOCKS_PER_SEC < 1.5) {
        update(rng() % (n - 1));
    }

    int pos = who;
    for (int d = 0; d < n && double(clock()) / CLOCKS_PER_SEC < 2.8; d++) {
        if (pos - d >= 0) {
            update(pos - d);
        }
        if (pos + d < n - 1) {
            update(pos + d);
        }
    }

    // auto flex = [&](int left, int right) {
    //     while (right - left >= 3) {
    //         int mid1 = (2 * left + right) / 3;
    //     }
    // };

    cout << ans << '\n';
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
//    cin >> t;
    rep(i, t) {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 539ms
memory: 3572kb

input:

3 10
3 7 10

output:

28

result:

ok "28"

Test #2:

score: 0
Accepted
time: 614ms
memory: 3692kb

input:

5 20
3 10 11 14 17

output:

73

result:

ok "73"

Test #3:

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

input:

10 1000000000
136909656 243332691 643531997 505919307 43553384 657638276 57213246 179732866 357373203 182482400

output:

7649951260

result:

ok "7649951260"

Test #4:

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

input:

1 172024959
118390965

output:

172024960

result:

ok "172024960"

Test #5:

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

input:

2 920065252
24963998 580538879

output:

1815166508

result:

ok "1815166508"

Test #6:

score: 0
Accepted
time: 578ms
memory: 3700kb

input:

3 172078788
90217996 89200357 170380183

output:

432676968

result:

ok "432676968"

Test #7:

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

input:

4 440425711
125318960 91140311 293637977 102491554

output:

1442752023

result:

ok "1442752023"

Test #8:

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

input:

5 322827483
22471802 47973794 3707067 27640905 273307033

output:

1512343852

result:

ok "1512343852"

Test #9:

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

input:

72 630313504
112329946 338670434 45608233 444381955 513206139 543955969 420916952 485920423 598657953 568525637 92887514 375155749 230002387 302266710 539300386 433464422 380969627 445990156 239073197 278937451 50602251 494375406 139348725 11780176 601670777 68418714 591190755 96719555 612628609 778...

output:

25015466409

result:

ok "25015466409"

Test #10:

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

input:

329 622872382
466743684 193969647 525632934 606824701 316078927 438757174 233370039 439667269 218116839 576709355 236207004 276080894 134588177 219271021 277834775 122503124 362333426 562156413 239350876 305538683 46542992 134113566 544875762 187990348 238185200 108286882 14195584 72219185 201093220...

output:

112658144244

result:

ok "112658144244"

Test #11:

score: 0
Accepted
time: 644ms
memory: 3676kb

input:

466 548717850
137350238 67864907 220098233 250261453 342576815 243581822 338228115 183596199 528465164 359278993 293047272 123476508 56052861 140575524 199877484 444249401 72918904 385030174 254594713 77408477 394580770 516234 43634181 69922431 242790597 404250987 350299611 241437643 498603545 12825...

output:

131683312409

result:

ok "131683312409"

Test #12:

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

input:

420 654188648
643476053 366651301 14641834 645843832 522679034 389570065 308006504 72798889 117904764 201972939 507593839 583514089 220780103 413532099 317370571 41515071 21273376 376539882 192798942 426200421 315080562 508007200 611512672 349756948 8346865 179096792 640192856 199017246 126783463 84...

output:

145704451100

result:

ok "145704451100"

Test #13:

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

input:

311 718955427
120599142 231915699 197402685 379093840 587232561 190030463 189278508 87227087 511068641 683198896 398599791 333700658 509210465 251205035 303752755 62480921 208610800 643685861 131513443 704144110 164086927 668251098 187784010 663686098 682516316 68679577 218094403 163030528 178960994...

output:

115142113813

result:

ok "115142113813"

Test #14:

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

input:

56 56
12 48 49 18 4 31 33 38 54 9 53 43 5 23 6 22 47 28 29 36 44 27 50 37 7 25 45 32 11 16 21 15 13 39 14 52 24 34 55 40 20 10 1 35 56 41 19 8 26 30 2 46 3 42 51 17

output:

1652

result:

ok "1652"

Test #15:

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

input:

292 292
64 2 85 65 241 135 29 289 176 34 91 286 42 126 118 92 113 169 200 52 245 9 63 229 15 121 111 190 95 1 78 261 161 224 186 131 149 61 110 177 246 94 221 168 163 141 96 54 155 174 27 237 90 49 272 98 265 122 21 139 228 130 36 12 219 218 258 43 140 222 178 226 51 213 86 194 284 253 62 87 107 23 ...

output:

43070

result:

ok "43070"

Test #16:

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

input:

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

output:

77

result:

ok "77"

Test #17:

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

input:

500 347765135
260493149 25067597 113008832 218516117 56280657 113832119 157268299 330659722 46366527 283273476 225920745 100653375 280745153 292760144 264522189 10282705 52285293 218967533 224892436 92109113 34627737 111139309 255293918 237984629 30990945 328245143 305557032 190718018 11077534 49562...

output:

90441214154

result:

ok "90441214154"

Test #18:

score: 0
Accepted
time: 592ms
memory: 3620kb

input:

500 301750678
276696486 240287710 59135957 203931095 121878437 201932396 119903481 266343627 299466442 29020479 62156629 287057498 236841236 63227599 176195109 143276865 224442819 28959551 267437933 81076858 219733081 269874799 158211607 118629155 94604655 3369831 80540184 49133180 134099302 2299975...

output:

79145246079

result:

ok "79145246079"

Test #19:

score: 0
Accepted
time: 608ms
memory: 3700kb

input:

500 769039012
593481099 47213811 725289908 357593680 269699082 164340753 172703981 688500832 493990088 262289974 204519272 635799158 331303116 247500823 405748889 394512278 272667146 450405422 198279142 642469694 551828186 137495279 125088488 484290075 527122296 634529483 226941356 633400406 3037120...

output:

199483493522

result:

ok "199483493522"

Test #20:

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

input:

500 17243356
4274345 7159636 16001714 5999929 7882069 3863904 8403308 6277018 2113728 16415881 10604344 13348172 13185843 5885601 782788 11403901 4676051 15968455 6831226 9470810 1753743 3472425 4971780 2909875 682610 10262226 2302856 13712204 13418586 8788713 4152278 207883 15901198 9675943 2756881...

output:

4460790428

result:

ok "4460790428"

Test #21:

score: 0
Accepted
time: 642ms
memory: 3680kb

input:

500 558437765
337125873 51347917 529146027 97202740 316090725 497387777 91930764 142324891 213899399 300360595 217018886 166008137 278239234 390780371 40066095 528572067 478181022 316167534 6880776 541827838 518099198 288097089 347164357 238053014 158325454 130726655 292865844 167013716 407014258 47...

output:

142685591676

result:

ok "142685591676"

Test #22:

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

input:

2814 48592630
16511977 39190822 15371231 44199295 13875763 5979234 44459422 34488266 24890518 32006062 18847062 18614807 46663766 39611882 46277006 2340370 41098927 9775227 19526835 4149963 40975662 39987244 29391972 37292663 33830653 42775184 2698281 16075948 15127541 38689879 31070554 41646403 233...

output:

70807645840

result:

ok "70807645840"

Test #23:

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

input:

2052 350095117
203579427 38369113 288330260 37534723 344776523 200360887 327579695 101907902 126659643 103985677 324854168 147450628 320056313 127038766 180892787 78841178 180152606 179893111 87831533 77845834 95798192 291304099 265697769 293531694 122371620 314146836 68374267 276556448 68280635 820...

output:

370125467171

result:

ok "370125467171"

Test #24:

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

input:

1469 255290094
231124406 18714876 85064516 20024565 179469665 150821978 201135927 141805103 232629049 43708592 2539705 51456309 219260250 224324967 28043751 89384614 216927478 25335658 139761855 31817838 160443531 64678209 158095290 44400339 90818688 159767760 130804982 110658789 126330339 8141312 1...

output:

194714283585

result:

ok "194714283585"

Test #25:

score: 0
Accepted
time: 607ms
memory: 3696kb

input:

630 616939669
408782869 248515354 143307241 231934126 370874608 88715805 340086647 216515214 256581727 562593823 40500538 406750476 395927064 485455822 585447257 563193680 460691661 438303133 88948694 492371629 74016447 50330908 136326604 450167882 306959412 353931524 553814973 42315719 348705693 21...

output:

200801304164

result:

ok "200801304164"

Test #26:

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

input:

2619 192078454
58059164 150718520 31723650 85996292 168050293 1245267 161268788 144992340 1769700 148212777 150126107 178409609 46707895 152390448 11364945 131003460 105302051 133594996 17683695 165826229 118954991 9573925 15262066 141461141 40208877 163950812 112422045 77864539 127930840 139571739 ...

output:

256886227046

result:

ok "256886227046"

Test #27:

score: 0
Accepted
time: 1052ms
memory: 4076kb

input:

2785 2785
2228 986 299 1148 566 2499 221 1006 2695 1277 1329 2729 662 911 2238 1367 429 2302 1307 2671 2430 2025 1463 2401 2765 805 634 1471 2209 506 2051 1854 84 774 28 1414 1791 2272 1086 1155 425 2716 326 1280 380 462 1674 201 1398 1102 943 1516 1379 1981 501 74 1394 1473 2460 12 1120 2231 2004 2...

output:

3882290

result:

ok "3882290"

Test #28:

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

input:

2994 2994
621 2646 1318 1753 1780 2481 2777 986 373 2620 179 2760 2009 2443 2785 1286 1751 2516 2860 1099 1897 2117 1255 2666 518 1795 2669 2936 2672 406 2752 2825 2527 2088 2206 388 1291 907 539 660 1654 1221 1749 112 435 1763 225 2892 2957 2749 1449 487 2272 26 1190 65 2053 727 1575 2984 2824 1999...

output:

4486509

result:

ok "4486509"

Test #29:

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

input:

2852 2852
1395 298 497 21 1344 554 2350 1081 2431 239 2618 1751 1209 2192 941 1391 2571 1150 745 2477 1308 2832 2540 1293 2174 1420 348 2383 665 1073 1421 779 2648 419 2784 2684 140 2443 188 2481 1168 1717 2133 1246 2286 631 36 2550 573 2419 173 720 260 2766 2148 1752 1517 1541 2845 1175 1784 855 23...

output:

4071230

result:

ok "4071230"

Test #30:

score: 0
Accepted
time: 664ms
memory: 3960kb

input:

1580 1580
514 623 529 580 422 972 1272 653 663 1487 273 768 1115 32 1307 955 183 255 189 1351 1484 1531 769 1407 1415 643 1305 618 1151 862 710 368 1155 337 633 1393 709 408 105 967 1382 538 593 1217 423 411 809 1359 752 634 838 518 499 1446 173 560 1404 1185 496 332 1149 308 1093 339 543 943 935 57...

output:

1250570

result:

ok "1250570"

Test #31:

score: 0
Accepted
time: 716ms
memory: 3688kb

input:

1503 1503
946 1196 1233 837 1006 922 643 240 353 1401 806 1095 1033 1262 1224 1489 206 435 659 1434 597 467 186 827 480 370 1392 938 399 1282 1279 784 159 892 1346 147 841 918 291 179 800 1157 1219 933 1208 56 1060 401 1470 590 902 749 1024 932 351 292 410 891 1471 1246 377 1452 505 1152 204 867 394...

output:

1131759

result:

ok "1131759"

Test #32:

score: 0
Accepted
time: 1625ms
memory: 3940kb

input:

3000 427939909
395783930 44089616 259830823 129686735 177460303 393334746 354335948 108616854 254651510 149426746 25596840 284376533 388904805 349010532 122189406 82357545 105555998 185363803 206894621 302592323 127836987 361608374 307482395 325538028 353393412 264670570 61358069 157231515 242862907...

output:

660355238551

result:

ok "660355238551"

Test #33:

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

input:

3000 91550048
28702709 4524831 90599407 73637433 30083293 27295118 3686573 17290403 70504811 17068458 36955403 74000993 33946704 31568496 21102992 60054372 50895890 86513760 21410736 45227468 40803014 87843204 4098854 19621644 29496554 41994490 70749667 54653233 4962828 82527016 64390726 91385906 37...

output:

141727072725

result:

ok "141727072725"

Test #34:

score: 0
Accepted
time: 1631ms
memory: 4064kb

input:

3000 690943590
155567311 654690544 391505748 96431566 142447857 605308077 21725534 107818002 327836389 459093331 663442759 128138289 638499436 100007848 580998397 141573702 155305873 690735787 479359122 80471892 62829607 163903295 18430136 195301585 231002740 678326245 429208602 80184947 129435107 2...

output:

1057845234335

result:

ok "1057845234335"

Test #35:

score: 0
Accepted
time: 1621ms
memory: 4112kb

input:

3000 401140982
238551737 167321280 283540549 347216637 5774145 268791833 84809226 53641114 252192909 42063769 396334785 172329955 300770949 185494230 99653287 109110515 315136903 270308940 28582978 192144068 35717665 44377222 153079651 159895767 342389398 373894078 32049511 110295212 228872369 18858...

output:

609991741497

result:

ok "609991741497"

Test #36:

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

input:

3000 975913934
906539836 606872628 483668516 726153265 449393411 530059224 692792999 655043845 295086576 792340166 205909076 838159529 9337182 433766692 140663904 82526104 93197284 136517744 291945814 796892136 763552348 460836403 409375003 202832578 869824999 26899716 738871202 381162279 190358087 ...

output:

1493053067773

result:

ok "1493053067773"

Test #37:

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

input:

3000 345501957
97830076 281432665 188896184 111590916 224115766 116648461 2124963 42558746 195012322 33624507 161210125 164937243 25549057 138926863 298372882 339105328 216518801 328410971 145202167 59589159 258916712 86117047 175182013 160040693 104562620 340251571 335072262 16855328 52730532 20290...

output:

530930184383

result:

ok "530930184383"

Test #38:

score: 0
Accepted
time: 1600ms
memory: 3940kb

input:

3000 617929357
198249810 573460786 304092958 237446888 243112710 75651657 481078660 142781618 314684673 336068900 62555926 391785047 406454611 195611653 33320505 586381896 88302825 429809337 350493073 69824435 219347533 9107676 358684688 386459236 515199373 265782357 569400396 367056444 567298822 48...

output:

952185007084

result:

ok "952185007084"

Test #39:

score: 0
Accepted
time: 1601ms
memory: 4084kb

input:

3000 767871813
76433021 328440878 95050613 496738430 448761654 332237192 631765452 118171788 36141882 728119538 478815048 662906626 331810220 194233196 217533187 355922544 547959993 715826064 523037995 404483309 693608443 77892585 628289311 152776168 332423281 439680891 721519010 129835248 402056500...

output:

1176606785939

result:

ok "1176606785939"

Test #40:

score: 0
Accepted
time: 1594ms
memory: 4084kb

input:

3000 357471690
323844979 43089349 114715937 298750312 90110382 31474466 349224938 293958346 168817200 267405782 9138495 16359309 123097183 189782828 230627262 41305824 89498124 113203909 237979594 47558713 171541059 233461023 53357393 62220874 234315611 22116018 168846187 285413503 202599205 1828392...

output:

549109299299

result:

ok "549109299299"

Test #41:

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

input:

3000 741877033
400239912 107588797 560383882 381849771 553961585 127877751 459084191 482969763 675388064 380282041 125472296 496285420 740288363 551762993 402453238 713537429 548634756 192676423 39742778 432314285 58987134 267748998 681918275 222408010 610858741 169529570 305552355 35602580 42688969...

output:

1136617271941

result:

ok "1136617271941"

Test #42:

score: -100
Wrong Answer
time: 2789ms
memory: 22752kb

input:

186924 60981890
25028913 7126148 38841403 52621109 1984918 53851519 29560891 40090430 5265610 39758233 5236715 45311009 44791015 1921447 53389131 48251712 36050601 51787553 16678774 15489156 54186341 42225316 41563616 57844881 54569155 8073104 41586507 18170591 5886273 34630027 48582327 41359535 123...

output:

5702530797979

result:

wrong answer 1st words differ - expected: '5708759096695', found: '5702530797979'