結果
問題 | No.797 Noelちゃんとピラミッド |
ユーザー | ganariya |
提出日時 | 2019-03-16 16:41:08 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 78 ms / 2,000 ms |
コード長 | 7,358 bytes |
コンパイル時間 | 1,485 ms |
コンパイル使用メモリ | 143,608 KB |
実行使用メモリ | 7,296 KB |
最終ジャッジ日時 | 2024-07-01 22:33:56 |
合計ジャッジ時間 | 7,198 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
6,816 KB |
testcase_01 | AC | 36 ms
6,944 KB |
testcase_02 | AC | 38 ms
6,944 KB |
testcase_03 | AC | 77 ms
7,168 KB |
testcase_04 | AC | 77 ms
7,296 KB |
testcase_05 | AC | 78 ms
7,168 KB |
testcase_06 | AC | 77 ms
7,168 KB |
testcase_07 | AC | 77 ms
7,132 KB |
testcase_08 | AC | 77 ms
7,132 KB |
testcase_09 | AC | 77 ms
7,168 KB |
testcase_10 | AC | 77 ms
7,256 KB |
testcase_11 | AC | 77 ms
7,128 KB |
testcase_12 | AC | 77 ms
7,124 KB |
testcase_13 | AC | 76 ms
7,252 KB |
testcase_14 | AC | 77 ms
7,128 KB |
testcase_15 | AC | 77 ms
7,128 KB |
testcase_16 | AC | 77 ms
7,168 KB |
testcase_17 | AC | 78 ms
7,132 KB |
testcase_18 | AC | 77 ms
7,128 KB |
testcase_19 | AC | 77 ms
7,128 KB |
testcase_20 | AC | 77 ms
7,168 KB |
testcase_21 | AC | 77 ms
7,168 KB |
testcase_22 | AC | 78 ms
7,296 KB |
testcase_23 | AC | 66 ms
6,944 KB |
testcase_24 | AC | 46 ms
6,940 KB |
testcase_25 | AC | 61 ms
6,940 KB |
testcase_26 | AC | 59 ms
6,940 KB |
testcase_27 | AC | 76 ms
7,040 KB |
testcase_28 | AC | 72 ms
7,168 KB |
testcase_29 | AC | 42 ms
6,944 KB |
testcase_30 | AC | 46 ms
6,940 KB |
testcase_31 | AC | 65 ms
6,940 KB |
testcase_32 | AC | 49 ms
6,944 KB |
testcase_33 | AC | 60 ms
6,940 KB |
testcase_34 | AC | 54 ms
6,944 KB |
testcase_35 | AC | 77 ms
7,128 KB |
testcase_36 | AC | 42 ms
6,940 KB |
testcase_37 | AC | 72 ms
7,028 KB |
testcase_38 | AC | 73 ms
7,040 KB |
testcase_39 | AC | 60 ms
6,944 KB |
testcase_40 | AC | 41 ms
6,944 KB |
testcase_41 | AC | 43 ms
6,944 KB |
testcase_42 | AC | 59 ms
6,944 KB |
testcase_43 | AC | 37 ms
6,940 KB |
testcase_44 | AC | 37 ms
6,944 KB |
testcase_45 | AC | 38 ms
6,940 KB |
testcase_46 | AC | 37 ms
6,944 KB |
testcase_47 | AC | 37 ms
6,944 KB |
testcase_48 | AC | 37 ms
6,940 KB |
testcase_49 | AC | 37 ms
6,940 KB |
testcase_50 | AC | 37 ms
6,940 KB |
testcase_51 | AC | 36 ms
6,944 KB |
testcase_52 | AC | 38 ms
6,944 KB |
testcase_53 | AC | 37 ms
6,940 KB |
testcase_54 | AC | 37 ms
6,940 KB |
testcase_55 | AC | 37 ms
6,940 KB |
testcase_56 | AC | 37 ms
6,940 KB |
testcase_57 | AC | 37 ms
6,940 KB |
testcase_58 | AC | 37 ms
6,940 KB |
testcase_59 | AC | 37 ms
6,944 KB |
testcase_60 | AC | 37 ms
6,940 KB |
testcase_61 | AC | 36 ms
6,944 KB |
testcase_62 | AC | 37 ms
6,944 KB |
ソースコード
// // // Codeforces: ganariya // AtCoder: ganariya2525 // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMHBYYYWMMMM#BYYTTTYWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMB9O1==?????zzCC111>>;;;;;;;;;;;<?TMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM9Olll=l======??????????>>>>>>;;;;;;;;;:;?TMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMM9ttlllllllll=l=======?????????>>>>>>;;;;;;;;;;?TMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMBOttOtttttltlllllllll=======??????????>>>>>>>;;;;;;?TMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMBttwOtttttttttttttlllllllll========?????????>>>>>>;;;;;<TMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMBrwZrttttttttttttttttttlllllllllll======???????????>>>>>>;;?HMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMSw0trtrrtrtrttrtttttttttttttlllOllllll========????<<zz??>>>>>>ZMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMX0ttrtrOOttrttrttOOttttttttttttltwllllllllll========??wy?????>>>vZMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMM0ttrI+wV1rtttttttwZtttttttltttOwylOXOllllllllllll=l====1dkz???????vZdMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMSrrwrtwZCjttttttttwSttOlllltllllwtXOlZkOlllllllllllllll==z+dk===?????X2JMMMMMMMMMMMMM // MMMMMMMMMMMMMBrtwwtrw0<jttttttttOXllOttltllttllOZwHOtXkyltlllllllllllllll<+XZ======?dk?JMMMMMMMMMMMM // MMMMMMMMMMMMStwdZtwXC<+ttttttOOOd6ltZlltllllttllStWWOOHWytttttltltOllltllz:zHllll===zX=?dMMMMMMMMMMM // MMMMMMMMMMBrwdKOtwW3;;zrttttwZwXRlldOllltltlltttwlXvktdXWytltttttttOttlttl<<dklllllllZ===dMMMMMMMMMM // MMMMMMMMM8tQM#ttwW3;;;1trttwSwfUOlORltllltlllllldtX>dktDOWOtlttltttOOttltO<;+WOllllllXlllzMMMMMMMMMM // MMMMMMMM9OdM#Ottd$;;;;;<?1z0OKjRltd0llltOllllllldZX>?WOw_WWOtttttttttOttI<;;<dkttttllllllldMMMMMMMMM // MMMMMMM9wMMMSttwS<;;;;>;;;J<j>(I<?U111zltllllllld0X>~dkwl(WkttlttlOOwWk<;;:;;zHttttttwOllllMMMMMMMMM // MMMMMMBdMMM8tttdI+zttttttdSXt~dlzXwlllzzOzzzzzlldkW<~?kOk~?sx++++jdHmH6+++<;;jdZtttttdkOtlldMMMMMMMM // MMMMM#dMMM#tttw0+tttttttdKdf((RsdfRllllldZllltlldWK~~_W0w_~OWOlOdgg9ZtOWOtttz+wktttttdpktttwMMMMMMMM // MMMMMWMMMMSlttdIttttttOdWHH>~(IzWDRll=llzRlllzlldk$>++dkd<~_XkdgH9tttttdktttt+OkrttrtdfpkttOMMMMMMMM // MMMMNWMMM#Zttlk=tttttOXWWd$_.(IdW1R=llll=SlllzOldK<_._(kd6+-(MM9lltttttrWktttztWZttrwXppWttrMMMMMMMM // MMMMNMMMM#lltwDzttllOXyW0X:..(OXk<Rl=ll=lwOlllOld3<``.(Rd>~?CdklllltttttXdXttzOWktrwwWpfpkrtMMMMMMMM // MMMMMMMMM@ltldIzlttOXyW$w$```(OyD(Rl==llldZ=llIlw;~```-Xd:~~~~UkylltttAyHdgSrzObRtOXwpfppWrrMMMMMMMM // MMMMMMMMM@llldtlllldVyW+d>```.wZ$ wl==lI=wRl=ll=w<```` dd_..~~(RZXOQdggHH9ZwrzwHWrdXXppfppkrMMMMMMMM // MMMMMMMMM#llldlltlwyyyD(S-...,Wk] zI=l=llzWzl=l=P~```` jZ``...~zQkH@MBUtrZtrtldHRdSdpfpffpkwMMMMMMMM // MMMMNMMMMNZllXtllldVyW3(Mf=<ONMHP~(k===l=zdk=lld3```...(C````..(M96lttttrrtrrtdHWHXpfpppfpRwMMMMMMMM // MMMMMMMMMMNzzWZllzyyyy(W@` =~MWK6 jz=lzlzvRz=lZ`.I+JgkWm&-. `..(ZltlttttrtttrWWHppfppfpppSdMMMMMMMM // MMMMMMMMMMMkAWRllzVyyS_(b .MNHU-(Uz=lI={XkzO>.dVT7<TMHMNHHx-.(kwZyltttrtrrdHHpfppfpffpp0dMMMMMMMM // MMMMMMMMMMMMKyWzOzyyyk.`<! hdWMH]``(S==t=l(kX2 ?_` WMMHH#HH+.XwkwOttttrwrZ~(HfpfpppfpWwXMMMMMMMM // MMMMMMMMMMMMMHWROOyyyW;` `. (WVM#b```(0=zzz wX!``` a.dM#NM@N(4WhXkXkWtttttwd3O_(HpffpfpfWwSMMMMMMMM // MMMMMMMMMMMMNZvWzXXyyXP```-_ ?o+?!````.4=Z=`(:```` HpbNNMHHH (C=XXyWZWttrdwf:(>.dfppffppSXSMMMMMMMM // MMMMMMMMMMMMMRzuHzXyZXH.``````````````` ?zz ``````` ZKvTHHbWt `` XZyyHZWOdSZ<::~`(fpfpfffXp0WMMMMMMM // MMMMMMMMMMMMMKzyyHvyZZW____.`````````````.I_```````` ?nJzX7^````.WXWyyHyWKZ<:::_`Jffpfpfpfp0WMMMMMMM // MMMMMMMMMMMMM@zZyZWwWyXo-_~(~ ```````````` `````````````` _`````.WXkyyVWmWc::<~ .HffppfffffkXMMMMMMM // MMMMMMMMMMMMMKzZZZZXkUXr~....```````....```````````` ... ````..JXWWyyW83vXx~..WfffVfWVffffkdMMMMMMM // MMMMMMMMMMMMMRzZZZZZZZZb````````````<````````````./<~._<_.____`(WfdyW3<:~~(XWkVVVVVVVHVVVVV0dMMMMMMM // MMMMMMMMMMMMMSzZZZZZZZWX-```````````````````````````.......~~._j9jX=_~~_(XZyVHHkyyyyWHyyykykOMMMMMMM // MMMMMMMMMMMMMSzuuuuuZXWZW,```````````````````````````````.``..(3<! ...JWyyXWyyyWHkyyWHyyyHyklMMMMMMM // MMMMMMMMMMMMNXzuuuXXuXSuuXh,```````` .... ```````````````````_~ .JWyyyyZyy0HyyZyyZyZXWZZZWHZIdMMMMMM // MMMMMMMMMMMMNwtuuuXkuXXuuuuXh,``````(:::~<?71(,``````````````.(UMNUkZZZZZZZHZZ0ZZZZZWWZZZWNXIdMMMMMM // MMMMMMMMMMMMNKOzuzXkuXuuuuuXuXW, ```` _~~~:~~(}```````````.(YC;::<kCfZZZZXO#ZZVZZZZZMZZuuMMNXzMMMMMM // MMMMMMMMMMMMHKOzzuXkzdzzzzuXXzuuU&.``````````````````` .JY>::::;;J=:dZuZuZd#uuruuuud#uuuXMMMNXdMMMMM // MMMMMMMMMMMMMNOvzzXkvMRzzzzXKzuzzzXh, `````````````..JC<;:;;:;;+7<:~(HHuXIdNuuzuuuXMSuuuWMMMMROMMMMM // MMMMMMMMMMMMMNvvvrdkvM#vzzzzHzzzzzuzzUG. ``` ...JdY<:;:;:::;;+v<~~~:(HpHmzMNXZzuzzd#zzzdMMMMMMRdMMMM // MMMMMMMMMMMMMNwrrvdRrMNwvvvvdRvvvzwkzzzzXWWHY=~~O+::::::::<+<~~~~~~~dppppWMMkZzzzwM#zzdMMMMMMMMNMMMM // MMMMMMMMMMMMMM#rrrwRrMMbOrrOZNkrvvvXwvvvvvwX;.~._W_:::::(?!~~~~~~~~(HpppppppHWdvwM#XwdMMMMMMMMMMNMMM // MMMMMMMMMMMMMMNyrrrRrWMMmzOrzdNyrrrZNvrwQWWfb....(r~~_J>_.....~.~~-dpfpffpfpppWHHMNdMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMNrtrStdMMMNxzrzMNmrrrdNWfVfffP._-.(~_J!............JpfpffpfpfffpppWNppppHMMMMMMMMMMMM // MMMMMMMMMMMMMMMMNOtXtdMMMMMNxzZMMNmgHyVVVVVW%..?/(.,(x-..........(HfffpffpffpffWHHffpffppfVyyWMMMMMM //include //------------------------------------------ #include <vector> #include <list> #include <map> #include <unordered_map> #include <climits> #include <set> #include <unordered_set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <queue> #include <random> #include <complex> #include <regex> #include <locale> #include <random> #include <type_traits> using namespace std; #define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";} #define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}} using LL = long long; //~~~~~~~~~~~~~~~~~~~~~_(^~^ 」 ∠)_~~~~~~~~~~~~~~~~~~~~~ constexpr LL mod = 1e9 + 7; LL fac[200020]; LL inv[200020]; LL pow_mod(LL n, LL p) { LL ret = 1; while (p > 0) { if (p & 1) ret = (ret * n) % mod; n = (n * n) % mod; p >>= 1; } return ret; } void prepare() { fac[0] = fac[1] = 1LL; inv[0] = inv[1] = 1LL; for (LL i = 2; i <= 200008; i++) { fac[i] = (fac[i - 1] * i) % mod; inv[i] = pow_mod(fac[i], mod - 2); } } LL ncr_mod(LL n, LL r) { return fac[n] * inv[n - r] % mod * inv[r] % mod; } int main() { int N; cin >> N; vector<LL> a(N); for (int i = 0; i < N; i++) cin >> a[i]; prepare(); LL ans = 0; for (int i = 0; i < N; i++) { ans += a[i] * ncr_mod(N - 1, i); ans %= mod; } cout << ans << endl; return 0; }