Submission #1528001


Source Code Expand

Copy
n=gets.to_i
s=gets.split.map(&:to_i)

t=s.group_by{|i|i}.flat_map{|i,j|[i]*(j.size/2)}.sort.reverse
if t.size>1
  p t[0]*t[1]
else
  p 0
end

Submission Info

Submission Time
Task C - Make a Rectangle
User mayumini
Language Ruby (2.3.3)
Score 300
Code Size 148 Byte
Status
Exec Time 146 ms
Memory 23428 KB

Compile Error

./Main.rb:1: warning: assigned but unused variable - n

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1.txt, sample2.txt, sample3.txt
All 300 / 300 sample1.txt, sample2.txt, sample3.txt, 1.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
1.txt 122 ms 21632 KB
2.txt 38 ms 6528 KB
3.txt 146 ms 23428 KB
4.txt 103 ms 17732 KB
5.txt 38 ms 6524 KB
6.txt 65 ms 11020 KB
7.txt 64 ms 10996 KB
8.txt 29 ms 5376 KB
9.txt 73 ms 13060 KB
sample1.txt 7 ms 1788 KB
sample2.txt 7 ms 1788 KB
sample3.txt 7 ms 1788 KB