QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#676876#5. 在线 O(1) 逆元xmseer0 0ms0kbC++17252b2024-10-26 01:54:432024-11-05 22:07:27

Judging History

This is the latest submission verdict.

  • [2024-11-05 22:07:27]
  • 管理员手动重测本题所有提交记录
  • Verdict: 0
  • Time: 0ms
  • Memory: 0kb
  • [2024-10-26 01:54:43]
  • Judged
  • Verdict: 0
  • Time: 0ms
  • Memory: 0kb
  • [2024-10-26 01:54:43]
  • Submitted

answer

#include"inv.h"
#include<cstdio>
constexpr int N = 1e8+7;
int ans[N];

void init(int p)
{
    ans[1] = 1;
    for(int i=2;i<=N-7;i++)
    {
        ans[i] = 1ll * (p - p/i) * ans[p%i] % p;
    }
}
int inv(int x)
{
    return ans[x];
}

Details


Pretests


Final Tests

Test #1:

score: 0
Runtime Error

Test #2:

score: 0
Runtime Error

Test #3:

score: 0
Runtime Error

Test #4:

score: 0
Runtime Error

Test #5:

score: 0
Runtime Error