Submission #1290603
Source Code Expand
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); String[] inputs = line.split(" "); int N = Integer.parseInt(inputs[0]); int K = Integer.parseInt(inputs[1]); String line2 = br.readLine(); String[] inputs2 = line2.split(" "); ArrayList<Integer> i_array = new ArrayList<Integer>(); for (int i=0;i<N;i++){ int A = Integer.parseInt(inputs2[i]); i_array.add(A); } Collections.sort(i_array); long sum = 0; for (int k=0;k<K;k++){ sum += i_array.get(k); sum += k; } System.out.println(sum); } }
Submission Info
Submission Time | |
---|---|
Task | B - オークション |
User | toco1001 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 918 Byte |
Status | AC |
Exec Time | 288 ms |
Memory | 51068 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt |
All | sample1.txt, sample2.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 277 ms | 51068 KB |
in10.txt | AC | 279 ms | 50708 KB |
in11.txt | AC | 282 ms | 48596 KB |
in12.txt | AC | 273 ms | 49676 KB |
in13.txt | AC | 70 ms | 19412 KB |
in2.txt | AC | 282 ms | 50260 KB |
in3.txt | AC | 288 ms | 50516 KB |
in4.txt | AC | 275 ms | 50004 KB |
in5.txt | AC | 273 ms | 49420 KB |
in6.txt | AC | 278 ms | 49492 KB |
in7.txt | AC | 278 ms | 50004 KB |
in8.txt | AC | 280 ms | 50188 KB |
in9.txt | AC | 278 ms | 50068 KB |
sample1.txt | AC | 70 ms | 19924 KB |
sample2.txt | AC | 70 ms | 19152 KB |