QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#69825#1387. Malowanie płotu [B]mik10 ✓147ms40612kbC++14392b2023-01-02 03:42:352023-01-02 03:42:36

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-02 03:42:36]
  • 评测
  • 测评结果:10
  • 用时:147ms
  • 内存:40612kb
  • [2023-01-02 03:42:35]
  • 提交

answer

#include <cstdio>

#define M 10000001

int t[2][M];

int main ()
{
  int n, m, p;
  scanf ("%i%i%i", &n, &m, &p);
  int *u = t[n%2];
  u[m] = 1;
  while (n--)
  {
    int s = 0, *v = u;
    u = t[n%2];
    for (int i=1; i<=m; i++)
    {
      u[i] = (u[i-1] + p-s + 1LL*i*(v[m] + p-v[m-i]))%p;
      s = (s + v[i])%p;
    }
  }
  printf ("%i\n", u[m]);
  return 0;
}

详细

Subtask #1:

score: 1
Accepted

Test #3:

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

input:

1 1 100000007

output:

1

result:

ok single line: '1'

Test #4:

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

input:

1 2 100000007

output:

3

result:

ok single line: '3'

Test #5:

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

input:

2 1 100000007

output:

1

result:

ok single line: '1'

Test #6:

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

input:

2 2 100000007

output:

7

result:

ok single line: '7'

Test #7:

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

input:

1 12 458190937

output:

78

result:

ok single line: '78'

Test #8:

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

input:

3 9 609209299

output:

45321

result:

ok single line: '45321'

Test #9:

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

input:

5 5 339010421

output:

215401

result:

ok single line: '215401'

Test #10:

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

input:

6 4 489918731

output:

222696

result:

ok single line: '222696'

Test #11:

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

input:

10 1 169646857

output:

1

result:

ok single line: '1'

Subtask #2:

score: 1
Accepted

Test #12:

score: 1
Accepted
time: 1ms
memory: 1624kb

input:

30 30 380195119

output:

166619630

result:

ok single line: '166619630'

Test #13:

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

input:

17 29 360348029

output:

212112394

result:

ok single line: '212112394'

Test #14:

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

input:

27 16 197567003

output:

95366620

result:

ok single line: '95366620'

Subtask #3:

score: 1
Accepted

Test #15:

score: 1
Accepted
time: 1ms
memory: 1676kb

input:

200 200 682943017

output:

56311807

result:

ok single line: '56311807'

Test #16:

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

input:

152 247 581829701

output:

137411851

result:

ok single line: '137411851'

Test #17:

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

input:

253 143 851321791

output:

525957764

result:

ok single line: '525957764'

Subtask #4:

score: 1
Accepted

Test #18:

score: 1
Accepted
time: 1ms
memory: 1792kb

input:

400 400 810613007

output:

435224113

result:

ok single line: '435224113'

Test #19:

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

input:

210 550 285341863

output:

160338540

result:

ok single line: '160338540'

Test #20:

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

input:

531 222 794866781

output:

609575705

result:

ok single line: '609575705'

Subtask #5:

score: 1
Accepted

Test #21:

score: 1
Accepted
time: 2ms
memory: 1660kb

input:

49 2015 372771527

output:

317694427

result:

ok single line: '317694427'

Test #22:

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

input:

14 4121 985447493

output:

387364224

result:

ok single line: '387364224'

Test #23:

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

input:

5 6354 537388739

output:

326949718

result:

ok single line: '326949718'

Test #24:

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

input:

3 9654 249806021

output:

10220508

result:

ok single line: '10220508'

Subtask #6:

score: 1
Accepted

Test #25:

score: 1
Accepted
time: 32ms
memory: 1796kb

input:

6000 400 898580777

output:

832449975

result:

ok single line: '832449975'

Test #26:

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

input:

33333 130 392883373

output:

70395366

result:

ok single line: '70395366'

Test #27:

score: 0
Accepted
time: 26ms
memory: 1640kb

input:

620301 3 578160377

output:

252040878

result:

ok single line: '252040878'

Subtask #7:

score: 1
Accepted

Test #28:

score: 1
Accepted
time: 11ms
memory: 1680kb

input:

1000 1000 860175601

output:

581086038

result:

ok single line: '581086038'

Test #29:

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

input:

500 2000 436780781

output:

372087508

result:

ok single line: '372087508'

Test #30:

score: 0
Accepted
time: 9ms
memory: 1796kb

input:

291 3030 181940159

output:

13684863

result:

ok single line: '13684863'

Test #31:

score: 0
Accepted
time: 9ms
memory: 1672kb

input:

51 12345 287325587

output:

224639430

result:

ok single line: '224639430'

Test #32:

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

input:

2 10008 100170073

output:

0

result:

ok single line: '0'

Subtask #8:

score: 1
Accepted

Test #33:

score: 1
Accepted
time: 30ms
memory: 1696kb

input:

1500 1500 403129117

output:

90005156

result:

ok single line: '90005156'

Test #34:

score: 0
Accepted
time: 31ms
memory: 1728kb

input:

3000 757 360590861

output:

29875505

result:

ok single line: '29875505'

Test #35:

score: 0
Accepted
time: 27ms
memory: 1616kb

input:

16384 123 988806947

output:

473539203

result:

ok single line: '473539203'

Subtask #9:

score: 1
Accepted

Test #36:

score: 1
Accepted
time: 81ms
memory: 1800kb

input:

2500 2500 244828267

output:

12777369

result:

ok single line: '12777369'

Test #37:

score: 0
Accepted
time: 90ms
memory: 1652kb

input:

999 5757 103497613

output:

79212279

result:

ok single line: '79212279'

Test #38:

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

input:

100 30000 145049507

output:

55697904

result:

ok single line: '55697904'

Subtask #10:

score: 1
Accepted

Test #39:

score: 1
Accepted
time: 133ms
memory: 40560kb

input:

1 10000000 100000007

output:

1500000

result:

ok single line: '1500000'

Test #40:

score: 0
Accepted
time: 141ms
memory: 40612kb

input:

2 5000000 100000007

output:

50418441

result:

ok single line: '50418441'

Test #41:

score: 0
Accepted
time: 129ms
memory: 6120kb

input:

17 588235 640229041

output:

418700675

result:

ok single line: '418700675'

Test #42:

score: 0
Accepted
time: 130ms
memory: 2192kb

input:

123 81300 732576583

output:

495183394

result:

ok single line: '495183394'

Test #43:

score: 0
Accepted
time: 129ms
memory: 1516kb

input:

3162 3162 999999937

output:

499132075

result:

ok single line: '499132075'

Test #44:

score: 0
Accepted
time: 124ms
memory: 1732kb

input:

21255 470 356450219

output:

93266631

result:

ok single line: '93266631'

Test #45:

score: 0
Accepted
time: 127ms
memory: 1792kb

input:

214928 46 107718181

output:

41692801

result:

ok single line: '41692801'

Test #46:

score: 0
Accepted
time: 137ms
memory: 1660kb

input:

5000000 2 100000007

output:

45607950

result:

ok single line: '45607950'

Test #47:

score: 0
Accepted
time: 147ms
memory: 1732kb

input:

10000000 1 225408061

output:

1

result:

ok single line: '1'