QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#369212#7774. 基础寄术练习题wsyear25 3ms3712kbC++141.3kb2024-03-27 22:00:212024-03-27 22:00:21

Judging History

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

  • [2024-03-27 22:00:21]
  • 评测
  • 测评结果:25
  • 用时:3ms
  • 内存:3712kb
  • [2024-03-27 22:00:21]
  • 提交

answer

#include <bits/stdc++.h>

#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

template<class T> void chkmn(T &x, T y) { if (y < x) x = y; }
template<class T> void chkmx(T &x, T y) { if (y > x) x = y; }

using namespace std;

const int maxn = 110;

int n, m, k, mod, f[maxn][maxn];

inline void add(int &x, int y) { x += y; if (x >= mod) x -= mod; }
inline void sub(int &x, int y) { x -= y; if (x < 0) x += mod; }
inline int Add(int x, int y) { x += y; if (x >= mod) x -= mod; return x; }
inline int Sub(int x, int y) { x -= y; if (x < 0) x += mod; return x; }

inline int fpw(int a, int p) {
  int res = 1;
  while (p) {
    if (p & 1) res = 1ll * res * a % mod;
    a = 1ll * a * a % mod, p >>= 1;
  }
  return res;
}

int main() {
  cin.tie(nullptr) -> ios::sync_with_stdio(false);
  cin >> n >> m >> k >> mod;
  if (k == 1) {
    f[0][0] = 1;
    rep (i, 1, m) rep (j, 0, n) {
      add(f[i][j], f[i - 1][j]);
      if (j) add(f[i][j], 1ll * f[i - 1][j - 1] * fpw(i, mod - 2) % mod);
    }
    return cout << f[m][n] << '\n', 0;
  }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 0ms
memory: 3624kb

input:

9 16 1 327134593

output:

162102742

result:

ok single line: '162102742'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

11 18 1 834359503

output:

256188485

result:

ok single line: '256188485'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

18 18 1 614802701

output:

552168146

result:

ok single line: '552168146'

Test #4:

score: -10
Wrong Answer
time: 1ms
memory: 3616kb

input:

7 16 2 861918403

output:


result:

wrong answer 1st lines differ - expected: '306693876', found: ''

Subtask #2:

score: 25
Accepted

Test #6:

score: 25
Accepted
time: 2ms
memory: 3692kb

input:

60 98 1 715015339

output:

690737273

result:

ok single line: '690737273'

Test #7:

score: 0
Accepted
time: 3ms
memory: 3696kb

input:

96 97 1 507892589

output:

481151247

result:

ok single line: '481151247'

Test #8:

score: 0
Accepted
time: 3ms
memory: 3688kb

input:

90 95 1 621080027

output:

255353202

result:

ok single line: '255353202'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3648kb

input:

85 94 1 297115421

output:

122254364

result:

ok single line: '122254364'

Test #10:

score: 0
Accepted
time: 3ms
memory: 3648kb

input:

81 91 1 460412027

output:

148037986

result:

ok single line: '148037986'

Subtask #3:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 0ms
memory: 3500kb

input:

29 29 2 545875273

output:


result:

wrong answer 1st lines differ - expected: '171843225', found: ''

Subtask #4:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 3660kb

input:

27 30 2 360712453

output:


result:

wrong answer 1st lines differ - expected: '80987914', found: ''

Subtask #5:

score: 0
Wrong Answer

Test #21:

score: 0
Wrong Answer
time: 1ms
memory: 3508kb

input:

29 38 2 909155077

output:


result:

wrong answer 1st lines differ - expected: '745973305', found: ''

Subtask #6:

score: 0
Wrong Answer

Test #26:

score: 0
Wrong Answer
time: 0ms
memory: 3684kb

input:

57 66 2 767174999

output:


result:

wrong answer 1st lines differ - expected: '315351738', found: ''

Subtask #7:

score: 0
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 0ms
memory: 3620kb

input:

96 96 2 453296971

output:


result:

wrong answer 1st lines differ - expected: '222864385', found: ''