Submission #2857259
Source Code Expand
using System; using System.Linq; using System.Collections.Generic; using static System.Console; class Program { internal static void Main(string[] args) { int N = int.Parse(ReadLine()); var A = ReadLine().Split(' ').Select(s => long.Parse(s)).ToList(); var dic = new Dictionary<long, int>(); for (int i = 0; i < N; i++) { if (dic.ContainsKey(A[i])) { dic[A[i]]++; } else { dic.Add(A[i], 1); } } var max = dic.OrderByDescending(kvp => kvp.Key).First(); if (max.Value >= 4) { WriteLine(Math.Pow(max.Key, 2)); return; } var values = dic.OrderByDescending(kvp => kvp.Key) .Where(kvp => kvp.Value >= 2) .Select(kvp => kvp.Key).ToArray(); if (values.Length < 2) { WriteLine(0); return; } long ans = values[0] * values[1]; WriteLine(ans); } }
Submission Info
Submission Time | |
---|---|
Task | C - Make a Rectangle |
User | r_k |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 1054 Byte |
Status | WA |
Exec Time | 178 ms |
Memory | 26336 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | 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 | AC | 150 ms | 26336 KB |
2.txt | AC | 56 ms | 15072 KB |
3.txt | AC | 178 ms | 25312 KB |
4.txt | AC | 121 ms | 25312 KB |
5.txt | WA | 55 ms | 15200 KB |
6.txt | AC | 81 ms | 20448 KB |
7.txt | WA | 79 ms | 22496 KB |
8.txt | WA | 49 ms | 14560 KB |
9.txt | AC | 101 ms | 21216 KB |
sample1.txt | AC | 31 ms | 11488 KB |
sample2.txt | AC | 30 ms | 11488 KB |
sample3.txt | AC | 31 ms | 11488 KB |