QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#925613 | #5. 在线 O(1) 逆元 | lvliang | 0 | 0ms | 0kb | C++14 | 281b | 2025-03-04 20:32:38 | 2025-03-04 20:32:42 |
Judging History
answer
#include "inv.h"
#include <vector>
#include <iostream>
const int N = 1e7 + 10;
std::vector<int> vec(N);
void init(int p) {
vec[1] = 1;
for (int i = 2; i < N; i++) {
vec[i] = p - p / i * vec[p % i] % p;
}
}
int inv(int x) {
return vec[x];
}
Details
Pretests
Final Tests
Test #1:
score: 0
Runtime Error
Test #2:
score: 0
Runtime Error
Test #3:
score: 0
Runtime Error
Test #4:
score: 0
Runtime Error
Test #5:
score: 0
Runtime Error