結果
問題 | No.766 金魚すくい |
ユーザー | ミドリムシ |
提出日時 | 2018-12-14 14:30:19 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,219 bytes |
コンパイル時間 | 921 ms |
コンパイル使用メモリ | 75,796 KB |
実行使用メモリ | 160,344 KB |
最終ジャッジ日時 | 2024-09-25 05:02:21 |
合計ジャッジ時間 | 14,610 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 186 ms
159,364 KB |
testcase_01 | AC | 183 ms
159,296 KB |
testcase_02 | AC | 186 ms
159,444 KB |
testcase_03 | WA | - |
testcase_04 | AC | 184 ms
159,300 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 186 ms
159,368 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 396 ms
160,176 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 228 ms
159,468 KB |
testcase_36 | AC | 227 ms
159,488 KB |
testcase_37 | AC | 397 ms
160,032 KB |
testcase_38 | AC | 401 ms
160,132 KB |
testcase_39 | AC | 390 ms
160,212 KB |
testcase_40 | AC | 388 ms
160,032 KB |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 187 ms
159,296 KB |
testcase_44 | AC | 184 ms
159,312 KB |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <cmath> #include <iomanip> using namespace std; template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; } template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; } template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; } template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; } template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; } template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; } long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }} struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); } template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; } template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } } template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; } #define mod long(1e9 + 7) #define all(x) (x).begin(), (x).end() #define bitcount(n) __builtin_popcountl(long(n)) #define fcout cout << fixed << setprecision(10) #define highest(x) (63 - __builtin_clzl(x)) struct combination{ vector<long> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } long C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } }; combination table(1e7); int main(){ int N, M; long P; cin >> N >> M >> P; P = P * power(100, mod - 2, mod) % mod; long V[N]; for(int i = 0; i < N; i++){ cin >> V[i]; } long ans = 0, sum = 0; for(int i = 0; i < N; i++){ ans += sum * power((1 - P + mod) % mod, i, mod) % mod * power(P, M - 1, mod) % mod * table.C(i + M - 1, i) % mod * P % mod; sum = (sum + V[i]) % mod; } for(int i = 0; i < M; i++){ ans += sum * power((1 - P + mod) % mod, N - 1, mod) % mod * power(P, i, mod) % mod * table.C(i + N - 1, i) % mod * (1 - P + mod) % mod; } cout << ans % mod << endl; }