QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#738615 | #5. 在线 O(1) 逆元 | dqw | 10 | 145ms | 42288kb | C++23 | 1.0kb | 2024-11-12 19:32:36 | 2024-11-12 19:32:36 |
Judging History
answer
// __ __ _ _____ _ _ _____ ______ __
// \ \/ / / \|_ _| | | | | __ \ / __ \ \ /\ / /
// \ / / _ \ | | | | | | | | | | | | \ \ / \ / /
// / \ / ___ \| | | |_| | | |__| | |__| |\ V /\ V /
// /_/\_/_/ \_\_| \___/ |_____/ \___\_\ \_/ \_/ (TM)
#include <bits/stdc++.h>
#include "inv.h"
using namespace std;
#define ll long long
const int mod=998244353;
struct qhash {
static uint64_t splitmix64(uint64_t x)
{
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const
{
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
unordered_map<int,int,qhash>I;
void init(int p){return;}
int inv(int x)
{
if(x<=1)return x;
if(I.find(x)==I.end())I[x]=mod-1LL*mod/x*inv(mod%x)%mod;
return I[x];
}
詳細信息
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 145ms
memory: 42288kb
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