結果
| 問題 |
No.523 LED
|
| コンテスト | |
| ユーザー |
oxyshower
|
| 提出日時 | 2020-01-23 12:26:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,086 bytes |
| コンパイル時間 | 1,613 ms |
| コンパイル使用メモリ | 169,236 KB |
| 実行使用メモリ | 159,500 KB |
| 最終ジャッジ日時 | 2024-07-19 03:05:21 |
| 合計ジャッジ時間 | 21,818 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 TLE * 1 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
#define int long long
struct Combination{
const int MOD = 1e9+7;
vector<int> fact; // fact[i] = iの階乗
void init(int n){
fact.resize(n+1);
fact[0] = fact[1] = 1;
for(int i = 2; i <= n; i++){
fact[i] = i * fact[i-1] % MOD;
}
}
int nCr(int n, int r){ // nCr = n!/r!(n-r)!
if(n < r) return 0;
return fact[n] * mod_pow(fact[r]*fact[n-r]%MOD, MOD-2, MOD) % MOD;
}
int mod_pow(int n, int p, int MOD){ // a/n ≡ a*n^(p-2) nとpは互いに素
int r = 1;
for(; p > 0; p >>= 1){
if(p & 1LL) r = (r * n) % MOD;
n = (n * n) % MOD;
}
return r; // r = n^p % MOD
}
}comb;
const int MOD = 1e9 + 7;
signed main(){
int n; cin >> n;
int ans = 1;
comb.init(1e7 * 2);
for(int i = 1; i <= n; i++){
//ans = (ans * comb.nCr(n * 2 - (i-1) * 2, 2)) % MOD;
ans = (ans * (n * 2 - (i-1) * 2) % MOD * (n * 2 - (i-1) * 2 - 1) % MOD * comb.mod_pow(2, MOD-2, MOD)) % MOD;
}
cout << ans << endl;
return 0;
}
oxyshower