Submission #7795963


Source Code Expand

N,M = gets.split.map &:to_i
S = {}
M.times {
  a,b = gets.split.map &:to_i
  cs = gets.split.map &:to_i
  c = cs.map{ |c| 1 << (c-1) }.reduce(:+)
  S[c] ||= a
  S[c] = [S[c], a].min
}
T = S.dup
S.each{ |s,cs|
  T.keys.each{ |t|
    ct = T[t]
    u = (s | t)
    cu = cs + ct
    next if T[u] && cu >= T[u]
    T[u] = cu
  }
}
p T[(1 << N) - 1] || -1

Submission Info

Submission Time
Task E - Get Everything
User Corvvs
Language Ruby (2.3.3)
Score 500
Code Size 368 Byte
Status AC
Exec Time 533 ms
Memory 18300 KiB

Compile Error

./Main.rb:1: warning: `&' interpreted as argument prefix
./Main.rb:4: warning: `&' interpreted as argument prefix
./Main.rb:5: warning: `&' interpreted as argument prefix
./Main.rb:6: warning: shadowing outer local variable - c
./Main.rb:4: warning: assigned but unused variable - b

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 40
Set Name Test Cases
Sample 00-sample-00, 00-sample-01, 00-sample-02
All 00-sample-00, 00-sample-01, 00-sample-02, 01-handmade-03, 01-handmade-04, 01-handmade-05, 01-handmade-06, 01-handmade-07, 02-random-08, 02-random-09, 02-random-10, 02-random-11, 02-random-12, 02-random-13, 02-random-14, 02-random-15, 02-random-16, 02-random-17, 02-random-18, 02-random-19, 02-random-20, 02-random-21, 02-random-22, 02-random-23, 02-random-24, 02-random-25, 02-random-26, 02-random-27, 02-random-28, 02-random-29, 02-random-30, 02-random-31, 02-random-32, 02-random-33, 02-random-34, 02-random-35, 02-random-36, 02-random-37, 02-random-38, 02-random-39
Case Name Status Exec Time Memory
00-sample-00 AC 7 ms 1788 KiB
00-sample-01 AC 7 ms 1788 KiB
00-sample-02 AC 7 ms 1788 KiB
01-handmade-03 AC 11 ms 1788 KiB
01-handmade-04 AC 306 ms 12028 KiB
01-handmade-05 AC 10 ms 1916 KiB
01-handmade-06 AC 53 ms 3452 KiB
01-handmade-07 AC 17 ms 1788 KiB
02-random-08 AC 108 ms 5244 KiB
02-random-09 AC 9 ms 1788 KiB
02-random-10 AC 26 ms 2300 KiB
02-random-11 AC 31 ms 4732 KiB
02-random-12 AC 42 ms 2940 KiB
02-random-13 AC 79 ms 4348 KiB
02-random-14 AC 21 ms 2172 KiB
02-random-15 AC 68 ms 3836 KiB
02-random-16 AC 141 ms 6396 KiB
02-random-17 AC 53 ms 3324 KiB
02-random-18 AC 136 ms 6140 KiB
02-random-19 AC 35 ms 4860 KiB
02-random-20 AC 11 ms 1916 KiB
02-random-21 AC 198 ms 6012 KiB
02-random-22 AC 533 ms 18300 KiB
02-random-23 AC 43 ms 2940 KiB
02-random-24 AC 269 ms 10748 KiB
02-random-25 AC 305 ms 11772 KiB
02-random-26 AC 12 ms 1788 KiB
02-random-27 AC 38 ms 2940 KiB
02-random-28 AC 73 ms 4092 KiB
02-random-29 AC 39 ms 2812 KiB
02-random-30 AC 28 ms 2556 KiB
02-random-31 AC 274 ms 10876 KiB
02-random-32 AC 49 ms 3452 KiB
02-random-33 AC 10 ms 1788 KiB
02-random-34 AC 36 ms 2684 KiB
02-random-35 AC 377 ms 14332 KiB
02-random-36 AC 80 ms 4220 KiB
02-random-37 AC 9 ms 1916 KiB
02-random-38 AC 37 ms 2812 KiB
02-random-39 AC 13 ms 1916 KiB