QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#624850#5. 在线 O(1) 逆元BlackPanda0 825ms394460kbC++14325b2024-10-09 16:43:552024-10-09 16:43:55

Judging History

你现在查看的是测评时间为 2024-10-09 16:43:55 的历史记录

  • [2024-11-05 22:04:51]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:722ms
  • 内存:394520kb
  • [2024-10-09 16:43:55]
  • 评测
  • 测评结果:0
  • 用时:825ms
  • 内存:394460kb
  • [2024-10-09 16:43:55]
  • 提交

answer

#include "inv.h"

const int N = 1e8+2;
const int P = 998244353;

int invv[N];

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

int inv(int x)
{
	if(x < N){
		return invv[x];
	} else {
		return P - 1ll * (P / x) * inv(P%x) % P;
	}
}

詳細信息


Pretests


Final Tests

Test #1:

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

Test #2:

score: 0
Wrong Answer
time: 788ms
memory: 394400kb

Test #3:

score: 0
Wrong Answer
time: 744ms
memory: 394460kb