QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#738615#5. 在线 O(1) 逆元dqw10 145ms42288kbC++231.0kb2024-11-12 19:32:362024-11-12 19:32:36

Judging History

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

  • [2024-11-12 19:32:36]
  • 评测
  • 测评结果:10
  • 用时:145ms
  • 内存:42288kb
  • [2024-11-12 19:32:36]
  • 提交

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];
}

Details


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