QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#629275#5. 在线 O(1) 逆元7_divided_by_370 2473ms3888kbC++20322b2024-10-11 10:11:492024-10-11 10:11:49

Judging History

你现在查看的是测评时间为 2024-10-11 10:11:49 的历史记录

  • [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: 30
Accepted
time: 26ms
memory: 3728kb

Test #2:

score: 40
Accepted
time: 2473ms
memory: 3888kb

Test #3:

score: 0
Time Limit Exceeded