Submission #1047175
Source Code Expand
#include<iostream>
using namespace std;
int main() {
int n;
cin >> n;
int *t = new int[n];
for (int i = 0; i < n; i++)cin >> t[i];
int m;
cin >> m;
int *p = new int[m];
int *x = new int[m];
for (int i = 0; i < m; i++)cin >> p[i] >> x[i];
for (int i = 0; i < m; i++) {
int S = 0;
for (int j = 0; j < n; j++) {
if ((p[i]-1) == j)S += x[i];
else S += t[j];
}
cout << S << endl;
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Contest with Drinks Easy |
| User | kei0908 |
| Language | C++14 (GCC 5.4.1) |
| Score | 200 |
| Code Size | 437 Byte |
| Status | AC |
| Exec Time | 3 ms |
| Memory | 256 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 | 3 ms | 256 KiB |
| sample_02.txt | AC | 2 ms | 256 KiB |
| subtask_1_max_01.txt | AC | 3 ms | 256 KiB |
| subtask_1_min_01.txt | AC | 2 ms | 256 KiB |
| subtask_1_rand_01.txt | AC | 3 ms | 256 KiB |
| subtask_1_rand_02.txt | AC | 3 ms | 256 KiB |
| subtask_1_rand_03.txt | AC | 3 ms | 256 KiB |
| subtask_1_rand_04.txt | AC | 3 ms | 256 KiB |
| subtask_1_rand_05.txt | AC | 2 ms | 256 KiB |
| subtask_1_rand_06.txt | AC | 2 ms | 256 KiB |