QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#290184#4626. Sum Plus ProductyspmWA 1ms3588kbC++201.4kb2023-12-24 15:22:242023-12-24 15:22:25

Judging History

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

  • [2023-12-24 15:22:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3588kb
  • [2023-12-24 15:22:24]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;++i)
using namespace std;
template<typename T>inline void ckmax(T &x,T y){x=x<y?y:x;}
template<typename T>inline void ckmin(T &x,T y){x=x>y?y:x;}
template<typename T=int>inline T read(){
    T res=0,f=1; char k;
    while(!isdigit(k=getchar())) if(k=='-') f=-1;
    while(isdigit(k)) res=res*10+k-'0',k=getchar();
    return res*f;
}
template<typename T>inline void print(T x,bool fl=1){
    if(x<0) putchar('-'),x=-x; 
    if(x>=10) print(x/10,0);
    putchar(x%10+'0');
    if(fl) putchar('\n');
}
const int mod=998244353;
inline int add(int x,int y,int Mod=mod){return x+y>=Mod?x+y-Mod:x+y;}
inline int del(int x,int y,int Mod=mod){return x-y<0?x-y+Mod:x-y;}
inline int mul(int x,int y,int Mod=mod){return x*y-x*y/Mod*Mod;}
inline void ckadd(int &x,int y,int Mod=mod){x=x+y>=Mod?x+y-Mod:x+y;}
inline void ckdel(int &x,int y,int Mod=mod){x=x-y<0?x-y+Mod:x-y;}
inline void ckmul(int &x,int y,int Mod=mod){x=x*y-x*y/Mod*Mod;}
inline int ksm(int x,int y,int Mod=mod){int res=1; for(;y;y>>=1,ckmul(x,x,Mod)) if(y&1) ckmul(res,x,Mod); return res;}
inline void approx(int val,int Mod=mod,int lim=1e5){int x=val,y=Mod,a=1,b=0; while(x>lim){swap(x,y); swap(a,b); a-=x/y*b; x%=y;} cout<<x<<"/"<<a<<endl; return ;}
int main(){
    int T=read();   
    while(T--){
        int n=read(),ans=1;
        for(int i=1;i<=n;++i) ckmul(ans,add(read(),1));
        print(del(ans,1));
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3588kb

input:

20
500
732119 592443 487799 985235 815368 743444 295 298638 775259 682852 582519 959745 58200 894834 569370 811779 934590 894530 62915 824557 788216 907951 676664 158503 712163 916901 419672 787605 772426 781424 54232 249035 937144 397358 513471 866695 905096 196496 757032 651037 313683 13446 892474...

output:

819077190
766941995
706226032
7060109
367715823
343692801
727250414
678247645
825174083
941787529
541715968
182240341
82636860
219818975
913602478
520202335
31718605
318824000
664299745
808312827

result:

wrong answer 1st lines differ - expected: '114197416', found: '819077190'