結果

問題 No.940 ワープ ε=ε=ε=ε=ε=│;p>д<│
ユーザー yakkiyakki
提出日時 2019-12-03 03:25:37
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,797 bytes
コンパイル時間 1,724 ms
コンパイル使用メモリ 93,172 KB
実行使用メモリ 55,748 KB
最終ジャッジ日時 2023-08-18 23:25:18
合計ジャッジ時間 10,522 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
50,276 KB
testcase_01 AC 82 ms
50,420 KB
testcase_02 AC 84 ms
50,272 KB
testcase_03 AC 215 ms
50,512 KB
testcase_04 WA -
testcase_05 AC 97 ms
50,364 KB
testcase_06 AC 86 ms
50,244 KB
testcase_07 AC 91 ms
50,316 KB
testcase_08 AC 87 ms
50,364 KB
testcase_09 AC 92 ms
50,264 KB
testcase_10 AC 76 ms
50,232 KB
testcase_11 AC 83 ms
50,240 KB
testcase_12 AC 96 ms
50,276 KB
testcase_13 AC 96 ms
50,260 KB
testcase_14 AC 79 ms
50,236 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



ll fac[2000000];
ll finv[2000000];
ll inv[2000000];

void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    repr(i,2,2000000){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

ll COM(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

ll modpow(ll a, ll n, ll m){
    if(n == 0) return 1;
    ll half = modpow(a,n/2,m);
    ll res = half * half % m;
    if(n & 1) res = res * a % m;
    return res;
}

int main(){
    COMinit();
    int X,Y,Z; cin >> X >> Y >> Z;
    vector<ll> now(X+Y+Z);
    vector<ll> ans(X+Y+Z);
    ll res = 0;
    rep(i,X+Y+Z){
        if(i >= 1){
            repr(j,1,i+1){
                now[i] += COM(i+1,j)*ans[j-1];
                now[i] %= MOD;
            }
        }
        ans[i] += COM(X+i,i)*COM(Y+i,i)%MOD*COM(Z+i,i)%MOD-(i == 0?0:now[i]);
        ans[i] %= MOD;
        if(ans[i] < 0) ans[i] += MOD;
        res += ans[i];
        res %= MOD;
    }
    cout << res << endl;
    

}

0