結果

問題 No.3662 yuu Hates Sigma Problem
コンテスト
ユーザー t98slider
提出日時 2026-08-30 15:10:02
言語 C++23
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 38 ms / 2,000 ms
+ 665µs
コード長 810 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,168 ms
コンパイル使用メモリ 374,980 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-30 15:10:59
合計ジャッジ時間 7,739 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
サブタスク 配点 結果
subtask1. 20 % AC * 19
subtask2. 30 % AC * 13
subtask3. 50 % AC * 49
合計 2.5 * 100% = 250 点
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using mint = atcoder::modint998244353;

template<class T> istream& operator >> (istream& is, vector<T>& vec) {
    for(T& x : vec) is >> x;
    return is;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;
    array<mint, 18> cnt;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        for(int j = 0; j < 18; j++){
            if(i >> j & 1) cnt[j]++;
        }
    }
    mint ans;
    for(int i = 0; i < n; i++){
        mint pow2 = 1, coef = 0;
        for(int j = 0; j < 18; j++){
            coef += (i >> j & 1 ? n - cnt[j] : cnt[j]) * pow2;
            pow2 += pow2;
        }
        ans += mint::raw(a[i]) * coef;
    }
    cout << ans.val() << '\n';
}
0