QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#850092#5. 在线 O(1) 逆元mnbvcxz1230 0ms0kbC++23366b2025-01-09 20:17:372025-01-09 20:17:38

Judging History

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

  • [2025-01-09 20:17:38]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2025-01-09 20:17:37]
  • 提交

answer

#include"inv.h"
#include<bits/stdc++.h>
using namespace std;
using ll=long long;

constexpr int mod=998244353;

ll inver[1000005];

int xd(int a) {
    if(a<=1e6 and inver[a])return inver[a];
  return a <= 1 ? a : inver[a]=mod - (long long)(mod/a) * xd(mod % a) % mod;
}


void init(int p){
    inver[1]=1;
}

int inv(int x){
    return xd(x);
}

Details


Pretests


Final Tests

Test #1:

score: 0
Runtime Error

Test #2:

score: 0
Runtime Error

Test #3:

score: 0
Runtime Error

Test #4:

score: 0
Runtime Error

Test #5:

score: 0
Runtime Error