Submission #2857239
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 => int.Parse(s)).ToList(); var dic = new Dictionary<int, 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 | 875 Byte |
Status | WA |
Exec Time | 130 ms |
Memory | 25824 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 | WA | 118 ms | 23776 KB |
2.txt | WA | 54 ms | 14560 KB |
3.txt | WA | 130 ms | 25824 KB |
4.txt | WA | 103 ms | 21216 KB |
5.txt | WA | 57 ms | 16608 KB |
6.txt | WA | 81 ms | 19680 KB |
7.txt | WA | 80 ms | 19680 KB |
8.txt | WA | 51 ms | 16096 KB |
9.txt | AC | 77 ms | 15712 KB |
sample1.txt | AC | 30 ms | 9312 KB |
sample2.txt | AC | 30 ms | 11360 KB |
sample3.txt | AC | 29 ms | 9312 KB |