QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#626965#7802. Game of NimIllusionaryDominance#AC ✓65ms4712kbC++20483b2024-10-10 14:15:202024-10-10 14:15:21

Judging History

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

  • [2024-10-10 14:15:21]
  • 评测
  • 测评结果:AC
  • 用时:65ms
  • 内存:4712kb
  • [2024-10-10 14:15:20]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int n, p, m, f[512][512];

inline int add(int a, int b) {return a + b < m ? a + b : a + b - m;}

int main() {
    cin >> n >> p >> m;
    f[0][0] = 1;
    for (int k = 1; k <= n - p; k ++) {
        for (int i = k; i <= n - p; i ++) {
            for (int j = 0; j < 512; j ++) {
                f[i][j] = add(f[i][j], f[i - k][j ^ k]);
            }
        }
    }
    cout << f[n - p][p] << '\n';
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

8 3 1000

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

5 2 1000

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

2 1 2

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

6 2 1323123

output:

2

result:

ok 1 number(s): "2"

Test #5:

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

input:

10 4 123412412

output:

2

result:

ok 1 number(s): "2"

Test #6:

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

input:

20 10 123123

output:

2

result:

ok 1 number(s): "2"

Test #7:

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

input:

42 23 231234142

output:

0

result:

ok 1 number(s): "0"

Test #8:

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

input:

42 12 123123342

output:

610

result:

ok 1 number(s): "610"

Test #9:

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

input:

132 42 198519289

output:

386930

result:

ok 1 number(s): "386930"

Test #10:

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

input:

168 55 190931488

output:

7739643

result:

ok 1 number(s): "7739643"

Test #11:

score: 0
Accepted
time: 5ms
memory: 3884kb

input:

248 119 180187404

output:

5541

result:

ok 1 number(s): "5541"

Test #12:

score: 0
Accepted
time: 17ms
memory: 4276kb

input:

318 39 446463275

output:

309993834

result:

ok 1 number(s): "309993834"

Test #13:

score: 0
Accepted
time: 19ms
memory: 4232kb

input:

464 193 484172941

output:

58956714

result:

ok 1 number(s): "58956714"

Test #14:

score: 0
Accepted
time: 47ms
memory: 4580kb

input:

492 49 509191931

output:

410787599

result:

ok 1 number(s): "410787599"

Test #15:

score: 0
Accepted
time: 39ms
memory: 4436kb

input:

500 100 1000000000

output:

898871667

result:

ok 1 number(s): "898871667"

Test #16:

score: 0
Accepted
time: 22ms
memory: 4264kb

input:

500 200 2424

output:

1571

result:

ok 1 number(s): "1571"

Test #17:

score: 0
Accepted
time: 60ms
memory: 4588kb

input:

500 1 998244353

output:

824962382

result:

ok 1 number(s): "824962382"

Test #18:

score: 0
Accepted
time: 60ms
memory: 4556kb

input:

500 2 999999999

output:

479167812

result:

ok 1 number(s): "479167812"

Test #19:

score: 0
Accepted
time: 59ms
memory: 4620kb

input:

500 5 987654321

output:

888251427

result:

ok 1 number(s): "888251427"

Test #20:

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

input:

500 499 2

output:

0

result:

ok 1 number(s): "0"

Test #21:

score: 0
Accepted
time: 12ms
memory: 4212kb

input:

500 250 4324

output:

203

result:

ok 1 number(s): "203"

Test #22:

score: 0
Accepted
time: 15ms
memory: 4120kb

input:

500 256 1000000000

output:

0

result:

ok 1 number(s): "0"

Test #23:

score: 0
Accepted
time: 15ms
memory: 3996kb

input:

500 255 1000000000

output:

0

result:

ok 1 number(s): "0"

Test #24:

score: 0
Accepted
time: 15ms
memory: 4204kb

input:

500 254 1000000000

output:

0

result:

ok 1 number(s): "0"

Test #25:

score: 0
Accepted
time: 11ms
memory: 4128kb

input:

500 253 1000000000

output:

0

result:

ok 1 number(s): "0"

Test #26:

score: 0
Accepted
time: 15ms
memory: 4196kb

input:

500 252 1000000000

output:

0

result:

ok 1 number(s): "0"

Test #27:

score: 0
Accepted
time: 15ms
memory: 4132kb

input:

500 251 1000000000

output:

0

result:

ok 1 number(s): "0"

Test #28:

score: 0
Accepted
time: 17ms
memory: 4148kb

input:

500 240 1000000000

output:

78752

result:

ok 1 number(s): "78752"

Test #29:

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

input:

500 127 1000000000

output:

735856900

result:

ok 1 number(s): "735856900"

Test #30:

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

input:

500 128 1000000000

output:

752639907

result:

ok 1 number(s): "752639907"

Test #31:

score: 0
Accepted
time: 46ms
memory: 4496kb

input:

500 64 1000000000

output:

696747666

result:

ok 1 number(s): "696747666"

Test #32:

score: 0
Accepted
time: 65ms
memory: 4444kb

input:

500 63 1000000000

output:

372258537

result:

ok 1 number(s): "372258537"

Test #33:

score: 0
Accepted
time: 7ms
memory: 3980kb

input:

333 123 303739951

output:

0

result:

ok 1 number(s): "0"

Test #34:

score: 0
Accepted
time: 43ms
memory: 4576kb

input:

497 55 842080168

output:

0

result:

ok 1 number(s): "0"

Test #35:

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

input:

395 291 982483005

output:

0

result:

ok 1 number(s): "0"

Test #36:

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

input:

481 389 968737780

output:

0

result:

ok 1 number(s): "0"

Test #37:

score: 0
Accepted
time: 14ms
memory: 4168kb

input:

341 74 211356241

output:

0

result:

ok 1 number(s): "0"

Test #38:

score: 0
Accepted
time: 43ms
memory: 4580kb

input:

447 6 220551443

output:

0

result:

ok 1 number(s): "0"

Test #39:

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

input:

117 53 229852993

output:

0

result:

ok 1 number(s): "0"

Test #40:

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

input:

374 92 655232919

output:

510631436

result:

ok 1 number(s): "510631436"

Test #41:

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

input:

161 24 522915247

output:

0

result:

ok 1 number(s): "0"

Test #42:

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

input:

296 264 921737931

output:

0

result:

ok 1 number(s): "0"

Test #43:

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

input:

123 59 249153627

output:

0

result:

ok 1 number(s): "0"

Test #44:

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

input:

321 289 374745139

output:

0

result:

ok 1 number(s): "0"

Test #45:

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

input:

449 321 564028761

output:

0

result:

ok 1 number(s): "0"

Test #46:

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

input:

67 65 193423543

output:

0

result:

ok 1 number(s): "0"

Test #47:

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

input:

272 268 89068990

output:

0

result:

ok 1 number(s): "0"

Test #48:

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

input:

491 483 929064777

output:

0

result:

ok 1 number(s): "0"

Test #49:

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

input:

344 328 489724616

output:

0

result:

ok 1 number(s): "0"

Test #50:

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

input:

362 330 987111640

output:

0

result:

ok 1 number(s): "0"

Test #51:

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

input:

255 191 825170913

output:

0

result:

ok 1 number(s): "0"

Test #52:

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

input:

297 169 682131614

output:

0

result:

ok 1 number(s): "0"

Test #53:

score: 0
Accepted
time: 16ms
memory: 4072kb

input:

372 116 897520833

output:

406985347

result:

ok 1 number(s): "406985347"

Test #54:

score: 0
Accepted
time: 16ms
memory: 4136kb

input:

351 95 801600616

output:

0

result:

ok 1 number(s): "0"

Test #55:

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

input:

427 299 527480415

output:

0

result:

ok 1 number(s): "0"

Test #56:

score: 0
Accepted
time: 47ms
memory: 4616kb

input:

493 35 345854681

output:

0

result:

ok 1 number(s): "0"

Test #57:

score: 0
Accepted
time: 39ms
memory: 4484kb

input:

466 45 705433124

output:

405583388

result:

ok 1 number(s): "405583388"

Test #58:

score: 0
Accepted
time: 19ms
memory: 4188kb

input:

295 20 478460925

output:

0

result:

ok 1 number(s): "0"

Test #59:

score: 0
Accepted
time: 43ms
memory: 4400kb

input:

459 38 692239363

output:

0

result:

ok 1 number(s): "0"

Test #60:

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

input:

3 1 1000

output:

0

result:

ok 1 number(s): "0"

Test #61:

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

input:

3 2 1000

output:

0

result:

ok 1 number(s): "0"

Test #62:

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

input:

4 1 1000

output:

1

result:

ok 1 number(s): "1"

Test #63:

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

input:

4 2 1000

output:

1

result:

ok 1 number(s): "1"

Test #64:

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

input:

4 3 1000

output:

0

result:

ok 1 number(s): "0"

Test #65:

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

input:

8 3 2

output:

0

result:

ok 1 number(s): "0"

Test #66:

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

input:

6 1 100

output:

3

result:

ok 1 number(s): "3"

Test #67:

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

input:

6 2 100

output:

2

result:

ok 1 number(s): "2"

Test #68:

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

input:

6 3 100

output:

2

result:

ok 1 number(s): "2"

Test #69:

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

input:

256 128 123981492

output:

1

result:

ok 1 number(s): "1"

Test #70:

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

input:

254 127 1000000000

output:

877

result:

ok 1 number(s): "877"

Test #71:

score: 0
Accepted
time: 54ms
memory: 4680kb

input:

500 14 958912859

output:

650304186

result:

ok 1 number(s): "650304186"

Test #72:

score: 0
Accepted
time: 50ms
memory: 4424kb

input:

500 42 591829519

output:

133671197

result:

ok 1 number(s): "133671197"

Test #73:

score: 0
Accepted
time: 56ms
memory: 4624kb

input:

499 1 999912321

output:

0

result:

ok 1 number(s): "0"

Test #74:

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

input:

499 498 984129849

output:

0

result:

ok 1 number(s): "0"

Test #75:

score: 0
Accepted
time: 52ms
memory: 4620kb

input:

498 1 918239128

output:

604086379

result:

ok 1 number(s): "604086379"

Test #76:

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

input:

498 497 984192849

output:

0

result:

ok 1 number(s): "0"

Test #77:

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

input:

254 127 877

output:

0

result:

ok 1 number(s): "0"

Test #78:

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

input:

254 125 729

output:

0

result:

ok 1 number(s): "0"

Test #79:

score: 0
Accepted
time: 39ms
memory: 4312kb

input:

500 100 613156101

output:

0

result:

ok 1 number(s): "0"

Test #80:

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

input:

500 99 755405164

output:

3

result:

ok 1 number(s): "3"

Test #81:

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

input:

500 99 924361444

output:

924361439

result:

ok 1 number(s): "924361439"

Test #82:

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

input:

500 97 6974800

output:

1

result:

ok 1 number(s): "1"

Test #83:

score: 0
Accepted
time: 39ms
memory: 4500kb

input:

500 96 42601567

output:

42601566

result:

ok 1 number(s): "42601566"

Test #84:

score: 0
Accepted
time: 60ms
memory: 4644kb

input:

500 1 2

output:

1

result:

ok 1 number(s): "1"

Test #85:

score: 0
Accepted
time: 61ms
memory: 4684kb

input:

500 1 5

output:

2

result:

ok 1 number(s): "2"

Test #86:

score: 0
Accepted
time: 61ms
memory: 4556kb

input:

500 1 14

output:

5

result:

ok 1 number(s): "5"

Test #87:

score: 0
Accepted
time: 60ms
memory: 4656kb

input:

500 1 42

output:

33

result:

ok 1 number(s): "33"

Test #88:

score: 0
Accepted
time: 57ms
memory: 4712kb

input:

500 1 132

output:

123

result:

ok 1 number(s): "123"

Test #89:

score: 0
Accepted
time: 60ms
memory: 4620kb

input:

500 1 429

output:

57

result:

ok 1 number(s): "57"

Test #90:

score: 0
Accepted
time: 60ms
memory: 4688kb

input:

500 1 3

output:

0

result:

ok 1 number(s): "0"

Extra Test:

score: 0
Extra Test Passed