QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#738328 | #5. 在线 O(1) 逆元 | dqw | 60 | 5600ms | 3912kb | C++23 | 687b | 2024-11-12 18:42:19 | 2024-11-12 18:42:23 |
Judging History
answer
// __ __ _ _____ _ _ _____ ______ __
// \ \/ / / \|_ _| | | | | __ \ / __ \ \ /\ / /
// \ / / _ \ | | | | | | | | | | | | \ \ / \ / /
// / \ / ___ \| | | |_| | | |__| | |__| |\ V /\ V /
// /_/\_/_/ \_\_| \___/ |_____/ \___\_\ \_/ \_/ (TM)
#include <bits/stdc++.h>
#include "inv.h"
using namespace std;
#define ll long long
int inv(int x)
{
ll int a=x;
ll int m = 998244353;
ll int u = 0, v = 1;
while (a != 0)
{
ll int t = m / a;
m -= t * a;
swap(a, m);
u -= t * v;
swap(u, v);
}
return (1ll * u + 998244353) % 998244353;
}
void init(int p){
return;
}
詳細信息
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 12ms
memory: 3912kb
Test #2:
score: 20
Accepted
time: 1121ms
memory: 3704kb
Test #3:
score: 30
Accepted
time: 5600ms
memory: 3828kb
Test #4:
score: 0
Time Limit Exceeded
Test #5:
score: 0
Time Limit Exceeded