QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#915619#5. 在线 O(1) 逆元Taiki071530 1269ms3840kbC++20286b2025-02-26 14:28:022025-02-26 14:28:03

Judging History

This is the latest submission verdict.

  • [2025-02-26 14:28:03]
  • Judged
  • Verdict: 30
  • Time: 1269ms
  • Memory: 3840kb
  • [2025-02-26 14:28:02]
  • Submitted

answer

#include<iostream>
#include<cassert>
#include "inv.h"
using ll=long long;
constexpr ll mod=998244353;
void init(int p){
  assert(p==mod);
}
int inv(int x){
  ll res=1;
  ll p=mod-2;
  while(p){
    if(p&1)res=res*x%mod;
    x=ll(x)*x%mod;
    p>>=1;
  }
  return res;
}

Details


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 12ms
memory: 3712kb

Test #2:

score: 20
Accepted
time: 1269ms
memory: 3840kb

Test #3:

score: 0
Time Limit Exceeded

Test #4:

score: 0
Time Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded