Submission #1526339


Source Code Expand

Copy
n,*a=`dd`.split.map &:to_i
h=Hash.new 0
a.each{|e|h[e]+=1}
p [(h.keys.select{|e|h[e]>=4}.max||0)**2,h.keys.select{|e|h[e]>=2}.max(2).reduce(:*)||0].max

Submission Info

Submission Time
Task C - Make a Rectangle
User leafmoon
Language Ruby (2.3.3)
Score 300
Code Size 154 Byte
Status
Exec Time 118 ms
Memory 17412 KB

Compile Error

./Main.rb:1: warning: `&' interpreted as argument prefix
./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 105 ms 15108 KB
2.txt 42 ms 5756 KB
3.txt 118 ms 17412 KB
4.txt 95 ms 12808 KB
5.txt 41 ms 5764 KB
6.txt 70 ms 9344 KB
7.txt 69 ms 9340 KB
8.txt 32 ms 4732 KB
9.txt 62 ms 9728 KB
sample1.txt 8 ms 2044 KB
sample2.txt 8 ms 2044 KB
sample3.txt 8 ms 2044 KB