QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#499434#5. 在线 O(1) 逆元lonelywolf30 2548ms3896kbC++23375b2024-07-31 14:10:512024-11-05 22:02:41

Judging History

This is the latest submission verdict.

  • [2024-11-05 22:02:41]
  • 管理员手动重测本题所有提交记录
  • Verdict: 30
  • Time: 2548ms
  • Memory: 3896kb
  • [2024-07-31 14:10:51]
  • Judged
  • Verdict: 70
  • Time: 2547ms
  • Memory: 3900kb
  • [2024-07-31 14:10:51]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;

int mod;

int qpow(int a, int b) {
    int res = 1;
    for (; b; b /= 2, a = 1ll * a * a % mod) {
        if (b & 1) {
            res = 1ll * res * a % mod;
        }
    }
    return res;
}

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

int inv(int x) {
    return qpow(x, mod - 2);
}




Details


Pretests


Final Tests

Test #1:

score: 10
Accepted
time: 26ms
memory: 3896kb

Test #2:

score: 20
Accepted
time: 2548ms
memory: 3788kb

Test #3:

score: 0
Time Limit Exceeded

Test #4:

score: 0
Time Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded