Submission #172225


Source Code Expand

Copy
def calc(start, last, dur)
  if dur == 1 then
    return last - start + 1
  end
  count = 0
  [*start..last].each do |i|
    count += calc(i,last,dur-1)
  end
  return count
end
n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
count = 0
result = 1
pre = 0
a.each do |num|
  if num != -1 and count == 0 then
    pre = num
  elsif num != -1 then
    result *= calc(pre, num, count)
    result /= 1000000007
    count = 0
    pre = num
  else
    count += 1
  end
end


puts result

Submission Info

Submission Time
Task C - タコヤ木
User k242hd_akg
Language Ruby (1.9.3)
Score 0
Code Size 510 Byte
Status WA
Exec Time 2216 ms
Memory 216816 KB

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3
Score / Max Score 0 / 0 0 / 50 0 / 30 0 / 20
Status
WA × 2
TLE × 1
AC × 3
WA × 10
TLE × 1
AC × 5
WA × 17
TLE × 4
AC × 7
WA × 17
TLE × 12
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt
Subtask2 sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt
Subtask3 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask3_01.txt, subtask3_02.txt, subtask3_03.txt, subtask3_04.txt, subtask3_05.txt, subtask3_06.txt, subtask3_07.txt, subtask3_08.txt, subtask3_09.txt, subtask3_10.txt, subtask3_11.txt, subtask3_12.txt
Case Name Status Exec Time Memory
sample_01.txt WA 68 ms 4208 KB
sample_02.txt WA 62 ms 4340 KB
sample_03.txt TLE 2216 ms 215540 KB
subtask1_01.txt AC 64 ms 4208 KB
subtask1_02.txt AC 67 ms 4180 KB
subtask1_03.txt WA 61 ms 4208 KB
subtask1_04.txt WA 63 ms 4204 KB
subtask1_05.txt WA 61 ms 4220 KB
subtask1_06.txt WA 60 ms 4208 KB
subtask1_07.txt TLE 2031 ms 5356 KB
subtask1_08.txt AC 64 ms 4336 KB
subtask1_09.txt WA 61 ms 4212 KB
subtask1_10.txt WA 67 ms 4208 KB
subtask1_11.txt WA 60 ms 4204 KB
subtask1_12.txt WA 71 ms 4332 KB
subtask2_01.txt AC 59 ms 4212 KB
subtask2_02.txt WA 59 ms 4212 KB
subtask2_03.txt WA 61 ms 4208 KB
subtask2_04.txt WA 60 ms 4208 KB
subtask2_05.txt WA 68 ms 4212 KB
subtask2_06.txt TLE 2032 ms 4464 KB
subtask2_07.txt TLE 2052 ms 49012 KB
subtask2_08.txt AC 70 ms 4208 KB
subtask2_09.txt WA 62 ms 4464 KB
subtask2_10.txt TLE 2029 ms 4596 KB
subtask2_11.txt WA 69 ms 4208 KB
subtask2_12.txt WA 64 ms 4208 KB
subtask3_01.txt AC 59 ms 4212 KB
subtask3_02.txt WA 64 ms 4212 KB
subtask3_03.txt TLE 2191 ms 185972 KB
subtask3_04.txt TLE 2081 ms 67436 KB
subtask3_05.txt TLE 2085 ms 63216 KB
subtask3_06.txt TLE 2047 ms 29344 KB
subtask3_07.txt TLE 2214 ms 216816 KB
subtask3_08.txt AC 65 ms 4296 KB
subtask3_09.txt WA 61 ms 4212 KB
subtask3_10.txt TLE 2045 ms 40700 KB
subtask3_11.txt TLE 2135 ms 119228 KB
subtask3_12.txt TLE 2035 ms 15184 KB