結果
問題 | No.797 Noelちゃんとピラミッド |
ユーザー | ganariya |
提出日時 | 2019-03-15 21:51:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 180 ms / 2,000 ms |
コード長 | 7,377 bytes |
コンパイル時間 | 1,367 ms |
コンパイル使用メモリ | 138,432 KB |
最終ジャッジ日時 | 2025-01-06 22:22:02 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 131 ms
23,460 KB |
testcase_01 | AC | 126 ms
22,680 KB |
testcase_02 | AC | 143 ms
23,384 KB |
testcase_03 | AC | 167 ms
22,532 KB |
testcase_04 | AC | 172 ms
21,608 KB |
testcase_05 | AC | 173 ms
22,800 KB |
testcase_06 | AC | 171 ms
22,256 KB |
testcase_07 | AC | 168 ms
23,020 KB |
testcase_08 | AC | 172 ms
21,388 KB |
testcase_09 | AC | 169 ms
22,188 KB |
testcase_10 | AC | 169 ms
22,852 KB |
testcase_11 | AC | 173 ms
22,860 KB |
testcase_12 | AC | 168 ms
22,848 KB |
testcase_13 | AC | 165 ms
21,356 KB |
testcase_14 | AC | 175 ms
21,636 KB |
testcase_15 | AC | 168 ms
22,276 KB |
testcase_16 | AC | 165 ms
21,724 KB |
testcase_17 | AC | 167 ms
23,440 KB |
testcase_18 | AC | 166 ms
21,596 KB |
testcase_19 | AC | 168 ms
22,964 KB |
testcase_20 | AC | 165 ms
22,792 KB |
testcase_21 | AC | 173 ms
23,232 KB |
testcase_22 | AC | 170 ms
21,480 KB |
testcase_23 | AC | 157 ms
22,808 KB |
testcase_24 | AC | 138 ms
21,024 KB |
testcase_25 | AC | 152 ms
22,516 KB |
testcase_26 | AC | 149 ms
22,856 KB |
testcase_27 | AC | 166 ms
22,984 KB |
testcase_28 | AC | 163 ms
21,356 KB |
testcase_29 | AC | 137 ms
22,180 KB |
testcase_30 | AC | 145 ms
22,520 KB |
testcase_31 | AC | 161 ms
21,224 KB |
testcase_32 | AC | 141 ms
23,656 KB |
testcase_33 | AC | 155 ms
22,132 KB |
testcase_34 | AC | 144 ms
21,752 KB |
testcase_35 | AC | 165 ms
23,272 KB |
testcase_36 | AC | 134 ms
22,872 KB |
testcase_37 | AC | 163 ms
22,124 KB |
testcase_38 | AC | 180 ms
23,184 KB |
testcase_39 | AC | 150 ms
22,788 KB |
testcase_40 | AC | 128 ms
23,852 KB |
testcase_41 | AC | 132 ms
22,104 KB |
testcase_42 | AC | 147 ms
21,904 KB |
testcase_43 | AC | 126 ms
22,776 KB |
testcase_44 | AC | 124 ms
22,252 KB |
testcase_45 | AC | 123 ms
22,088 KB |
testcase_46 | AC | 124 ms
21,892 KB |
testcase_47 | AC | 128 ms
23,568 KB |
testcase_48 | AC | 124 ms
22,596 KB |
testcase_49 | AC | 125 ms
21,724 KB |
testcase_50 | AC | 123 ms
21,172 KB |
testcase_51 | AC | 124 ms
22,592 KB |
testcase_52 | AC | 124 ms
22,852 KB |
testcase_53 | AC | 127 ms
21,792 KB |
testcase_54 | AC | 125 ms
22,068 KB |
testcase_55 | AC | 127 ms
21,624 KB |
testcase_56 | AC | 128 ms
22,688 KB |
testcase_57 | AC | 128 ms
22,324 KB |
testcase_58 | AC | 125 ms
21,948 KB |
testcase_59 | AC | 124 ms
23,308 KB |
testcase_60 | AC | 131 ms
21,856 KB |
testcase_61 | AC | 124 ms
21,240 KB |
testcase_62 | AC | 124 ms
21,148 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[2000010]; LL inv[2000010]; 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 <= 1000008; i++) { fac[i] = (fac[i - 1] * i) % mod; inv[i] = pow_mod(fac[i], mod - 2); } } LL ncr_mod(LL n, LL r) { LL d = fac[n] * inv[n - r] % mod * inv[r] % mod; return d; } 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 += ncr_mod(N - 1, i) * a[i]; ans %= mod; } cout << ans << endl; return 0; }