QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#217122#5. 在线 O(1) 逆元Starrykiller30 2444ms3884kbC++23308b2023-10-16 15:13:272024-11-05 21:53:55

Judging History

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

  • [2024-11-05 21:53:55]
  • 管理员手动重测本题所有提交记录
  • 测评结果:30
  • 用时:2444ms
  • 内存:3884kb
  • [2023-10-16 15:13:27]
  • 评测
  • 测评结果:70
  • 用时:2480ms
  • 内存:3580kb
  • [2023-10-16 15:13:27]
  • 提交

answer

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

using namespace std;
typedef long long ll;
int p;

void init(int mod) {p=mod;}

ll qpow(ll a, ll n) {
	ll res=1;
	while (n) {
		if (n&1) res=res*a%p;
		a=a*a%p; n>>=1;
	}
	return res;
}

int inv(int x) {
	ll res=qpow(x,p-2);
	return int(res);
}

详细


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 25ms
memory: 3884kb

Test #2:

score: 20
Accepted
time: 2444ms
memory: 3756kb

Test #3:

score: 0
Time Limit Exceeded

Test #4:

score: 0
Time Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded