QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#738401#5. 在线 O(1) 逆元dqw80 5047ms42944kbC++23679b2024-11-12 18:58:212024-11-12 18:58:23

Judging History

你现在查看的是最新测评结果

  • [2024-11-12 18:58:23]
  • 评测
  • 测评结果:80
  • 用时:5047ms
  • 内存:42944kb
  • [2024-11-12 18:58:21]
  • 提交

answer

//  __  __   _  _____ _   _   _____   ______          __
//  \ \/ /  / \|_   _| | | | |  __ \ / __ \ \   /\   / /
//   \  /  / _ \ | | | | | | | |  | | |  | \ \ /  \ / /
//   /  \ / ___ \| | | |_| | | |__| | |__| |\ V /\ V /
//  /_/\_/_/   \_\_|  \___/  |_____/ \___\_\ \_/  \_/ (TM)

#include <bits/stdc++.h>
#include "inv.h"
using namespace std;
#define ll long long
const int mod=998244353;
int invs[10000001];
void init(int p)
{
    invs[1] = 1;
    for (int i = 2; i <= 10000000; i++)
    {
        invs[i] = (mod - (ll)mod / i) * invs[mod % i] % mod;
    }
}
int inv(int x)
{
	if(x<=10000000)return invs[x];
	return mod-(ll)mod/x*inv(mod%x)%mod;
}

詳細信息


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 60ms
memory: 42844kb

Test #2:

score: 20
Accepted
time: 645ms
memory: 42900kb

Test #3:

score: 30
Accepted
time: 3200ms
memory: 42944kb

Test #4:

score: 20
Accepted
time: 5047ms
memory: 42768kb

Test #5:

score: 0
Time Limit Exceeded