Submission #8893076
Source Code Expand
import java.util.*; public class Main{ public static void main(String... args){ Scanner scan = new Scanner(System.in); // input int num = scan.nextInt(); int[] edges = new int[100000]; for(int i = 0; i < num; i++){ edges[i] = scan.nextInt(); } // search Arrays.sort(edges); int memory = edges[99999]; int count = 1; int firstLen = 0; int secondLen = -1; for(int i = 99998; i >= 0; i--){ if(memory == edges[i]){ count++; if(count == 2){ if(edges[i] > firstLen){ secondLen = firstLen; firstLen = edges[i]; count = 0; } else if(edges[i] > secondLen){ secondLen = edges[i]; count = 0; } } } else { memory = edges[i]; count = 1; } } // output System.out.println(Math.max(firstLen * secondLen, 0)); } }
Submission Info
Submission Time | |
---|---|
Task | C - Make a Rectangle |
User | mikhail |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 868 Byte |
Status | WA |
Exec Time | 477 ms |
Memory | 49300 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 | 477 ms | 47808 KB |
2.txt | WA | 357 ms | 46060 KB |
3.txt | WA | 475 ms | 48292 KB |
4.txt | WA | 470 ms | 49300 KB |
5.txt | WA | 356 ms | 45248 KB |
6.txt | WA | 462 ms | 44596 KB |
7.txt | WA | 476 ms | 48616 KB |
8.txt | WA | 338 ms | 43404 KB |
9.txt | AC | 356 ms | 47180 KB |
sample1.txt | AC | 104 ms | 22100 KB |
sample2.txt | AC | 96 ms | 20564 KB |
sample3.txt | AC | 98 ms | 21972 KB |