QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#468527 | #5. 在线 O(1) 逆元 | yzc358230151 | 10 | 290ms | 42384kb | C++14 | 302b | 2024-07-08 21:21:18 | 2024-11-05 22:00:02 |
Judging History
answer
#include"inv.h"
#include<unordered_map>
using std::unordered_map;
typedef long long ll;
int MOD;
unordered_map<int,int>Inv;
void init(int p){
MOD=p,
Inv[1]=1;
}
int inv(int x){
if(!x)
return 0;
else if(Inv[x])
return Inv[x];
else
return (ll)(MOD-MOD/x)%MOD*inv(MOD%x)%MOD;
}
詳細信息
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 290ms
memory: 42384kb
Test #2:
score: 0
Time Limit Exceeded
Test #3:
score: 0
Time Limit Exceeded
Test #4:
score: 0
Time Limit Exceeded
Test #5:
score: 0
Time Limit Exceeded