Submission #1567747


Source Code Expand

n = gets.strip.to_i
integers = gets.split(' ').map(&:to_i).sort

count = 0
max = 0

(1..n).each do |i|
  count = 0
  integers.each do |int|
    if int == i || int + 1 == i || int - 1 == i
      count += 1
    end
  end
  max = count if count > max
  break if count == n
end

if max == 0
  puts 1
else
  puts max
end

Submission Info

Submission Time
Task C - Together
User inohiro
Language Ruby (2.3.3)
Score 0
Code Size 338 Byte
Status TLE
Exec Time 2108 ms
Memory 9728 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 5
TLE × 4
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt
Case Name Status Exec Time Memory
0_000.txt AC 7 ms 1788 KiB
0_001.txt AC 7 ms 1788 KiB
0_002.txt AC 7 ms 1788 KiB
1_003.txt AC 7 ms 1788 KiB
1_004.txt AC 51 ms 9328 KiB
1_005.txt TLE 2108 ms 9652 KiB
1_006.txt TLE 2108 ms 9712 KiB
1_007.txt TLE 2108 ms 9728 KiB
1_008.txt TLE 2108 ms 9600 KiB