結果

問題 No.995 タピオカオイシクナーレ
ユーザー kuhakukuhaku
提出日時 2020-02-22 02:19:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,534 bytes
コンパイル時間 2,383 ms
コンパイル使用メモリ 197,004 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 18:38:28
合計ジャッジ時間 3,755 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 42 ms
5,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 41 ms
5,376 KB
testcase_21 AC 41 ms
5,376 KB
testcase_22 WA -
testcase_23 AC 42 ms
5,376 KB
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Vec = vector<ll>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

ll PowMod(ll a, ll n){
	if(a < 0) a = (a%MOD+MOD)%MOD;
	if(n == 1) return a;
	if(n%2 == 0) return PowMod(a*a%MOD, n/2);
	return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll inv(ll n){
	return PowMod(n, MOD-2);
}

int main(void){
	ll n, m, k, p, q;
	cin >> n >> m >> k >> p >> q;
	Vec b(n);
	for(ll i = 0; i < n; i++) cin >> b[i];

	ll x = PowMod(q, k), y = PowMod(2*p-q, k);
	ll c = (x+y)*inv(2)%MOD*inv(x)%MOD;
	ll d = (x-y+MOD)%MOD*inv(2)%MOD*inv(x)%MOD;

	ll ans = 0;
	for(ll i = 0; i < n; i++){
		if(i < m) ans += b[i]*c%MOD;
		else ans += b[i]*d%MOD;
		ans %= MOD;
	}
	cout << ans << endl;

	return 0;
}
0