QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#499434#5. 在线 O(1) 逆元lonelywolf30 2548ms3896kbC++23375b2024-07-31 14:10:512024-11-05 22:02:41

Judging History

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

  • [2024-11-05 22:02:41]
  • 管理员手动重测本题所有提交记录
  • 测评结果:30
  • 用时:2548ms
  • 内存:3896kb
  • [2024-07-31 14:10:51]
  • 评测
  • 测评结果:70
  • 用时:2547ms
  • 内存:3900kb
  • [2024-07-31 14:10:51]
  • 提交

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




詳細信息


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