Submission #3598819


Source Code Expand

package main

import(
      "fmt"
      "sort"
)

func main(){

  var n int
  ans := 0
  fmt.Scan(&n)
  var a []int
  for i:=0; i<n*3; i++ {
    var tmp int
    fmt.Scan(&tmp)
    a = append(a, tmp)
  }
  sort.Ints(a)
  cnt := 0
  for i:=3*n-2; i>=0; i-=2 {
    if cnt == n {
      break;
    }
    ans+=a[i]
    cnt++;
  }
  fmt.Println(ans)
}

//====  ↓↓↓ template functions ↓↓↓  ======================

func min(a, b int) int{
  if a < b {
    return a
  }
  return b
}

func max(a, b int) int{
  if a > b {
    return a
  }
  return b
}

func abs(x int) int{
  if x < 0 {
    return -x
  }
  return x
}

func gcd(a, b int) int{
  if b == 0 {
    return a
  }else{
    return gcd(b, a%b)
  }
}

func lcm(a, b int) int{
  return a*b/gcd(a, b);
}

Submission Info

Submission Time
Task A - AtCoder Group Contest
User MATSUMAT
Language Go (1.6)
Score 0
Code Size 822 Byte
Status TLE
Exec Time 2104 ms
Memory 10752 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 11
TLE × 1
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt
All 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt
Case Name Status Exec Time Memory
00_example_01.txt AC 1 ms 512 KB
00_example_02.txt AC 1 ms 512 KB
01.txt AC 1 ms 512 KB
02.txt AC 2 ms 512 KB
03.txt AC 1 ms 512 KB
04.txt AC 1 ms 512 KB
05.txt AC 91 ms 2432 KB
06.txt TLE 2104 ms 7680 KB
07.txt AC 648 ms 10752 KB
08.txt AC 1439 ms 8064 KB
09.txt AC 1437 ms 8064 KB
10.txt AC 1433 ms 10752 KB