Submission #54162917


Source Code Expand

Copy
N,M = gets.split.map(&:to_i)
N1 = N+1 # 1 to N and zero
c = 1
p 60.times.sum{|i|
cyc,rem = N1.divmod c *= 2
next M[i]*(c/2*cyc+[rem-c/2,0].max)
}%998244353
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
N,M = gets.split.map(&:to_i)
N1 = N+1 # 1 to N and zero
c = 1
p 60.times.sum{|i|
	cyc,rem = N1.divmod c *= 2
	next M[i]*(c/2*cyc+[rem-c/2,0].max)
}%998244353

Submission Info

Submission Time
Task D - Masked Popcount
User ds14050
Language Ruby (ruby 3.2.2)
Score 400
Code Size 165 Byte
Status AC
Exec Time 42 ms
Memory 17380 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 49
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt
Case Name Status Exec Time Memory
sample_01.txt AC 42 ms 17360 KB
sample_02.txt AC 41 ms 17196 KB
sample_03.txt AC 41 ms 17252 KB
test_01.txt AC 41 ms 17224 KB
test_02.txt AC 42 ms 17248 KB
test_03.txt AC 41 ms 17144 KB
test_04.txt AC 41 ms 17244 KB
test_05.txt AC 41 ms 17180 KB
test_06.txt AC 41 ms 17364 KB
test_07.txt AC 41 ms 17232 KB
test_08.txt AC 41 ms 17180 KB
test_09.txt AC 42 ms 17324 KB
test_10.txt AC 41 ms 17280 KB
test_11.txt AC 42 ms 17232 KB
test_12.txt AC 41 ms 17264 KB
test_13.txt AC 41 ms 17288 KB
test_14.txt AC 42 ms 17248 KB
test_15.txt AC 42 ms 17220 KB
test_16.txt AC 41 ms 17212 KB
test_17.txt AC 41 ms 17284 KB
test_18.txt AC 41 ms 17292 KB
test_19.txt AC 41 ms 17252 KB
test_20.txt AC 42 ms 17196 KB
test_21.txt AC 42 ms 17296 KB
test_22.txt AC 41 ms 17272 KB
test_23.txt AC 42 ms 17200 KB
test_24.txt AC 41 ms 17248 KB
test_25.txt AC 41 ms 17276 KB
test_26.txt AC 41 ms 17364 KB
test_27.txt AC 41 ms 17180 KB
test_28.txt AC 41 ms 17124 KB
test_29.txt AC 41 ms 17292 KB
test_30.txt AC 41 ms 17380 KB
test_31.txt AC 41 ms 17236 KB
test_32.txt AC 41 ms 17232 KB
test_33.txt AC 41 ms 17216 KB
test_34.txt AC 41 ms 17212 KB
test_35.txt AC 41 ms 17192 KB
test_36.txt AC 41 ms 17360 KB
test_37.txt AC 41 ms 17232 KB
test_38.txt AC 42 ms 17276 KB
test_39.txt AC 42 ms 17264 KB
test_40.txt AC 41 ms 17200 KB
test_41.txt AC 41 ms 17232 KB
test_42.txt AC 41 ms 17148 KB
test_43.txt AC 41 ms 17152 KB
test_44.txt AC 42 ms 17364 KB
test_45.txt AC 41 ms 17288 KB
test_46.txt AC 41 ms 17356 KB


2025-04-08 (Tue)
12:49:31 +00:00