QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#4937#5. 在线 O(1) 逆元Qingyu80 4898ms199196kbC++11348b2020-10-19 09:42:432024-11-05 21:45:30

Judging History

This is the latest submission verdict.

  • [2024-11-05 21:45:30]
  • 管理员手动重测本题所有提交记录
  • Verdict: 80
  • Time: 4898ms
  • Memory: 199196kb
  • [2024-11-05 21:42:22]
  • 管理员手动重测本题所有提交记录
  • Verdict: 80
  • Time: 5061ms
  • Memory: 199200kb
  • [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:27]
  • Judged
  • Verdict: 70
  • Time: 1864ms
  • Memory: 198828kb
  • [2020-10-19 09:42:43]
  • Submitted

answer

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

const int N = 5e7 + 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;
}

詳細信息


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 415ms
memory: 199196kb

Test #2:

score: 20
Accepted
time: 978ms
memory: 199144kb

Test #3:

score: 30
Accepted
time: 3220ms
memory: 199144kb

Test #4:

score: 20
Accepted
time: 4898ms
memory: 199048kb

Test #5:

score: 0
Time Limit Exceeded