QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#371396 | #5099. 朝圣道 | ANIG | 12 | 2805ms | 23320kb | C++23 | 1014b | 2024-03-30 10:29:07 | 2024-03-30 10:29:08 |
Judging History
answer
#include "pilgrimage.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+5;
int mods,jc[N],ny[N],inv2;
int pows(int a,int b){
if(b==0)return 1;
int res=pows(a,b>>1);
res=res*res%mods;
if(b&1)res=res*a%mods;
return res;
}
int C(int a,int b){
if(a<b)return 0;
return jc[a]*ny[b]%mods*ny[a-b]%mods;
}
void init(signed o,signed mod){
mods=mod;
jc[0]=ny[0]=1;
for(int i=1;i<=1e6;i++)jc[i]=jc[i-1]*i%mods,ny[i]=pows(jc[i],mods-2);
inv2=pows(2,mods-2);
}
signed ask(int n){
int res=0;
for(int i=0;i<=n;i++){
for(int j=0;j<=i;j++){
if(i+j<=n)res+=(i-j)*pows(inv2*inv2%mods,i+j)%mods*pows(inv2,n-i-j)%mods*C(n,i+j)%mods*C(i+j,i)%mods;
res%=mods;
}
}
return res*2%mods;
}
// signed main(){
// int o,t,p;
// cin>>o>>t>>p;
// init(o,p);
// while(t--){
// int n;
// cin>>n;
// cout<<ask(n)<<endl;
// }
// }
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 4
Accepted
time: 1156ms
memory: 23312kb
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: 1222ms
memory: 23320kb
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:
82845 72353 71400 91545 99750 72353 53025 99750 99750 208950 267231 267231 82845 119958 180564 6300 6300 119958 267231 6300 82845 72353 6300 71400 72353 119958 99750 91545 82845 267231 82845 180564 72353 6300 72353 71400 119958 6300 6300 267231 91545 53025 180564 6300 208950 244230 99750 267231 2089...
result:
wrong answer 1st numbers differ - expected: '117936', found: '82845'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 12
Accepted
Test #5:
score: 12
Accepted
time: 2805ms
memory: 21276kb
input:
3 1 334547 8234
output:
179079
result:
ok 1 number(s): "179079"
Subtask #4:
score: 0
Time Limit Exceeded
Dependency #3:
100%
Accepted
Test #6:
score: 0
Time Limit Exceeded
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:
Unauthorized output
result:
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Runtime Error
Test #8:
score: 0
Runtime Error
input:
6 958477 522361 280121915553826833 734266539148641647 72849162479700582 274266741463686096 60278972064195458 828423669427600612 571432949203039978 518511460268700898 486268614705621285 19216283231217074 611458416727512530 175147354285288662 799769622289998997 400123443628688299 145546980862133838 40...
output:
Unauthorized output
result:
Subtask #7:
score: 0
Runtime Error
Dependency #3:
100%
Accepted
Test #13:
score: 0
Runtime Error
input:
7 1 731039 314313205082038759
output:
Unauthorized output
result:
Subtask #8:
score: 0
Runtime Error
Test #33:
score: 0
Runtime Error
input:
8 9963 251 831797004675585320 494759973681332858 701341496127272302 252910460485222469 250965009655458584 366193481309061299 633134388675839346 791999098066205672 196620805863610860 363773642045280947 466508590762410710 407790578717064135 181590911404670570 570642047249889864 70138464625729452 23634...
output:
Unauthorized output
result:
Subtask #9:
score: 0
Skipped
Dependency #1:
0%