Submission #19680


Source Code Expand

Copy
member,n,times = (gets).chomp.split(' ').map{|i| i.to_i }
pattern = n.times.map{|i|
  (gets).chomp.split(' ').map{|i| i.to_i }
}

total_pattern = [member.times.to_a]
replace = member.times.to_a.combination(2).to_a
times.times{|t|
  l = total_pattern.length
  l.times{|t|
    a = total_pattern.shift
    replace.each{|r|
      b = a.dup
      x = b[r[1]]
      b[r[1]] = b[r[0]]
      b[r[0]] = x
      total_pattern.push(b)
    }
  }
}

collect_pattern = total_pattern.dup.delete_if{|x|
  r = false
  for i in (0...x.length)
    a = [x[i], x[(i + 1) % x.length]]
    if pattern.index(a) || pattern.index(a.reverse)
      r = true
      break
    end
  end
  r
}
puts collect_pattern.length.to_f / total_pattern.length.to_f

Submission Info

Submission Time
Task D - シャッフル席替え
User yuxxxx
Language Ruby (1.9.3)
Score 0
Code Size 756 Byte
Status TLE
Exec Time 10099 ms
Memory 50220 KB

Compile Error

./Main.rb:3: warning: shadowing outer local variable - i
./Main.rb:10: warning: shadowing outer local variable - t

Judge Result

