結果

問題 No.3662 yuu Hates Sigma Problem
コンテスト
ユーザー ルク
提出日時 2026-08-30 13:51:13
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 373 ms / 2,000 ms
+ 397µs
コード長 904 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 238 ms
コンパイル使用メモリ 96,244 KB
実行使用メモリ 116,864 KB
最終ジャッジ日時 2026-08-30 13:52:05
合計ジャッジ時間 12,282 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
サブタスク 配点 結果
subtask1. 20 % AC * 19
subtask2. 30 % AC * 13
subtask3. 50 % AC * 49
合計 2.5 * 100% = 250 点
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import permutations
from bisect import bisect_left, bisect_right
import random
import math
from collections import deque
from collections import Counter
from collections import defaultdict
inf = 1 << 60


def sgn(x):
    if x > 0:
        return 1
    elif x == 0:
        return 0
    else:
        return -1


def popC(x):
    ans = 0
    while x != 0:
        ans += x % 2
        x //= 2
    return ans


def LI():
    return list(map(int, input().split()))


def II():
    return int(input())


def SI():
    return input()


n = II()
a = LI()
bt = 20
ans = 0
cnt = [0]*bt
mod = 998244353
for i in range(n):
    for j in range(bt):
        if i & (1 << j) != 0:
            cnt[j] += 1
for i in range(n):
    for j in range(bt):
        if i & (1 << j) != 0:
            ans += (n-cnt[j])*pow(2, j, mod)*a[i]
        else:
            ans += cnt[j]*pow(2, j, mod)*a[i]
print(ans%mod)
0