結果
問題 | No.940 ワープ ε=ε=ε=ε=ε=│;p>д<│ |
ユーザー | 👑tozangezan |
提出日時 | 2019-12-03 13:29:58 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 159 ms / 5,000 ms |
コード長 | 2,582 bytes |
コンパイル時間 | 627 ms |
コンパイル使用メモリ | 88,028 KB |
実行使用メモリ | 108,372 KB |
最終ジャッジ日時 | 2023-08-19 00:41:09 |
合計ジャッジ時間 | 5,568 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge9 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 109 ms
79,780 KB |
testcase_01 | AC | 108 ms
79,776 KB |
testcase_02 | AC | 111 ms
79,772 KB |
testcase_03 | AC | 107 ms
79,816 KB |
testcase_04 | AC | 111 ms
75,620 KB |
testcase_05 | AC | 106 ms
79,780 KB |
testcase_06 | AC | 108 ms
79,788 KB |
testcase_07 | AC | 108 ms
79,732 KB |
testcase_08 | AC | 108 ms
79,716 KB |
testcase_09 | AC | 109 ms
79,788 KB |
testcase_10 | AC | 107 ms
79,728 KB |
testcase_11 | AC | 105 ms
79,772 KB |
testcase_12 | AC | 111 ms
79,816 KB |
testcase_13 | AC | 109 ms
79,652 KB |
testcase_14 | AC | 106 ms
79,804 KB |
testcase_15 | AC | 112 ms
80,436 KB |
testcase_16 | AC | 116 ms
87,888 KB |
testcase_17 | AC | 133 ms
94,092 KB |
testcase_18 | AC | 140 ms
98,064 KB |
testcase_19 | AC | 134 ms
94,100 KB |
testcase_20 | AC | 143 ms
102,284 KB |
testcase_21 | AC | 125 ms
90,072 KB |
testcase_22 | AC | 137 ms
100,248 KB |
testcase_23 | AC | 125 ms
87,956 KB |
testcase_24 | AC | 141 ms
102,224 KB |
testcase_25 | AC | 147 ms
106,380 KB |
testcase_26 | AC | 159 ms
108,372 KB |
ソースコード
// #pragma GCC target("avx2") // CPU 処理並列化 // #pragma GCC optimize("O3") // CPU 処理並列化 // #pragma GCC optimize("unroll-loops") // 条件処理の呼び出しを減らす #include<stdio.h> #include<math.h> #include<algorithm> #include<queue> #include<deque> #include<stack> #include<string> #include<string.h> #include<vector> #include<set> #include<map> #include<bitset> #include<stdlib.h> #include<cassert> #include<time.h> #include<bitset> #include<numeric> #include<unordered_set> #include<complex> using namespace std; const long long mod=1000000007; const long long inf=mod*mod; const long long d2=(mod+1)/2; const double EPS=1e-10; const double INF=1e+10; const double PI=acos(-1.0); const int C_SIZE = 3100000; namespace{ long long fact[C_SIZE]; long long finv[C_SIZE]; long long inv[C_SIZE]; long long Comb(int a,int b){ if(a<b||b<0)return 0; return fact[a]*finv[b]%mod*finv[a-b]%mod; } void init_C(int n){ fact[0]=finv[0]=inv[1]=1; for(int i=2;i<n;i++){ inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod; } for(int i=1;i<n;i++){ fact[i]=fact[i-1]*i%mod; finv[i]=finv[i-1]*inv[i]%mod; } } long long pw(long long a,long long b){ if(a<0LL)return 0; if(b<0LL)return 0; long long ret=1; while(b){ if(b%2)ret=ret*a%mod; a=a*a%mod; b/=2; } return ret; } long long pw_mod(long long a,long long b,long long M){ if(a<0LL)return 0; if(b<0LL)return 0; long long ret=1; while(b){ if(b%2)ret=ret*a%M; a=a*a%M; b/=2; } return ret; } int pw_mod_int(int a,int b,int M){ if(a<0)return 0; if(b<0)return 0; int ret=1; while(b){ if(b%2)ret=(long long)ret*a%M; a=(long long)a*a%M; b/=2; } return ret; } int ABS(int a){return max(a,-a);} long long ABS(long long a){return max(a,-a);} double ABS(double a){return max(a,-a);} int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; } } // ここから編集しろ long long dp[1400000]; long long x[1400000]; long long y[1400000]; int main(){ init_C(3100000); int a,b,c;scanf("%d%d%d",&a,&b,&c); if(a+b+c==0){ printf("1\n");return 0; } for(int i=1;i<=a+b+c;i++){ long long ks=1; ks=Comb(a+i-1,i-1); ks=ks*Comb(b+i-1,i-1)%mod; ks=ks*Comb(c+i-1,i-1)%mod; dp[i]=ks; } for(int i=0;i<=a+b+c+1;i++){ x[i]=Comb(a+b+c+1,i); if((a+b+c+1-i)%2)x[i]=mod-x[i]; } for(int i=a+b+c+1;i>0;i--){ y[i-1]=x[i]; x[i-1]=(x[i-1]+x[i]*2)%mod; } // for(int i=0;i<=a+b+c+1;i++)printf("%lld %lld %lld\n",dp[i],x[i],y[i]); long long ret=0; for(int i=0;i<=a+b+c;i++)ret=(ret+y[i]*dp[i])%mod; printf("%lld\n",ret); }