結果

問題 No.940 ワープ ε=ε=ε=ε=ε=│;p>д<│
ユーザー tko919tko919
提出日時 2019-12-04 22:50:47
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,302 bytes
コンパイル時間 1,531 ms
コンパイル使用メモリ 170,220 KB
実行使用メモリ 26,564 KB
最終ジャッジ日時 2023-08-21 04:58:20
合計ジャッジ時間 7,777 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
26,404 KB
testcase_01 AC 97 ms
26,396 KB
testcase_02 AC 97 ms
26,404 KB
testcase_03 AC 98 ms
26,404 KB
testcase_04 WA -
testcase_05 AC 98 ms
26,564 KB
testcase_06 AC 97 ms
26,388 KB
testcase_07 AC 97 ms
26,324 KB
testcase_08 AC 98 ms
26,324 KB
testcase_09 AC 99 ms
26,564 KB
testcase_10 AC 97 ms
26,456 KB
testcase_11 AC 97 ms
26,464 KB
testcase_12 AC 98 ms
26,452 KB
testcase_13 AC 97 ms
26,404 KB
testcase_14 AC 97 ms
26,408 KB
testcase_15 AC 113 ms
26,408 KB
testcase_16 AC 154 ms
26,388 KB
testcase_17 AC 214 ms
26,448 KB
testcase_18 AC 251 ms
26,472 KB
testcase_19 AC 213 ms
26,452 KB
testcase_20 AC 295 ms
26,556 KB
testcase_21 AC 173 ms
26,380 KB
testcase_22 AC 285 ms
26,444 KB
testcase_23 AC 157 ms
26,412 KB
testcase_24 AC 291 ms
26,512 KB
testcase_25 AC 331 ms
26,392 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end

int mod=1e9+7;
struct Mint {
    int val;
    Mint inv() const{
        int tmp,a=val,b=mod,x=1,y=0;
        while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
        return Mint(x);
    }
public:
    Mint():val(0){}
    Mint(ll x){if((val=x%mod)<0)val+=mod;}
    Mint pow(ll t){Mint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
    Mint& operator+=(const Mint& x){if((val+=x.val)>=mod)val-=mod;return *this;}
    Mint& operator-=(const Mint& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
    Mint& operator*=(const Mint& x){val=(ll)val*x.val%mod; return *this;}
    Mint& operator/=(const Mint& x){return *this*=x.inv();}
    Mint operator+(const Mint& x) const{return Mint(*this)+=x;}
    Mint operator-(const Mint& x) const{return Mint(*this)-=x;}
    Mint operator*(const Mint& x) const{return Mint(*this)*=x;}
    Mint operator/(const Mint& x) const{return Mint(*this)/=x;}
};
struct factorial {
    vector<Mint> Fact, Finv;
public:
    factorial(int maxx){
        Fact.resize(maxx+1),Finv.resize(maxx+1); Fact[0]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*(i+1);
        Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*i;
    }
    Mint fact(int n,bool inv=0){if(inv)return Finv[n];else return Fact[n];}
    Mint nPr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[n-r];}
    Mint nCr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[r]*Finv[n-r];}
};

factorial fact(2000010);
Mint coeff[2000010];

int main(){
    int x,y,z; scanf("%d%d%d",&x,&y,&z);
    int n=x+y+z+1;
    rep(i,0,n+1)coeff[i]=fact.nCr(n,i)*((n-i)&1?-1:1);
    coeff[0]-=1;
    rep(i,0,n)coeff[i]/=-2,coeff[i+1]-=coeff[i];
    Mint ans;
    rep(i,0,n)ans+=fact.nCr(i+x-1,x)*fact.nCr(i+y-1,y)*fact.nCr(i+z-1,z)*coeff[i];
    printf("%d\n",ans.val);
    return 0;
}
0