QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#4935#5. 在线 O(1) 逆元Lenstar80 4952ms42952kbC++11348b2020-10-19 09:42:082024-11-05 21:45:30

Judging History

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

  • [2024-11-05 21:45:30]
  • 管理员手动重测本题所有提交记录
  • 测评结果:80
  • 用时:4952ms
  • 内存:42952kb
  • [2024-11-05 21:42:05]
  • 管理员手动重测本题所有提交记录
  • 测评结果:80
  • 用时:4951ms
  • 内存:42944kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2021-12-19 05:38:03]
  • 评测
  • 测评结果:70
  • 用时:1112ms
  • 内存:42612kb
  • [2020-10-19 09:42:08]
  • 提交

answer

#include <bits/stdc++.h>
#include "inv.h"

const int N = 1e7 + 10, Mod = 998244353;
int Inv[N];

void init(int p)
{
    Inv[0] = Inv[1] = 1;
    for (int i = 2; i < N; ++i) Inv[i] = 1LL * (Mod - Mod / i) * Inv[Mod % i] % Mod;
}

int inv(int a)
{
    if (a < N) return Inv[a];
    return 1LL * (Mod - Mod / a) * inv(Mod % a) % Mod;
}

Details


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 63ms
memory: 42884kb

Test #2:

score: 20
Accepted
time: 699ms
memory: 42948kb

Test #3:

score: 30
Accepted
time: 3153ms
memory: 42764kb

Test #4:

score: 20
Accepted
time: 4952ms
memory: 42952kb

Test #5:

score: 0
Time Limit Exceeded