QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#482112#9125. Majority and Permutationucup-team1198AC ✓470ms17216kbC++143.2kb2024-07-17 17:20:562024-07-17 17:20:57

Judging History

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

  • [2024-07-17 17:20:57]
  • 评测
  • 测评结果:AC
  • 用时:470ms
  • 内存:17216kb
  • [2024-07-17 17:20:56]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int MOD = 998244353;

int add(int a, int b) {
    return a + b >= MOD ? a + b - MOD : a + b;
}

int sub(int a, int b) {
    return a >= b ? a - b : a + MOD - b;
}

int mul(int a, int b) {
    return (1ll * a * b) % MOD;
}

int pw(int x, int n) {
    int res = 1;
    while (n) {
        if (n % 2 == 0) {
            x = mul(x, x);
            n /= 2;
        } else {
            res = mul(res, x);
            --n;
        }
    }
    return res;
}

const int G = 3;

void fft(vector<int>& a, bool inv = false) {
    int n = a.size();
    int k = 0;
    while ((1 << k) < n) ++k;
    static vector<int> rev, power = {0, 1};
    rev.resize(n);
    rev[0] = 0;
    for (int i = 1; i < n; ++i) {
        rev[i] = rev[i / 2] / 2 + ((i & 1) << (k - 1));
        if (i < rev[i]) {
            swap(a[i], a[rev[i]]);
        }
    }
    for (int l = 1; l < n; l *= 2) {
        if ((int)power.size() == l) {
            power.resize(2 * l);
            int w = pw(G, (MOD - 1) / 2 / l);
            for (int i = l; i < 2 * l; ++i) {
                power[i] = power[i / 2];
                if (i & 1) power[i] = mul(power[i], w);
            }
        }
        for (int i = 0; i < n; i += 2 * l) {
            for (int j = 0; j < l; ++j) {
                int x = a[i + j], y = mul(a[i + j + l], power[j + l]);
                a[i + j] = add(x, y);
                a[i + j + l] = sub(x, y);
            }
        }
    }
    if (inv) {
        reverse(a.begin() + 1, a.end());
        int anti = pw(n, MOD - 2);
        for (int i = 0; i < n; ++i) {
            a[i] = mul(a[i], anti);
        }
    }
}

vector<int> operator*(vector<int> a, vector<int> b) {
    int sz = a.size() + b.size() - 1;
    int k = 0;
    while ((1 << k) < sz) ++k;
    a.resize(1 << k);
    b.resize(1 << k);
    fft(a); fft(b);
    for (int i = 0; i < (1 << k); ++i) {
        a[i] = mul(a[i], b[i]);
    }
    fft(a, true);
    a.resize(sz);
    return a;
}

const int MAXN = 2e5 + 100;
int used[MAXN];

int dp[MAXN], fact[MAXN];

void go(int l, int r) {
    if (r - l == 1) {
        if (!used[l]) dp[l] = 0;
        return;
    }
    int m = (l + r) / 2;
    go(l, m);
    vector<int> dpl(dp + l, dp + m);
    vector<int> upd(fact, fact + r - l);
    vector<int> dpr = dpl * upd;
    for (int i = m; i < r; ++i) {
        dp[i] = sub(dp[i], dpr[i - l]);
    }
    go(m, r);
}

void solve_() {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int x;
        cin >> x;
        used[x] = 1;
    }
    for (int i = 1; i < 2 * n; i += 2) {
        if (!used[2 * n - i]) {
            used[i] = 0;
        }
    }
    used[0] = used[2 * n] = 1;
    dp[0] = sub(0, 1);
    go(0, 2 * n + 1);
    cout << dp[2 * n] << "\n";
}

/// #define MULTITEST

main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    fact[0] = 1;
    for (int i = 1; i < MAXN; ++i) {
        fact[i] = mul(fact[i - 1], i);
    }

    int tst = 1;
#ifdef MULTITEST
    cin >> tst;
