Submission #2856913


Source Code Expand

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := scanInt(sc)
	found := make(map[int]int, n)
	candidates := make([]int, 0)

	for i := 0; i < n; i++ {
		l := scanInt(sc)
		switch found[l] {
		case 0:
			found[l] = 1
		case 1:
			found[l] = 2
			candidates = append(candidates, l)
		}
	}

	if len(candidates) < 2 {
		fmt.Println(0)
		return
	}

	sort.Ints(candidates)
	a := candidates[len(candidates)-1]
	b := candidates[len(candidates)-2]
	fmt.Println(a * b)
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	val, _ := strconv.Atoi(sc.Text())
	return val
}

Submission Info

Submission Time
Task C - Make a Rectangle
User ryym
Language Go (1.6)
Score 0
Code Size 701 Byte
Status WA
Exec Time 46 ms
Memory 5120 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 12
WA × 3
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 42 ms 4608 KB
2.txt AC 16 ms 1920 KB
3.txt AC 39 ms 4608 KB
4.txt AC 46 ms 5120 KB
5.txt WA 15 ms 1664 KB
6.txt AC 28 ms 2816 KB
7.txt WA 29 ms 2688 KB
8.txt WA 13 ms 1664 KB
9.txt AC 20 ms 2816 KB
sample1.txt AC 1 ms 640 KB
sample2.txt AC 1 ms 640 KB
sample3.txt AC 1 ms 640 KB