Submission #42363039
Source Code Expand
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
int n = scanner.nextInt();
int k = scanner.nextInt();
int q = scanner.nextInt();
List<Integer> list = new ArrayList<>();
for (int i = 0; i < n; i++) {
list.add(0);
}
for (int i = 0; i < q; i++) {
list.set(scanner.nextInt() - 1, scanner.nextInt());
List<Integer> temp = new ArrayList<>(list);
temp.sort(Comparator.reverseOrder());
System.out.println(temp.subList(0, k).stream().mapToLong(value -> value).sum());
}
}
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - Best Performances |
| User | kmatsu |
| Language | Java (OpenJDK 11.0.6) |
| Score | 0 |
| Code Size | 708 Byte |
| Status | TLE |
| Exec Time | 6618 ms |
| Memory | 64920 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 475 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt |
| All | sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01.txt | AC | 113 ms | 35720 KiB |
| test_01.txt | AC | 121 ms | 35940 KiB |
| test_02.txt | AC | 3256 ms | 60904 KiB |
| test_03.txt | AC | 4343 ms | 60464 KiB |
| test_04.txt | AC | 3715 ms | 62476 KiB |
| test_05.txt | AC | 4536 ms | 60896 KiB |
| test_06.txt | AC | 3836 ms | 61308 KiB |
| test_07.txt | AC | 3235 ms | 59440 KiB |
| test_08.txt | AC | 4341 ms | 60516 KiB |
| test_09.txt | AC | 3991 ms | 60572 KiB |
| test_10.txt | TLE | 6618 ms | 62960 KiB |
| test_11.txt | TLE | 6618 ms | 61568 KiB |
| test_12.txt | TLE | 6618 ms | 60888 KiB |
| test_13.txt | TLE | 6618 ms | 63508 KiB |
| test_14.txt | TLE | 6618 ms | 60116 KiB |
| test_15.txt | TLE | 6618 ms | 62076 KiB |
| test_16.txt | TLE | 6618 ms | 61856 KiB |
| test_17.txt | TLE | 6618 ms | 59804 KiB |
| test_18.txt | TLE | 6618 ms | 61412 KiB |
| test_19.txt | AC | 5341 ms | 60948 KiB |
| test_20.txt | AC | 5277 ms | 64920 KiB |
| test_21.txt | TLE | 6618 ms | 60684 KiB |
| test_22.txt | TLE | 6618 ms | 60536 KiB |
| test_23.txt | TLE | 6618 ms | 61868 KiB |
| test_24.txt | TLE | 6618 ms | 62932 KiB |
| test_25.txt | TLE | 6618 ms | 62484 KiB |
| test_26.txt | TLE | 6618 ms | 61992 KiB |
| test_27.txt | TLE | 6618 ms | 62176 KiB |
| test_28.txt | TLE | 6618 ms | 62204 KiB |