QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#67151 | #5099. 朝圣道 | MoQz | 44 | 3853ms | 13912kb | C++14 | 739b | 2022-12-10 10:06:20 | 2022-12-10 10:06:21 |
Judging History
answer
#include <bits/stdc++.h>
#include "pilgrimage.h"
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;++i)
#define fod(i,a,b) for(int i=a;i>=b;--i)
#define ll long long
int P;
int ksm(ll x,int y){
if(!x)return 1;
ll u=ksm(x/2,y);
u=u*u%P;
if(x&1)u=u*y%P;
return u;
}
int jc[1000011],ny[1000011];
void init (int o, int p)
{
P=p;
jc[0]=ny[0]=1;
fo(i,1,p-1){
jc[i]=(ll)jc[i-1]*i%p;
ny[i]=ksm(p-2,jc[i]);
}
return;
}
int C(ll x,ll y){
if(x<y)return 0;
if(x<P)return (ll)jc[x]*ny[y]%P*ny[x-y]%P;
return (ll)C(x/P,y/P)*C(x%P,y%P)%P;
}
int ask (long long n)
{
ll u=(ll)(ksm(2*n,2)-C(2*n,n)+P)*ksm(P-2,2)%P;
u=(u+C(2*n,n)-ksm(2*n-1,2)+P)%P;
u=n%P*u%P;
return u*ksm(P-2,ksm(n*2-1,2))%P;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 4
Accepted
time: 1130ms
memory: 11716kb
input:
1 910276 554767 6 10 7 4 10 12 9 3 3 5 7 10 5 6 1 6 3 9 6 8 12 11 8 2 12 5 9 3 8 2 12 11 2 3 4 9 2 5 5 11 6 4 8 11 3 9 2 2 8 9 2 8 9 6 2 9 2 10 10 7 5 6 4 4 11 12 8 8 2 2 4 3 3 5 6 6 8 11 6 9 9 3 4 1 2 2 6 9 9 2 3 2 12 6 1 7 2 4 12 11 4 7 6 3 9 4 6 5 3 3 12 6 2 1 1 7 2 6 5 9 11 6 3 4 11 1 2 4 5 4 10...
output:
5419 364275 514407 329394 364275 229662 53120 520095 520095 509260 514407 364275 509260 5419 277384 5419 520095 53120 5419 115262 229662 243797 115262 416076 229662 509260 53120 520095 115262 416076 229662 243797 416076 520095 329394 53120 416076 509260 509260 243797 5419 329394 115262 243797 520095...
result:
ok 910276 numbers
Test #2:
score: -4
Wrong Answer
time: 1038ms
memory: 9888kb
input:
1 972231 293475 7 1 9 6 5 1 11 5 5 12 2 2 7 3 4 10 10 3 2 10 7 1 10 9 1 3 5 6 7 2 7 4 1 10 1 9 3 10 10 2 6 11 4 10 12 8 5 2 12 4 9 12 7 2 12 4 3 1 2 9 12 1 4 5 6 12 6 5 9 2 5 12 3 4 6 12 12 2 1 6 4 12 10 5 12 7 9 8 3 8 10 5 3 6 12 7 7 10 7 10 8 7 7 2 2 4 8 6 10 8 11 6 11 10 3 9 5 2 5 1 10 2 11 4 4 3...
output:
62874 72353 263793 217407 173160 72353 277842 173160 173160 163809 34338 34338 62874 51606 207843 279945 279945 51606 34338 279945 62874 72353 279945 263793 72353 51606 173160 217407 62874 34338 62874 207843 72353 279945 72353 263793 51606 279945 279945 34338 217407 277842 207843 279945 163809 26771...
result:
wrong answer 1st numbers differ - expected: '117936', found: '62874'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 12
Accepted
Test #5:
score: 12
Accepted
time: 124ms
memory: 5920kb
input:
3 1 334547 8234
output:
179079
result:
ok 1 number(s): "179079"
Subtask #4:
score: 18
Accepted
Dependency #3:
100%
Accepted
Test #6:
score: 18
Accepted
time: 1865ms
memory: 11940kb
input:
4 1000000 581873 49881 62491 206405 26106 129239 174098 141494 61402 149825 241992 8109 243567 71918 203927 278575 263516 143582 32237 195508 269119 9111 105700 80919 229859 150334 171917 78447 62500 190063 138903 6395 222902 118653 136505 242467 64984 170330 287622 27089 35823 107672 273459 188857 ...
output:
225562 278095 494263 533616 449513 172629 433105 169217 156602 470240 127840 224903 148625 143635 385698 428034 270424 224704 326598 317786 205590 556103 563899 492571 87003 417735 350849 476300 65308 462020 373541 56205 35476 425631 345156 395965 377993 402141 119653 299737 4555 400632 420936 58015...
result:
ok 1000000 numbers
Subtask #5:
score: 14
Accepted
Dependency #4:
100%
Accepted
Test #7:
score: 14
Accepted
time: 3853ms
memory: 13912kb
input:
5 1000000 840643 596357868225427095 792903040511847841 549819683428503148 982786835970534376 855138540813992974 101968907510306081 885121351101383723 127972727417081251 728407510651610501 998897446686193527 889398142082696651 17276066104970301 87773104284997915 716559595019194816 538865162230963483 ...
output:
0 149057 0 0 0 0 13853 0 0 0 618602 0 0 0 0 0 243219 264897 0 0 0 0 0 0 0 0 0 0 0 0 311655 0 0 0 670015 171419 0 0 0 0 0 0 0 0 763198 247491 0 0 0 0 0 0 0 0 0 0 0 513609 0 0 0 0 0 0 0 0 0 0 0 0 0 0 37092 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 720992 0 0 456272 0 0 0 0 0 210850 0 0 0 0 0 383431 0 0 ...
result:
ok 1000000 numbers
Subtask #6:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 3627ms
memory: 11684kb
input:
6 958477 522361 280121915553826833 734266539148641647 72849162479700582 274266741463686096 60278972064195458 828423669427600612 571432949203039978 518511460268700898 486268614705621285 19216283231217074 611458416727512530 175147354285288662 799769622289998997 400123443628688299 145546980862133838 40...
output:
165613 53977 195076 2436 265923 119504 10122 416115 69118 369488 169673 248122 84959 57008 208642 128527 382634 239883 174475 468258 137046 181811 480704 75530 465430 264894 168763 433321 376789 39781 306740 73507 339780 393533 128597 429800 345716 300181 189287 481901 203448 8848 38843 269507 27398...
result:
wrong answer 1st numbers differ - expected: '0', found: '165613'
Subtask #7:
score: 0
Wrong Answer
Dependency #3:
100%
Accepted
Test #13:
score: 0
Wrong Answer
time: 291ms
memory: 9016kb
input:
7 1 731039 314313205082038759
output:
156931
result:
wrong answer 1st numbers differ - expected: '0', found: '156931'
Subtask #8:
score: 0
Wrong Answer
Test #33:
score: 16
Accepted
time: 32ms
memory: 3708kb
input:
8 9963 251 831797004675585320 494759973681332858 701341496127272302 252910460485222469 250965009655458584 366193481309061299 633134388675839346 791999098066205672 196620805863610860 363773642045280947 466508590762410710 407790578717064135 181590911404670570 570642047249889864 70138464625729452 23634...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 204 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 63 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 9963 numbers
Test #34:
score: 0
Accepted
time: 36ms
memory: 3756kb
input:
8 9967 6043 820328543276206812 181987384710842549 607221769552657162 341958396909446562 323372299362111304 912735937493462137 261510727281638358 792961465908198578 724729139273707925 61144688983588693 803871679975888144 565482268842659147 653581946336745517 701605486107526593 237425098688490866 3911...
output:
0 0 0 4601 3550 0 0 0 0 0 0 0 4890 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1943 0 0 0 3598 0 5239 0 2888 0 0 0 3581 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4367 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1295 0 4008 0 0 0 5375 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 9967 numbers
Test #35:
score: -16
Wrong Answer
time: 38ms
memory: 3528kb
input:
8 9958 7341 246592510376086877 843442167129623384 163968090028533751 786994286411665724 810314145468625407 382997160361312553 621227536566512389 782654969130405492 662775335088395473 723417297592011109 102999527027241303 490566704238479035 460383429537079806 770514075045815286 862086443272202320 491...
output:
2763 4353 3993 2568 549 5913 576 7200 1737 1902 48 6549 4497 5469 5517 1053 4623 2031 57 3456 2850 2784 4530 1398 6639 2070 6579 303 2829 4470 723 5106 3459 4761 6342 4134 4092 3558 3321 6210 5166 3663 4110 1185 3546 999 2037 1644 2184 7299 4455 2223 2337 4272 4860 1182 1446 663 6360 528 6699 1491 8...
result:
wrong answer 1st numbers differ - expected: '0', found: '2763'
Subtask #9:
score: 0
Skipped
Dependency #2:
0%