結果
問題 | No.1102 Remnants |
ユーザー | mot |
提出日時 | 2020-07-03 22:50:14 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,415 bytes |
コンパイル時間 | 1,504 ms |
コンパイル使用メモリ | 83,828 KB |
実行使用メモリ | 7,888 KB |
最終ジャッジ日時 | 2023-10-17 05:52:32 |
合計ジャッジ時間 | 24,487 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 581 ms
6,328 KB |
testcase_01 | AC | 580 ms
6,328 KB |
testcase_02 | AC | 581 ms
6,328 KB |
testcase_03 | AC | 583 ms
6,328 KB |
testcase_04 | AC | 582 ms
6,328 KB |
testcase_05 | WA | - |
testcase_06 | AC | 653 ms
6,532 KB |
testcase_07 | WA | - |
testcase_08 | AC | 588 ms
6,348 KB |
testcase_09 | AC | 602 ms
6,392 KB |
testcase_10 | AC | 584 ms
6,332 KB |
testcase_11 | AC | 597 ms
6,372 KB |
testcase_12 | AC | 606 ms
6,396 KB |
testcase_13 | AC | 603 ms
6,392 KB |
testcase_14 | AC | 807 ms
7,036 KB |
testcase_15 | AC | 755 ms
6,868 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 734 ms
6,784 KB |
testcase_20 | AC | 627 ms
6,460 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 795 ms
6,960 KB |
testcase_25 | WA | - |
testcase_26 | AC | 607 ms
6,404 KB |
testcase_27 | AC | 700 ms
6,680 KB |
ソースコード
#include<iostream> #include<iomanip> #include<cmath> #include<string> #include<vector> #include<list> #include<algorithm> #include<map> #include<set> #include<queue> #include<stack> using namespace std; typedef long long ll; #define fi first #define se second #define mp make_pair #define rep(i, n) for(int i=0;i<n;++i) #define rrep(i, n) for(int i=n;i>=0;--i) const int inf=1e9+7; const ll mod=1e9+7; const ll big=1e18; const double PI=2*asin(1); ll fact1[200005]; ll fact2[200005]; ll N, K; ll getcomb(ll a, ll b){ ll ue = fact2[a-K]; ll shita1=1, shita2=1, tmpshita1, tmpshita2; ll h = mod-2; ll two; while(h>0){ tmpshita1 = fact1[b]; tmpshita2 = fact2[a-b-K]; two = 1; while(2*two<=h){ two *= 2; tmpshita1 *= tmpshita1; tmpshita1 %= mod; tmpshita2 *= tmpshita2; tmpshita2 %= mod; } h -= two; shita1 *= tmpshita1; shita2 *= tmpshita2; shita1 %= mod; shita2 %= mod; } return ue*shita1%mod*shita2%mod; } int main() { fact1[0] = 1; ll tmp = 1; cin>>N>>K; for(ll i=0;i<110000000;++i){ if(i>0) tmp *= i; tmp %= mod; if(i<100005){ fact1[i] = tmp; } if(i>=K && i<K+100005){ fact2[i-K] = tmp; } } ll A[N]; for(int i=0;i<N;++i) cin>>A[i]; ll ans = 0; for(int i=0;i<N;++i){ ans += A[i]*getcomb(K+i, i)%mod*getcomb(K+N-i-1, N-i-1)%mod; ans %= mod; } cout<<ans<<endl; }