結果

問題 No.1645 AB's abs
ユーザー chocoruskchocorusk
提出日時 2021-08-13 21:48:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 1,085 bytes
コンパイル時間 4,531 ms
コンパイル使用メモリ 187,320 KB
実行使用メモリ 11,832 KB
最終ジャッジ日時 2023-07-27 04:05:05
合計ジャッジ時間 6,272 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
11,604 KB
testcase_01 AC 5 ms
11,708 KB
testcase_02 AC 6 ms
11,608 KB
testcase_03 AC 5 ms
11,832 KB
testcase_04 AC 5 ms
11,664 KB
testcase_05 AC 5 ms
11,596 KB
testcase_06 AC 5 ms
11,584 KB
testcase_07 AC 5 ms
11,656 KB
testcase_08 AC 7 ms
11,724 KB
testcase_09 AC 6 ms
11,676 KB
testcase_10 AC 6 ms
11,612 KB
testcase_11 AC 6 ms
11,668 KB
testcase_12 AC 6 ms
11,664 KB
testcase_13 AC 9 ms
11,600 KB
testcase_14 AC 8 ms
11,660 KB
testcase_15 AC 9 ms
11,660 KB
testcase_16 AC 9 ms
11,600 KB
testcase_17 AC 9 ms
11,672 KB
testcase_18 AC 9 ms
11,784 KB
testcase_19 AC 9 ms
11,696 KB
testcase_20 AC 9 ms
11,680 KB
testcase_21 AC 9 ms
11,592 KB
testcase_22 AC 9 ms
11,712 KB
testcase_23 AC 9 ms
11,748 KB
testcase_24 AC 10 ms
11,748 KB
testcase_25 AC 9 ms
11,612 KB
testcase_26 AC 10 ms
11,800 KB
testcase_27 AC 9 ms
11,828 KB
testcase_28 AC 10 ms
11,808 KB
testcase_29 AC 9 ms
11,612 KB
testcase_30 AC 9 ms
11,680 KB
testcase_31 AC 10 ms
11,612 KB
testcase_32 AC 9 ms
11,828 KB
testcase_33 AC 10 ms
11,672 KB
testcase_34 AC 10 ms
11,668 KB
testcase_35 AC 9 ms
11,616 KB
testcase_36 AC 9 ms
11,736 KB
testcase_37 AC 10 ms
11,612 KB
testcase_38 AC 8 ms
11,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
using mint=modint998244353;
mint dp[101][21000];
int main()
{
    int n; cin>>n;
    
    
    const int g=10000;
    dp[0][g]=1;
    int a[101];
    for(int i=0; i<n; i++) cin>>a[i];
    for(int i=0; i<n; i++){
        for(int j=0; j<=2*g; j++){
            if(j>=a[i]) dp[i+1][j-a[i]]+=dp[i][j];
            dp[i+1][j+a[i]]+=dp[i][j];
        }
    }
    mint ans=0;
    for(int i=g+1; i<=2*g; i++){
        ans+=dp[n][i]*2*mint(i-g);
    }
    cout<<ans.val()<<endl;
    return 0;
}
0