QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#244497#5744. Palindromic Differencesucup-team870#WA 0ms3856kbC++14598b2023-11-09 10:29:022023-11-09 10:29:03

Judging History

This is the latest submission verdict.

  • [2023-11-09 10:29:03]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3856kb
  • [2023-11-09 10:29:02]
  • Submitted

answer

#include<bits/stdc++.h>
#define For(i,j,k) for(int i=j;i<=k;++i)
using namespace std;
typedef long long ll;
ll ksm(ll x,int y,int mo){
    ll an=1;
    while(y){
        if (y&1) an=an*x%mo;
        x=x*x%mo; y>>=1;
    }
    return an;
}
const int mo=1e9+9;
int main(){
    int _,n; scanf("%d",&_);
    while(_--){
        scanf("%d",&n);
        ll zs=ksm(2,n,mo-1)+mo-2; //zs=zs%(mo-1);
        //cout<<zs<<endl;
        ll s=ksm(2,zs,mo); //cout<<s<<endl;
        ll fz=s-ksm(2,n,mo)+1; fz=(fz+mo)%mo;
        printf("%lld\n",fz*ksm(s,mo-2,mo)%mo);
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3856kb

input:

5
3
2 3 1
4
1 1 1 1
3
1 2 4
7
0 200 0 200 50 100 150
14
-1 0 1 2 3 4 5 6 7 8 9 10 11 12

output:

117187502
375000004
117187502
500000005
744842537

result:

wrong answer 1st numbers differ - expected: '2', found: '117187502'