Submission #1290322
Source Code Expand
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { // Here your code ! 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(" "); int[] i_array = new int[N]; for (int i=0;i<N;i++){ int A = Integer.parseInt(inputs2[i]); i_array[i] = A; } int[] sortedArray = bubbleSort(i_array); int sum = 0; for (int k=0;k<K;k++){ sum += sortedArray[k]; sum += k; } System.out.println(sum); } public static int[] bubbleSort(int[] arr) { for(int i=arr.length-1; i>0; i--) { for(int j=0;j<i;j++) { if(arr[j] > arr[j+1]) { int tmp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = tmp; } } } return arr; } }
Submission Info
Submission Time | |
---|---|
Task | B - オークション |
User | toco1001 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1288 Byte |
Status | TLE |
Exec Time | 2109 ms |
Memory | 37716 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | TLE | 2105 ms | 36564 KB |
in10.txt | TLE | 2108 ms | 37716 KB |
in11.txt | TLE | 2104 ms | 34388 KB |
in12.txt | TLE | 2108 ms | 34900 KB |
in13.txt | AC | 67 ms | 19284 KB |
in2.txt | TLE | 2104 ms | 34516 KB |
in3.txt | TLE | 2108 ms | 33620 KB |
in4.txt | TLE | 2109 ms | 35284 KB |
in5.txt | TLE | 2105 ms | 34644 KB |
in6.txt | TLE | 2105 ms | 34644 KB |
in7.txt | TLE | 2108 ms | 36820 KB |
in8.txt | TLE | 2108 ms | 35668 KB |
in9.txt | TLE | 2108 ms | 36572 KB |
sample1.txt | AC | 70 ms | 19156 KB |
sample2.txt | AC | 69 ms | 16980 KB |