結果
| 問題 | No.3662 yuu Hates Sigma Problem |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-30 15:35:07 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0) |
| 結果 |
AC
|
| 実行時間 | 1,102 ms / 2,000 ms |
| + 665µs | |
| コード長 | 1,329 bytes |
| 記録 | |
| コンパイル時間 | 465 ms |
| コンパイル使用メモリ | 21,536 KB |
| 実行使用メモリ | 33,996 KB |
| 最終ジャッジ日時 | 2026-08-30 15:35:33 |
| 合計ジャッジ時間 | 24,107 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| subtask1. | 20 % | AC * 19 |
| subtask2. | 30 % | AC * 13 |
| subtask3. | 50 % | AC * 49 |
| 合計 | 2.5 * 100% = 250 点 |
ソースコード
import sys
import math
#from collections import deque, defaultdict, Counter
#import heapq
#import bisect
#import itertools
#import functools
# 外部ライブラリ(AtCoder環境で利用可能)
#from sortedcontainers import SortedList, SortedSet, SortedDict
#from atcoder.dsu import DSU
#from atcoder.segtree import SegTree
#from atcoder.lazysegtree import LazySegTree
#from atcoder.fenwicktree import FenwickTree
# 入力高速化
#input = sys.stdin.readline
# 再帰回数上限
# よくあるmod
#MOD = 1000000007
MOD = 998244353
def solve():
# 解答ここから
N = int(input())
bit_cnt = [0] * 20
powers = [(2**i) % MOD for i in range(20)]
for n in range(N):
x = n
i = 0
while x > 0:
bit_cnt[i] += x % 2
x //= 2
i += 1
ans = 0
A = list(map(int, input().split(' ')))
for i in range(N):
x = N
y = i
j = 0
cur = 0
while x > 0:
if y % 2 == 0:
cur = (cur + powers[j] * bit_cnt[j]) % MOD
else:
cur = (cur + powers[j] * (N - bit_cnt[j])) % MOD
x //= 2
y //= 2
j += 1
ans = (ans + A[i] * cur) % MOD
print(ans)
if __name__ == '__main__':
T = 1
for _ in range(T):
solve()