QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#798245#5. 在线 O(1) 逆元zzafanti80 5415ms394552kbC++23477b2024-12-04 10:11:072024-12-04 10:11:09

Judging History

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

  • [2024-12-04 10:11:09]
  • 评测
  • 测评结果:80
  • 用时:5415ms
  • 内存:394552kb
  • [2024-12-04 10:11:07]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
using E=long long;

const int Lim=1e8;
int Inv[Lim+1];
const E mod=998244353;
const __int128 brt=((__int128)1<<64)/mod;

void init(int p){
  Inv[1]=1;
  for(int i=2; i<=Lim; i++){
    Inv[i]=(mod-mod/i)*Inv[mod%i]%mod;
  }
}

int inv(int x){
  return x<=Lim?Inv[x]:(mod-mod/x)*inv(mod%x)%mod;
}

#ifdef zzafanti

int main(){
  init(mod);
  cout<<inv(23214153)<<endl;
  return 0;
}

#endif // zzafanti

Details


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 936ms
memory: 394412kb

Test #2:

score: 20
Accepted
time: 1515ms
memory: 394344kb

Test #3:

score: 30
Accepted
time: 3763ms
memory: 394540kb

Test #4:

score: 20
Accepted
time: 5415ms
memory: 394552kb

Test #5:

score: 0
Time Limit Exceeded