QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#629275#5. 在线 O(1) 逆元7_divided_by_330 2472ms3884kbC++20322b2024-10-11 10:11:492024-11-05 22:05:19

Judging History

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

  • [2024-11-05 22:05:19]
  • 管理员手动重测本题所有提交记录
  • 测评结果:30
  • 用时:2472ms
  • 内存:3884kb
  • [2024-10-11 10:11:49]
  • 评测
  • 测评结果:70
  • 用时:2473ms
  • 内存:3888kb
  • [2024-10-11 10:11:49]
  • 提交

answer

int modp;
void init(int p)
{
    modp=p;   
}

constexpr long long powp(long long a,long long b,long long p)
{
    long long res=1;
    a%=p;
    while(b)
    {
        if(b&1)res=(res*a)%p;
        a=(a*a)%p;
        b>>=1;
    }
    return res;
}

int inv(int x)
{
    return powp(x,modp-2,modp);
}

Details


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 25ms
memory: 3840kb

Test #2:

score: 20
Accepted
time: 2472ms
memory: 3884kb

Test #3:

score: 0
Time Limit Exceeded

Test #4:

score: 0
Time Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded