QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#67187 | #5099. 朝圣道 | hleternity | 0 | 23ms | 7316kb | C++14 | 1.1kb | 2022-12-10 10:29:41 | 2022-12-10 10:29:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define N 1000009
inline long long read()
{
register long long x=0;
register char ch=cin.get();
register bool op=0;
while(!isdigit(ch)) {if(ch=='-')op=1;ch=cin.get();}
while(isdigit(ch)) {(x*=10)+=(ch^48);ch=cin.get();}
return op? -x:x;
}
long long x,y,p,n,o,T;
int ans;
inline void exgcd(register long long a,register long long b)
{
if(!b) {x=1,y=0;return;}
exgcd(b,a%b);
int nx=x;
x=y;
y=nx-a/b*y;
}
long long inv[N];
inline long long INV(register long long k)
{
if(inv[k]) return inv[k];
x=0,y=0;
exgcd(k,p);
inv[k]=(x%p+p)%p;
return inv[k];
}
inline void dfs(register long long a,register int cnt,register int w)
{
if(cnt==n) return ans+=a*abs(w),void();
for(register int i(1);i<=3;++i)
{
if(i==1) dfs(a*INV(4)%p,cnt+1,w-1);
if(i==2) dfs(a*INV(2)%p,cnt+1,w);
if(i==3) dfs(a*INV(4)%p,cnt+1,w+1);
}
}
void init(int o,int p){ans=0;}
int ask(long long n)
{
ans=0;
dfs(1,0,0);
return ans%p;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 6ms
memory: 7084kb
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:
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 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 ...
result:
wrong answer 1st numbers differ - expected: '5419', found: '0'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #5:
score: 0
Wrong Answer
time: 1ms
memory: 3260kb
input:
3 1 334547 8234
output:
0
result:
wrong answer 1st numbers differ - expected: '179079', found: '0'
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 23ms
memory: 7316kb
input:
6 958477 522361 280121915553826833 734266539148641647 72849162479700582 274266741463686096 60278972064195458 828423669427600612 571432949203039978 518511460268700898 486268614705621285 19216283231217074 611458416727512530 175147354285288662 799769622289998997 400123443628688299 145546980862133838 40...
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 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 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 ...
result:
wrong answer 12th numbers differ - expected: '193620', found: '0'
Subtask #7:
score: 0
Skipped
Dependency #3:
0%
Subtask #8:
score: 0
Wrong Answer
Test #33:
score: 0
Wrong Answer
time: 0ms
memory: 3440kb
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 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 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 ...
result:
wrong answer 25th numbers differ - expected: '204', found: '0'
Subtask #9:
score: 0
Skipped
Dependency #2:
0%