Submission #2857249
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 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 | 877 Byte |
Status | WA |
Exec Time | 132 ms |
Memory | 30432 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 | 124 ms | 24160 KB |
2.txt | AC | 55 ms | 15072 KB |
3.txt | AC | 132 ms | 30432 KB |
4.txt | AC | 103 ms | 23648 KB |
5.txt | WA | 55 ms | 13024 KB |
6.txt | AC | 80 ms | 18400 KB |
7.txt | WA | 82 ms | 20448 KB |
8.txt | WA | 51 ms | 16608 KB |
9.txt | AC | 79 ms | 19808 KB |
sample1.txt | AC | 31 ms | 13524 KB |
sample2.txt | AC | 30 ms | 11484 KB |
sample3.txt | AC | 30 ms | 11360 KB |