Submission #1358166
Source Code Expand
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.Closeable; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.PriorityQueue; import java.util.Queue; public class Main { static ContestScanner in; static Writer out; public static void main(String[] args) { Main main = new Main(); try { in = new ContestScanner(); out = new Writer(); main.solve(); out.close(); in.close(); } catch (IOException e) { e.printStackTrace(); } } void solve() throws IOException { 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 sum = 0; for(int i = 0; i < n; i++) { sum += a[3 * n - 2 - 2 * i]; } System.out.println(sum); } } class Writer extends PrintWriter{ public Writer(String filename)throws IOException {super(new BufferedWriter(new FileWriter(filename)));} public Writer()throws IOException{super(System.out);} } class ContestScanner implements Closeable{ private BufferedReader in;private int c=-2; public ContestScanner()throws IOException {in=new BufferedReader(new InputStreamReader(System.in));} public ContestScanner(String filename)throws IOException {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));} public String nextToken()throws IOException { StringBuilder sb=new StringBuilder(); while((c=in.read())!=-1&&Character.isWhitespace(c)); while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();} return sb.toString(); } public String readLine()throws IOException{ StringBuilder sb=new StringBuilder();if(c==-2)c=in.read(); while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();} return sb.toString(); } public long nextLong()throws IOException,NumberFormatException {return Long.parseLong(nextToken());} public int nextInt()throws NumberFormatException,IOException {return(int)nextLong();} public double nextDouble()throws NumberFormatException,IOException {return Double.parseDouble(nextToken());} public void close() throws IOException {in.close();} }
Submission Info
Submission Time | |
---|---|
Task | A - AtCoder Group Contest |
User | threepipes_s |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 2298 Byte |
Status | AC |
Exec Time | 283 ms |
Memory | 47272 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 78 ms | 20436 KB |
00_example_02.txt | AC | 73 ms | 21328 KB |
01.txt | AC | 70 ms | 19284 KB |
02.txt | AC | 73 ms | 20948 KB |
03.txt | AC | 86 ms | 19156 KB |
04.txt | AC | 70 ms | 17108 KB |
05.txt | AC | 125 ms | 26352 KB |
06.txt | AC | 262 ms | 46884 KB |
07.txt | AC | 185 ms | 44788 KB |
08.txt | AC | 267 ms | 47272 KB |
09.txt | AC | 276 ms | 45612 KB |
10.txt | AC | 283 ms | 44588 KB |