QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#499434 | #5. 在线 O(1) 逆元 | lonelywolf | 70 | 2547ms | 3900kb | C++23 | 375b | 2024-07-31 14:10:51 | 2024-07-31 14:10:51 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int mod;
int qpow(int a, int b) {
int res = 1;
for (; b; b /= 2, a = 1ll * a * a % mod) {
if (b & 1) {
res = 1ll * res * a % mod;
}
}
return res;
}
void init(int p) {
mod = p;
}
int inv(int x) {
return qpow(x, mod - 2);
}
Details
Pretests
Final Tests
Test #1:
score: 30
Accepted
time: 26ms
memory: 3900kb
Test #2:
score: 40
Accepted
time: 2547ms
memory: 3832kb
Test #3:
score: 0
Time Limit Exceeded