結果

問題 No.2062 Sum of Subset mod 999630629
ユーザー Arpan IndoraArpan Indora
提出日時 2022-08-26 22:54:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,195 bytes
コンパイル時間 1,829 ms
コンパイル使用メモリ 163,164 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 00:58:41
合計ジャッジ時間 3,931 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
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 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

// #include <cmath>
// #include <cstdio>
// #include <vector>
// #include <iostream>
// #include <queue>
// #include <map>
// #include <unordered_map>
// #include <algorithm>
#include <bits/stdc++.h>
#define MAX_SIZE 100005
#define ull unsigned long long
#define MOD1 999630629
#define MOD2 998244353

using namespace std;
int N, C;
int A[MAX_SIZE];

ull modpow(ull base, ull exp, ull modulus) {
  base %= modulus;
  ull result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}

ull pow1(ull x,ull a){
    if(a == 0)
        return 1;

    ull y = pow1(x,a/2)%MOD1;
    y = (y*y)%MOD1;
    if(a%2){
        return (y*x)%MOD1;
    }
    return y%MOD1;
}


void solve(){


    // ull mult = pow(2,N-1);
    ull mult = modpow(2,N-1,MOD1);
    ull ans = 0;
    for(int i =0;i<N;i++){
        ans = (ans + A[i]%MOD1)%MOD1;
        // cout << A[i] << "," << ans << " ";
    }
    // cout << endl;
    cout << (mult*ans)%MOD2 << endl;
}


int main() {
        

    cin >> N;

    for(int i = 0;i<N;i++){
        cin >> A[i];
    }
    solve();
    // cout << pow1(2,100000) << endl;
    return 0;
}
0