Submission #5567647

Source Code Expand

Copy
```import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.AbstractMap;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {

public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
MyInput in = new MyInput(inputStream);
PrintWriter out = new PrintWriter(outputStream);

Solver solver = new Solver();
solver.solve(1, in, out);

out.close();
}

// ======================================================================

static class Solver {

public void solve(int testNumber, MyInput in, PrintWriter out) {
int N = in.nextInt();
int[] A = new int[N*3];
for(int i = 0; i < N * 3; i++) {
A[i] = in.nextInt();
}
Arrays.sort(A);
long ans = 0;
for(int i = N; i < N * 2; i++) {
ans += A[i];
}
out.println(ans);
}
}

static class PPP {
public int key, val;
public PPP(int key, int val) {
this.key = key;
this.val = val;
}
public int getKey() {
return key;
}
public void setKey(int key) {
this.key = key;
}
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
}
// ======================================================================
static class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {
/** serialVersionUID. */
private static final long serialVersionUID = 6411527075103472113L;

public Pair(final K key, final V value) {
super(key, value);
}
}
static class MyInput {
private static int pos;
private static final char[] buffer = new char[1024 * 8];
private static char[] str = new char[500 * 8 * 2];
private static boolean[] isDigit = new boolean[256];
private static boolean[] isSpace = new boolean[256];
private static boolean[] isLineSep = new boolean[256];

static {
for (int i = 0; i < 10; i++) {
isDigit['0' + i] = true;
}
isDigit['-'] = true;
isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
isLineSep['\r'] = isLineSep['\n'] = true;
}

public MyInput(InputStream is) {
}

pos = 0;
try {
} catch (IOException e) {
throw new RuntimeException();
}
throw new MyInput.EndOfFileRuntimeException();
}
}
return buffer[pos++];
}

public int nextInt() {
int len = 0;
str[len++] = nextChar();
int i = 0;
int ret = 0;
if (str[0] == '-') {
i = 1;
}
for (; i < len; i++) ret = ret * 10 + str[i] - '0';
if (str[0] == '-') {
ret = -ret;
}
return ret;
}

public long nextLong() {
int len = 0;
str[len++] = nextChar();
int i = 0;
long ret = 0L;
if (str[0] == '-') {
i = 1;
}
for (; i < len; i++) ret = ret * 10 + str[i] - '0';
if (str[0] == '-') {
ret = -ret;
}
return ret;
}

public String nextString() {
String ret = new String(nextDChar()).trim();
return ret;
}

public char[] nextDChar() {
int len = 0;
char[] ret = new char[len + 1];
for (int i=0; i < len; i++)		ret[i] = str[i];
ret[len] = 0x00;
return ret;
}

public char nextChar() {
while (true) {
if (!isSpace[c]) {
return (char) c;
}
}
}

int reads(int len, boolean[] accept) {
try {
while (true) {
if (accept[c]) {
break;
}
if (str.length == len) {
char[] rep = new char[str.length * 3 / 2];
System.arraycopy(str, 0, rep, 0, str.length);
str = rep;
}
str[len++] = (char) c;
}
} catch (MyInput.EndOfFileRuntimeException e) {
}
return len;
}

static class EndOfFileRuntimeException extends RuntimeException {
}
}
}
```

#### Submission Info

Submission Time 2019-05-24 23:42:59+0900 A - AtCoder Group Contest k_6101 Java8 (OpenJDK 1.8.0) 0 5914 Byte WA 296 ms 25692 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 00_example_01.txt, 00_example_02.txt
All 0 / 300 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 72 ms 21332 KB
00_example_02.txt 71 ms 21204 KB
01.txt 71 ms 19412 KB
02.txt 70 ms 18388 KB
03.txt 71 ms 19412 KB
04.txt 72 ms 18772 KB
05.txt 114 ms 24532 KB
06.txt 150 ms 22868 KB
07.txt 124 ms 22868 KB
08.txt 202 ms 25692 KB
09.txt 296 ms 25444 KB
10.txt 295 ms 25036 KB