QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#268030#5. 在线 O(1) 逆元David7130 833ms277308kbC++14402b2023-11-27 23:00:352024-11-05 21:55:55

Judging History

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

  • [2024-11-05 21:55:55]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:833ms
  • 内存:277308kb
  • [2023-11-27 23:00:36]
  • 评测
  • 测评结果:0
  • 用时:575ms
  • 内存:277152kb
  • [2023-11-27 23:00:35]
  • 提交

answer

#include "inv.h"
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, N = 7e7 + 5;
typedef long long ll;
int invv[N];
void init(int p)
{
    invv[0] = invv[1] = 1;
    for (int i = 2; i <= 7e7; i++) invv[i] = ll((mod - mod / i) * invv[mod % i]) % mod;
}
int inv(int x)
{
    if (x <= 7e7) return invv[x];
    return ((ll)(mod - mod / x) * (ll)(inv(mod % x))) % mod;
}

Details


Pretests


Final Tests

Test #1:

score: 0
Wrong Answer
time: 820ms
memory: 277272kb

Test #2:

score: 0
Wrong Answer
time: 833ms
memory: 277308kb

Test #3:

score: 0
Wrong Answer
time: 825ms
memory: 277084kb

Test #4:

score: 0
Wrong Answer
time: 751ms
memory: 277084kb

Test #5:

score: 0
Wrong Answer
time: 755ms
memory: 277284kb