Set Name all
Score / Max Score 0 / 100
Status
AC × 10
TLE × 57
RE × 4
Set Name Test Cases
all 00_mini_01.txt, 00_mini_02.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_rnd_11_01.txt, 01_rnd_11_02.txt, 01_rnd_11_03.txt, 01_rnd_11_04.txt, 01_rnd_11_05.txt, 01_rnd_11_06.txt, 01_rnd_11_07.txt, 01_rnd_11_08.txt, 01_rnd_11_09.txt, 01_rnd_11_10.txt, 01_rnd_11_11.txt, 01_rnd_11_12.txt, 01_rnd_11_13.txt, 01_rnd_11_14.txt, 01_rnd_11_15.txt, 01_rnd_11_16.txt, 01_rnd_11_17.txt, 01_rnd_11_18.txt, 01_rnd_11_19.txt, 01_rnd_11_20.txt, 01_rnd_11_21.txt, 01_rnd_11_22.txt, 01_rnd_7_01.txt, 01_rnd_7_02.txt, 01_rnd_7_03.txt, 01_rnd_7_04.txt, 01_rnd_7_05.txt, 01_rnd_7_06.txt, 01_rnd_7_07.txt, 01_rnd_7_08.txt, 01_rnd_7_09.txt, 01_rnd_7_10.txt, 01_rnd_7_11.txt, 01_rnd_7_12.txt, 01_rnd_7_13.txt, 01_rnd_7_14.txt, 01_rnd_7_15.txt, 01_rnd_7_16.txt, 01_rnd_7_17.txt, 01_rnd_7_18.txt, 01_rnd_7_19.txt, 01_rnd_7_20.txt, 01_rnd_7_21.txt, 01_rnd_7_22.txt, 01_rnd_8_01.txt, 01_rnd_8_02.txt, 01_rnd_8_03.txt, 01_rnd_8_04.txt, 01_rnd_8_05.txt, 01_rnd_8_06.txt, 01_rnd_8_07.txt, 01_rnd_8_08.txt, 01_rnd_8_09.txt, 01_rnd_8_10.txt, 01_rnd_8_11.txt, 01_rnd_8_12.txt, 01_rnd_8_13.txt, 01_rnd_8_14.txt, 01_rnd_8_15.txt, 01_rnd_8_16.txt, 01_rnd_8_17.txt, 01_rnd_8_18.txt, 01_rnd_8_19.txt, 01_rnd_8_20.txt, 01_rnd_8_21.txt, 01_rnd_8_22.txt
Case Name Status Exec Time Memory
00_mini_01.txt AC 57 ms 4244 KB
00_mini_02.txt AC 58 ms 4132 KB
00_sample_01.txt AC 68 ms 4184 KB
00_sample_02.txt TLE 10051 ms 21832 KB
00_sample_03.txt AC 61 ms 4232 KB
01_rnd_11_01.txt TLE 10095 ms 46668 KB
01_rnd_11_02.txt TLE 10075 ms 50220 KB
01_rnd_11_03.txt TLE 10076 ms 46596 KB
01_rnd_11_04.txt TLE 10078 ms 46640 KB
01_rnd_11_05.txt TLE 10098 ms 49476 KB
01_rnd_11_06.txt TLE 10062 ms 49284 KB
01_rnd_11_07.txt TLE 10093 ms 49340 KB
01_rnd_11_08.txt TLE 10062 ms 49464 KB
01_rnd_11_09.txt TLE 10086 ms 45936 KB
01_rnd_11_10.txt TLE 10082 ms 49764 KB
01_rnd_11_11.txt TLE 10081 ms 50052 KB
01_rnd_11_12.txt TLE 10081 ms 46764 KB
01_rnd_11_13.txt AC 59 ms 4240 KB
01_rnd_11_14.txt AC 139 ms 4496 KB
01_rnd_11_15.txt TLE 10080 ms 49340 KB
01_rnd_11_16.txt TLE 10094 ms 49708 KB
01_rnd_11_17.txt TLE 10091 ms 49328 KB
01_rnd_11_18.txt TLE 10097 ms 49368 KB
01_rnd_11_19.txt RE 0 ms 49720 KB
01_rnd_11_20.txt TLE 10074 ms 49440 KB
01_rnd_11_21.txt TLE 10074 ms 46832 KB
01_rnd_11_22.txt TLE 10099 ms 46528 KB
01_rnd_7_01.txt TLE 10064 ms 28816 KB
01_rnd_7_02.txt TLE 10060 ms 28836 KB
01_rnd_7_03.txt TLE 10071 ms 28892 KB
01_rnd_7_04.txt TLE 10069 ms 29040 KB
01_rnd_7_05.txt TLE 10050 ms 28984 KB
01_rnd_7_06.txt TLE 10056 ms 28780 KB
01_rnd_7_07.txt TLE 10060 ms 28796 KB
01_rnd_7_08.txt TLE 10063 ms 29008 KB
01_rnd_7_09.txt TLE 10070 ms 28796 KB
01_rnd_7_10.txt TLE 10074 ms 28944 KB
01_rnd_7_11.txt TLE 10062 ms 28768 KB
01_rnd_7_12.txt TLE 10060 ms 28816 KB
01_rnd_7_13.txt TLE 10047 ms 28860 KB
01_rnd_7_14.txt TLE 10064 ms 28816 KB
01_rnd_7_15.txt RE 0 ms 29084 KB
01_rnd_7_16.txt TLE 10071 ms 28836 KB
01_rnd_7_17.txt TLE 10061 ms 28964 KB
01_rnd_7_18.txt TLE 10052 ms 28848 KB
01_rnd_7_19.txt TLE 10059 ms 28764 KB
01_rnd_7_20.txt TLE 10058 ms 28956 KB
01_rnd_7_21.txt TLE 10048 ms 28952 KB
01_rnd_7_22.txt AC 308 ms 5256 KB
01_rnd_8_01.txt TLE 10052 ms 36468 KB
01_rnd_8_02.txt TLE 10066 ms 33728 KB
01_rnd_8_03.txt TLE 10066 ms 36144 KB
01_rnd_8_04.txt RE 0 ms 36408 KB
01_rnd_8_05.txt TLE 10063 ms 36480 KB
01_rnd_8_06.txt TLE 10071 ms 33728 KB
01_rnd_8_07.txt TLE 10083 ms 36088 KB
01_rnd_8_08.txt TLE 10056 ms 36188 KB
01_rnd_8_09.txt TLE 10066 ms 35900 KB
01_rnd_8_10.txt TLE 10066 ms 33396 KB
01_rnd_8_11.txt TLE 10075 ms 36112 KB
01_rnd_8_12.txt TLE 10065 ms 36088 KB
01_rnd_8_13.txt AC 62 ms 4236 KB
01_rnd_8_14.txt TLE 10074 ms 36028 KB
01_rnd_8_15.txt RE 0 ms 36156 KB
01_rnd_8_16.txt TLE 10070 ms 36208 KB
01_rnd_8_17.txt TLE 10080 ms 36160 KB
01_rnd_8_18.txt AC 780 ms 7504 KB
01_rnd_8_19.txt TLE 10073 ms 36172 KB
01_rnd_8_20.txt TLE 10052 ms 36124 KB
01_rnd_8_21.txt AC 813 ms 7508 KB
01_rnd_8_22.txt TLE 10074 ms 33392 KB