Submission #1035868
Source Code Expand
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.next());
int T[] = new int[N];
for(int i = 0; i < N; i++){
T[i] = Integer.parseInt(sc.next());
}
int M = Integer.parseInt(sc.next());
int P[] = new int[M];
int X[] = new int[M];
for(int i = 0; i < M; i++){
P[i] = Integer.parseInt(sc.next());
X[i] = Integer.parseInt(sc.next());
}
for(int i = 0; i < M; i++){
int res = 0;
for(int j = 0; j < N; j++){
if(P[i] == j+1) res += X[i];
else res += T[j];
}
System.out.println(res);
}
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Contest with Drinks Easy |
| User | |
| Language | Java8 (OpenJDK 1.8.0) |
| Score | 200 |
| Code Size | 674 Byte |
| Status | AC |
| Exec Time | 153 ms |
| Memory | 9812 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt |
| All | subtask_1_max_01.txt, subtask_1_min_01.txt, subtask_1_rand_01.txt, subtask_1_rand_02.txt, subtask_1_rand_03.txt, subtask_1_rand_04.txt, subtask_1_rand_05.txt, subtask_1_rand_06.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01.txt | AC | 123 ms | 9544 KiB |
| sample_02.txt | AC | 125 ms | 9552 KiB |
| subtask_1_max_01.txt | AC | 138 ms | 9812 KiB |
| subtask_1_min_01.txt | AC | 129 ms | 9552 KiB |
| subtask_1_rand_01.txt | AC | 126 ms | 9676 KiB |
| subtask_1_rand_02.txt | AC | 146 ms | 9804 KiB |
| subtask_1_rand_03.txt | AC | 129 ms | 9676 KiB |
| subtask_1_rand_04.txt | AC | 153 ms | 9808 KiB |
| subtask_1_rand_05.txt | AC | 128 ms | 9676 KiB |
| subtask_1_rand_06.txt | AC | 127 ms | 9552 KiB |