結果
| 問題 |
No.940 ワープ ε=ε=ε=ε=ε=│;p>д<│
|
| コンテスト | |
| ユーザー |
tempura_pp
|
| 提出日時 | 2019-12-03 00:34:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 212 ms / 5,000 ms |
| コード長 | 1,624 bytes |
| コンパイル時間 | 930 ms |
| コンパイル使用メモリ | 102,408 KB |
| 実行使用メモリ | 97,828 KB |
| 最終ジャッジ日時 | 2024-11-28 09:56:23 |
| 合計ジャッジ時間 | 6,749 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 22 |
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
vector<ll> inv,fact,invfact;
void mod_build(int n=101010){
fact.resize(n+1);
inv.resize(n+1);
invfact.resize(n+1);
fact[0]=inv[0]=invfact[0]=1;
inv[1]=1;
rep(i,n){
fact[i+1]=fact[i]*(i+1)%mod;
if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
invfact[i+1]=invfact[i]*inv[i+1]%mod;
}
}
ll perm(int n,int k){
if(n<0||k<0||k>n)return 0;
return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
if(n<0||k<0||k>n)return 0;
return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}
ll powmod(ll n,ll k){
k%=mod-1;
if(k<0)k+=mod-1;
ll ret=1;
while(k){
if(k&1)ret=ret*n%mod;
n=n*n%mod;
k>>=1;
}
return ret;
}
int main(){
int x,y,z;
cin>>x>>y>>z;
if(x+y+z==0){
cout<<1<<endl;
return 0;
}
mod_build(3234567);
vector<ll> calc(x+y+z+1);
vector<ll> sum(x+y+z+1);
ll ans =0;
sum[0]=1;
int n = x+y+z;
rep(i,n){
sum[i+1]=3*mod+comb(n+1,i+1)-2*sum[i];
sum[i+1]%=mod;
}
REP(i,1,x+y+z+1){
ll ret = comb(x+i-1,x)*comb(y+i-1,y)%mod*comb(z+i-1,z)%mod;
if((n-i)%2==0)ans+=ret*sum[n-i]%mod;
else ans+=mod-ret*sum[n-i]%mod;
ans%=mod;
}
//rep(i,x+y+z+1)cout<<calc[i]<<" ";
cout<<ans%mod<<endl;
return 0;
}
tempura_pp