QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#268028#5. 在线 O(1) 逆元David7130 743ms394232kbC++14403b2023-11-27 22:58:012023-11-27 22:58:03

Judging History

你现在查看的是测评时间为 2023-11-27 22:58:03 的历史记录

  • [2024-11-05 21:55:44]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:831ms
  • 内存:394528kb
  • [2023-11-27 22:58:03]
  • 评测
  • 测评结果:0
  • 用时:743ms
  • 内存:394232kb
  • [2023-11-27 22:58:01]
  • 提交

answer

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

详细

Test #1:

score: 0
Wrong Answer
time: 675ms
memory: 394056kb

Test #2:

score: 0
Wrong Answer
time: 743ms
memory: 394132kb

Test #3:

score: 0
Wrong Answer
time: 712ms
memory: 394232kb