#endif // MULTITEST
    while (tst--) {
        solve_();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 2
1 3

output:

14

result:

ok "14"

Test #2:

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

input:

5 4
1 3 7 9

output:

2909184

result:

ok "2909184"

Test #3:

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

input:

5 1
5

output:

3614400

result:

ok "3614400"

Test #4:

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

input:

3 1
3

output:

684

result:

ok "684"

Test #5:

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

input:

5 2
5 9

output:

3614400

result:

ok "3614400"

Test #6:

score: 0
Accepted
time: 460ms
memory: 16640kb

input:

96685 10195
21 27 35 53 63 81 89 117 119 125 131 135 141 157 181 201 225 229 269 275 287 293 321 325 361 363 379 403 409 429 435 441 491 501 505 543 569 609 611 669 711 717 725 727 731 759 769 785 793 797 809 821 863 899 903 911 929 937 961 997 1051 1073 1077 1123 1157 1179 1235 1251 1275 1317 1319 ...

output:

95571712

result:

ok "95571712"

Test #7:

score: 0
Accepted
time: 229ms
memory: 10856kb

input:

64166 56097
3 9 11 13 15 17 19 21 25 27 29 31 33 35 37 39 41 43 45 47 49 51 55 57 59 61 63 65 67 69 71 73 75 77 79 85 87 89 91 93 95 97 101 105 107 111 113 115 117 119 121 123 125 127 131 133 137 141 143 145 149 153 155 159 161 163 167 169 171 173 175 177 181 183 185 187 189 191 195 197 199 201 205 ...

output:

228890492

result:

ok "228890492"

Test #8:

score: 0
Accepted
time: 454ms
memory: 16584kb

input:

98805 64583
1 3 5 7 9 13 15 17 19 21 27 33 35 39 41 43 45 47 49 53 55 57 59 61 65 67 71 73 75 77 79 81 83 85 89 91 95 97 103 107 109 121 123 127 129 135 137 139 141 143 145 149 151 153 155 157 159 161 163 167 171 173 175 177 179 181 183 185 187 189 191 197 199 203 205 207 213 215 219 221 223 225 227...

output:

184329625

result:

ok "184329625"

Test #9:

score: 0
Accepted
time: 232ms
memory: 11464kb

input:

72245 14521
5 35 37 43 75 77 97 129 155 171 173 175 179 183 209 213 219 225 227 229 241 255 257 263 271 295 297 305 307 315 321 323 335 351 361 363 369 379 389 391 395 433 435 439 443 449 451 455 463 483 497 523 531 537 557 559 567 573 589 595 609 613 633 641 643 651 655 657 669 695 701 721 793 803 ...

output:

61878119

result:

ok "61878119"

Test #10:

score: 0
Accepted
time: 224ms
memory: 11284kb

input:

63266 62348
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 127 129 131 133 135 137 139 141 143 145 149 151 153 155 157 159 161 163 165 167 169 171 173 175 17...

output:

265087059

result:

ok "265087059"

Test #11:

score: 0
Accepted
time: 461ms
memory: 16796kb

input:

96192 60042
1 3 5 7 9 13 17 21 31 33 39 41 45 47 51 53 55 57 61 63 65 67 69 75 79 81 83 85 87 89 91 95 99 101 103 105 109 111 115 131 133 135 137 141 151 153 155 157 161 165 169 173 175 177 181 183 189 193 199 205 207 209 215 217 219 221 225 227 229 231 239 243 245 247 249 251 257 263 265 273 275 27...

output:

750054525

result:

ok "750054525"

Test #12:

score: 0
Accepted
time: 450ms
memory: 16472kb

input:

96428 60349
1 3 7 9 13 19 21 23 25 27 29 37 39 41 43 45 49 51 53 55 61 63 67 69 73 75 77 81 85 87 89 91 93 95 97 99 101 111 113 117 123 125 127 129 131 135 137 139 141 149 151 155 157 161 169 171 173 175 177 179 185 189 193 197 209 211 213 219 223 225 229 231 233 235 237 239 243 247 251 253 259 263 ...

output:

214089880

result:

ok "214089880"

Test #13:

score: 0
Accepted
time: 443ms
memory: 16404kb

input:

92301 57523
3 7 9 13 15 17 19 21 27 29 31 33 45 47 53 61 63 67 71 73 75 77 79 81 83 85 87 91 93 99 101 107 109 111 113 115 117 121 125 127 129 133 135 137 139 145 147 149 153 155 159 161 165 167 171 173 175 177 183 185 189 191 193 195 197 199 205 207 211 213 215 219 221 223 225 231 235 237 239 241 2...

output:

698581206

result:

ok "698581206"

Test #14:

score: 0
Accepted
time: 446ms
memory: 16688kb

input:

92162 57420
5 7 9 15 23 25 27 29 31 35 37 39 43 45 49 51 53 57 63 65 67 69 73 77 81 83 85 87 89 99 101 103 107 109 115 117 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 153 157 159 161 167 175 177 185 189 191 197 199 201 203 219 221 223 229 231 235 239 241 243 247 251 257 259 267 275 2...

output:

779052124

result:

ok "779052124"

Test #15:

score: 0
Accepted
time: 456ms
memory: 16612kb

input:

95309 59643
1 7 9 11 15 17 23 25 29 33 35 37 45 47 49 51 53 55 59 61 63 65 67 69 71 79 81 83 85 87 89 93 95 97 103 105 107 111 113 115 117 119 121 123 127 129 131 133 135 139 141 143 147 149 159 161 163 167 169 173 179 181 183 189 193 197 199 203 207 209 211 213 215 217 223 227 229 231 237 239 241 2...

output:

895352747

result:

ok "895352747"

Test #16:

score: 0
Accepted
time: 456ms
memory: 16528kb

input:

97003 25153
11 19 27 31 53 71 75 81 85 95 97 113 129 131 139 145 159 163 171 175 193 209 211 213 217 227 237 239 241 249 253 271 275 279 295 301 309 329 331 343 351 359 361 375 379 383 389 395 401 403 413 415 425 433 441 447 451 455 473 475 495 505 521 533 535 537 539 543 559 603 605 609 611 615 619...

output:

945539005

result:

ok "945539005"

Test #17:

score: 0
Accepted
time: 462ms
memory: 16888kb

input:

99075 39136
3 5 7 15 17 19 21 29 31 33 41 51 53 55 57 59 61 65 73 81 89 91 97 101 115 119 121 123 127 133 135 149 155 157 171 175 183 185 187 189 191 199 215 225 227 229 231 237 239 241 247 257 267 269 271 273 281 283 295 299 315 323 333 337 339 343 349 351 367 377 395 397 399 407 411 413 423 427 43...

output:

432766313

result:

ok "432766313"

Test #18:

score: 0
Accepted
time: 440ms
memory: 16460kb

input:

92159 26615
5 27 33 37 49 53 65 67 69 71 73 77 93 95 107 115 143 147 155 161 163 173 175 179 183 185 203 221 225 235 241 245 253 257 271 273 291 301 305 307 317 327 337 339 347 351 353 363 375 377 379 389 397 401 405 409 419 421 437 441 443 447 453 465 477 489 491 497 505 531 547 557 559 563 571 583...

output:

232913447

result:

ok "232913447"

Test #19:

score: 0
Accepted
time: 453ms
memory: 17188kb

input:

93053 56499
1 5 9 11 13 17 19 23 25 29 31 37 39 45 47 49 51 55 59 65 67 69 71 75 79 83 91 99 103 105 107 109 111 113 115 117 121 123 125 127 129 131 133 135 137 139 141 145 151 157 159 161 165 167 169 171 175 177 179 181 183 185 187 191 193 195 197 199 201 205 207 209 211 215 217 221 223 227 233 235...

output:

694330858

result:

ok "694330858"

Test #20:

score: 0
Accepted
time: 444ms
memory: 16564kb

input:

93589 51398
3 7 21 23 25 29 31 33 35 37 39 41 43 47 49 53 55 61 63 77 83 85 89 95 99 105 109 113 117 125 127 129 135 139 141 147 151 155 157 159 163 165 167 171 173 179 183 185 187 197 201 207 211 217 219 221 233 239 241 251 257 261 265 267 269 273 275 283 287 289 291 295 297 305 307 313 315 317 321...

output:

777536233

result:

ok "777536233"

Test #21:

score: 0
Accepted
time: 455ms
memory: 16888kb

input:

100000 62633
3 5 9 13 15 17 19 21 23 27 33 37 39 41 45 49 51 53 55 61 63 65 69 71 73 77 81 85 87 89 91 95 97 99 103 105 107 109 111 115 117 119 123 125 127 129 133 137 139 141 143 145 147 149 153 159 161 163 165 167 173 177 179 181 183 187 193 195 197 199 209 211 213 215 217 221 223 225 227 233 235 ...

output:

737504170

result:

ok "737504170"

Test #22:

score: 0
Accepted
time: 462ms
memory: 16868kb

input:

100000 62720
3 5 7 9 13 15 21 23 25 27 33 39 45 47 49 51 55 59 61 69 73 77 79 83 87 89 91 95 97 101 105 107 109 115 125 129 137 139 141 143 145 149 151 153 157 161 169 171 173 175 177 181 183 189 191 193 195 197 199 209 213 217 219 221 225 227 229 231 233 235 237 241 245 247 249 251 253 255 259 261 ...

output:

617748342

result:

ok "617748342"

Test #23:

score: 0
Accepted
time: 459ms
memory: 16816kb

input:

100000 61952
1 5 11 13 15 19 21 23 25 29 33 35 39 43 45 47 49 57 59 61 63 67 71 73 75 77 79 81 83 85 87 91 93 99 101 103 107 109 115 117 121 123 125 129 133 137 143 147 149 153 155 157 161 169 173 175 179 181 183 185 187 189 191 193 199 201 211 217 219 221 225 229 231 235 239 243 245 247 251 253 255...

output:

610444772

result:

ok "610444772"

Test #24:

score: 0
Accepted
time: 462ms
memory: 16792kb

input:

100000 62478
7 9 11 15 19 21 23 25 29 31 33 35 37 39 43 45 47 51 53 55 57 59 61 65 67 75 79 83 93 95 97 99 101 103 109 111 113 115 119 121 123 137 143 145 147 149 151 157 167 169 171 175 177 179 181 185 187 189 191 193 195 197 199 207 209 211 215 217 221 223 227 231 233 235 239 241 243 245 247 249 2...

output:

35574634

result:

ok "35574634"

Test #25:

score: 0
Accepted
time: 459ms
memory: 16928kb

input:

100000 62512
1 3 5 7 9 13 17 23 25 27 31 33 35 37 39 41 45 47 53 55 57 59 61 63 65 69 71 73 75 77 81 83 89 91 93 97 99 101 103 105 107 109 111 117 121 123 125 127 129 133 135 137 139 141 153 155 157 161 163 165 167 169 171 175 181 183 187 189 191 193 195 199 203 207 209 213 219 223 225 227 229 231 2...

output:

576341038

result:

ok "576341038"

Test #26:

score: 0
Accepted
time: 453ms
memory: 16796kb

input:

100000 25239
3 7 9 11 17 19 23 33 43 47 51 57 65 69 77 79 93 113 121 123 145 147 151 153 161 165 169 173 175 179 181 185 191 197 199 201 209 213 215 217 219 227 229 233 241 263 295 303 305 315 321 329 343 349 359 363 365 367 379 381 383 387 389 395 397 409 441 447 457 461 463 465 471 477 479 547 551...

output:

610186317

result:

ok "610186317"

Test #27:

score: 0
Accepted
time: 465ms
memory: 16792kb

input:

100000 24954
3 5 7 13 17 25 37 43 49 53 61 83 93 101 111 115 117 123 131 135 139 141 157 181 185 195 197 201 221 223 229 241 245 251 257 285 293 301 323 337 347 349 357 363 367 373 377 431 435 437 441 449 453 461 469 479 489 493 495 499 501 513 517 523 527 539 541 557 559 563 583 589 593 611 631 635...

output:

584892215

result:

ok "584892215"

Test #28:

score: 0
Accepted
time: 458ms
memory: 16880kb

input:

100000 25057
7 13 21 41 43 47 65 83 89 111 113 119 131 133 141 143 145 157 169 181 185 201 207 211 215 221 253 257 269 277 287 291 295 303 315 319 333 335 369 371 377 407 415 417 445 447 457 475 485 503 507 509 511 513 517 535 541 543 545 551 555 557 567 573 585 587 591 593 595 605 611 623 629 631 6...

output:

420635212

result:

ok "420635212"

Test #29:

score: 0
Accepted
time: 465ms
memory: 16772kb

input:

100000 53389
1 5 9 13 17 19 27 29 31 33 35 39 47 63 71 77 79 83 87 89 91 93 97 101 103 105 107 109 111 115 117 119 125 129 137 139 145 149 155 157 161 163 165 177 179 181 185 195 197 199 207 209 217 219 221 223 225 227 229 233 235 239 245 247 251 253 257 259 267 269 273 275 277 281 285 287 289 291 2...

output:

272341848

result:

ok "272341848"

Test #30:

score: 0
Accepted
time: 465ms
memory: 16932kb

input:

100000 63131
1 3 7 9 11 13 15 17 19 21 23 27 29 31 37 39 41 45 47 49 61 63 65 69 71 73 77 85 87 91 95 99 101 103 105 107 111 113 117 119 121 125 127 129 133 137 141 143 145 147 149 153 155 157 161 163 171 173 177 179 181 183 185 187 191 193 195 197 199 201 203 207 209 213 215 225 227 233 235 239 241...

output:

486074251

result:

ok "486074251"

Test #31:

score: 0
Accepted
time: 462ms
memory: 16772kb

input:

100000 65584
1 3 7 9 11 13 15 17 21 23 29 31 33 37 41 45 47 51 53 57 63 65 69 71 75 77 79 85 95 97 101 107 109 111 113 117 119 121 125 129 131 133 135 139 145 151 155 157 159 167 169 173 177 179 181 183 189 195 199 203 205 215 217 219 221 225 231 233 235 237 241 245 251 255 263 265 267 271 273 275 2...

output:

300548747

result:

ok "300548747"

Test #32:

score: 0
Accepted
time: 470ms
memory: 16868kb

input:

100000 85028
1 3 5 7 9 11 13 15 17 21 23 29 31 33 35 37 39 41 45 47 49 51 53 55 59 61 63 65 67 69 71 73 75 77 79 81 85 87 89 91 93 95 97 99 101 103 105 107 109 111 115 117 119 121 129 131 133 135 137 139 141 143 145 149 151 153 159 161 163 165 167 169 171 173 175 177 179 181 183 185 187 189 191 193 ...

output:

771549211

result:

ok "771549211"

Test #33:

score: 0
Accepted
time: 459ms
memory: 16844kb

input:

100000 85689
1 3 5 7 9 11 13 19 23 25 29 33 37 39 41 43 45 47 49 53 55 57 59 61 63 65 67 69 71 73 75 77 79 83 85 87 89 91 93 97 99 101 103 105 107 109 111 113 117 121 123 125 127 129 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 175 177 183 187 189 191 193 195 197 1...

output:

559777459

result:

ok "559777459"

Test #34:

score: 0
Accepted
time: 463ms
memory: 16764kb

input:

100000 92620
1 3 5 7 9 11 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 147 149 153 155 157 159 165 167 169 171 173 175 177 179 181 183...

output:

636710940

result:

ok "636710940"

Test #35:

score: 0
Accepted
time: 469ms
memory: 16792kb

input:

100000 98228
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 1...

output:

997403689

result:

ok "997403689"

Test #36:

score: 0
Accepted
time: 467ms
memory: 16868kb

input:

100000 88348
1 3 5 7 9 13 15 17 19 21 25 27 29 33 37 39 41 43 47 49 51 55 57 59 61 65 67 69 71 73 75 77 79 81 83 85 87 89 93 95 97 99 101 103 105 109 111 115 117 121 123 125 127 129 131 133 135 137 139 143 145 147 151 153 155 157 159 161 163 165 167 169 171 173 175 177 179 181 183 185 187 189 191 19...

output:

238193664

result:

ok "238193664"

Test #37:

score: 0
Accepted
time: 456ms
memory: 16796kb

input:

100000 94819
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 91 93 95 97 99 101 103 105 107 109 113 115 117 119 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173 175 1...

output:

108236721

result:

ok "108236721"

Test #38:

score: 0
Accepted
time: 464ms
memory: 16792kb

input:

100000 85432
1 3 9 11 13 15 17 19 21 23 25 27 29 31 35 37 41 43 45 47 49 53 55 57 61 63 65 67 69 75 77 79 81 83 87 89 91 93 95 97 99 101 103 105 107 109 111 115 117 121 123 125 127 131 133 135 137 139 143 145 149 151 153 155 157 159 161 163 165 167 169 173 175 177 183 187 189 191 193 195 197 199 201...

output:

784268076

result:

ok "784268076"

Test #39:

score: 0
Accepted
time: 467ms
memory: 16820kb

input:

100000 87305
1 3 5 7 9 11 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 55 57 61 63 65 67 71 73 75 77 79 81 83 85 87 89 91 93 95 99 101 103 105 107 111 113 115 117 119 121 123 125 127 129 131 133 135 137 143 145 147 149 151 153 155 157 159 165 167 171 173 175 177 179 183 185 187 189 191 1...

output:

149630632

result:

ok "149630632"

Test #40:

score: 0
Accepted
time: 463ms
memory: 16864kb

input:

99999 85201
1 3 5 7 9 11 13 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 103 105 107 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 157 161 163 165 167 169 171 173 175 177 179 181 1...

output:

440345213

result:

ok "440345213"

Test #41:

score: 0
Accepted
time: 460ms
memory: 16780kb

input:

99999 95806
1 3 5 7 9 11 15 19 21 23 25 27 29 31 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 87 91 93 95 97 99 101 103 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 173 175 177 179 181 183 1...

output:

501450066

result:

ok "501450066"

Test #42:

score: 0
Accepted
time: 463ms
memory: 16784kb

input:

99999 86821
1 3 5 7 9 11 15 17 19 21 25 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 77 79 81 83 85 87 89 95 99 101 105 107 109 113 115 117 119 121 123 125 127 131 133 135 137 139 141 143 145 147 149 151 153 155 159 161 163 165 169 171 173 175 177 179 181 183 185 189 191 193 ...

output:

751814239

result:

ok "751814239"

Test #43:

score: 0
Accepted
time: 465ms
memory: 16944kb

input:

99999 95752
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171...

output:

581742233

result:

ok "581742233"

Test #44:

score: 0
Accepted
time: 460ms
memory: 16868kb

input:

99999 95760
1 3 5 7 9 11 13 17 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 153 155 157 159 161 163 165 167 169 171 173 175 177 ...

output:

138387454

result:

ok "138387454"

Test #45:

score: 0
Accepted
time: 469ms
memory: 16816kb

input:

99999 91930
1 3 5 7 9 11 13 15 17 19 23 25 27 31 33 35 37 39 41 43 45 47 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 155 157 159 161 163 165 167 169 171 173 175 177 179...

output:

741500441

result:

ok "741500441"

Test #46:

score: 0
Accepted
time: 464ms
memory: 16928kb

input:

99999 94888
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173 17...

output:

974503537

result:

ok "974503537"

Test #47:

score: 0
Accepted
time: 460ms
memory: 16796kb

input:

99999 95733
1 3 5 7 9 11 13 15 17 19 23 25 27 29 33 35 37 39 41 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173 175 177 ...

output:

448105112

result:

ok "448105112"

Test #48:

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

input:

1 1
1

output:

1

result:

ok "1"

Test #49:

score: 0
Accepted
time: 467ms
memory: 17216kb

input:

100000 100000
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 1...

output:

749028041

result:

ok "749028041"

Test #50:

score: 0
Accepted
time: 207ms
memory: 10556kb

input:

50000 50000
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171...

output:

769389319

result:

ok "769389319"

Test #51:

score: 0
Accepted
time: 466ms
memory: 16832kb

input:

99999 99999
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171...

output:

481565462

result:

ok "481565462"

Test #52:

score: 0
Accepted
time: 449ms
memory: 16876kb

input:

100000 1
1

output:

638474417

result:

ok "638474417"

Test #53:

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

input:

2 1
1

output:

24

result:

ok "24"

Test #54:

score: 0
Accepted
time: 214ms
memory: 10552kb

input:

50000 25000
5 11 13 15 17 21 29 35 37 39 47 49 51 53 55 57 59 63 65 67 69 73 75 83 91 105 107 113 117 123 129 131 133 135 137 139 149 151 153 159 161 163 171 177 183 187 189 195 203 207 209 211 213 217 229 231 237 245 249 251 259 263 265 269 271 275 279 281 283 285 289 293 295 299 305 307 311 313 31...

output:

215582594

result:

ok "215582594"

Test #55:

score: 0
Accepted
time: 463ms
memory: 16848kb

input:

100000 50000
9 13 15 17 23 27 35 37 39 43 47 53 55 57 65 77 81 85 87 91 95 97 101 105 107 109 111 115 117 125 131 137 139 147 149 151 155 161 167 169 171 173 179 187 189 195 201 205 213 217 219 221 227 231 235 237 239 241 243 249 251 253 255 261 263 267 271 279 289 299 303 305 307 311 315 317 321 32...

output:

638474417

result:

ok "638474417"

Extra Test:

score: 0
Extra Test Passed