Submission #62134372


Source Code Expand

puts gets.to_i.times.map{
	n,k = gets.split.map(&:to_i)
	ds = n.digits 2 # 123 => [3,2,1]
	n0 = ds.count 0
	next -1 if 2.pow(n0)<k
	es = (k-1).digits 2
	ds.map!{|d| d==0 ? (es.shift||0) : d }
	next (ds.reverse*'').to_i(2)
}

Submission Info

Submission Time
Task B - XOR = MOD
User ds14050
Language Ruby (ruby 3.2.2)
Score 500
Code Size 233 Byte
Status AC
Exec Time 1725 ms
Memory 20820 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 1
AC × 29
Set Name Test Cases
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 02_small_00.txt, 02_small_01.txt, 03_random_00.txt, 03_random_01.txt, 03_random_02.txt, 03_random_03.txt, 03_random_04.txt, 03_random_05.txt, 03_random_06.txt, 03_random_07.txt, 03_random_08.txt, 03_random_09.txt, 03_random_10.txt, 03_random_11.txt, 03_random_12.txt, 03_random_13.txt, 03_random_14.txt, 03_random_15.txt, 03_random_16.txt, 03_random_17.txt, 03_random_18.txt, 03_random_19.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 44 ms 17036 KiB
01_handmade_00.txt AC 92 ms 18204 KiB
01_handmade_01.txt AC 44 ms 17148 KiB
01_handmade_02.txt AC 355 ms 19824 KiB
01_handmade_03.txt AC 388 ms 19792 KiB
01_handmade_04.txt AC 1694 ms 19512 KiB
01_handmade_05.txt AC 1712 ms 19648 KiB
02_small_00.txt AC 891 ms 19596 KiB
02_small_01.txt AC 330 ms 19584 KiB
03_random_00.txt AC 388 ms 20064 KiB
03_random_01.txt AC 394 ms 19728 KiB
03_random_02.txt AC 383 ms 19888 KiB
03_random_03.txt AC 396 ms 19812 KiB
03_random_04.txt AC 396 ms 19936 KiB
03_random_05.txt AC 1702 ms 19464 KiB
03_random_06.txt AC 1722 ms 19596 KiB
03_random_07.txt AC 1697 ms 19440 KiB
03_random_08.txt AC 1725 ms 19612 KiB
03_random_09.txt AC 1694 ms 19420 KiB
03_random_10.txt AC 379 ms 19524 KiB
03_random_11.txt AC 379 ms 19812 KiB
03_random_12.txt AC 384 ms 19752 KiB
03_random_13.txt AC 384 ms 20012 KiB
03_random_14.txt AC 378 ms 20820 KiB
03_random_15.txt AC 1626 ms 19448 KiB
03_random_16.txt AC 1583 ms 19748 KiB
03_random_17.txt AC 1590 ms 19744 KiB
03_random_18.txt AC 1574 ms 19228 KiB
03_random_19.txt AC 1593 ms 19388 KiB