11800 | 2024-11-11 17:22:58 | MCDave | Szemetessor | cpp17 | Wrong answer 17/100 | 250ms | 1988 KiB |
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, m, i, c, plus, number, out = 0;
cin >> n >> m;
vector<int> cap(n), current(n, 0);
for (i = 0; i < n; i++)
{
cin >> cap[i];
}
for (i = 0; i < m; i++)
{
cin >> number >> plus;
if (current[number] + plus <= cap[number])
{
current[number] += plus;
}
else
{
out += cap[number] - current[number];
current[number] = plus;
}
}
for (i = 0; i < n; i++)
{
if (current[i] != 0)
{
out += cap[i] - current[i];
}
}
cout << out;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 320 KiB | ||||
2 | Accepted | 1ms | 508 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 1ms | 320 KiB | ||||
4 | Accepted | 1ms | 320 KiB | ||||
5 | Accepted | 1ms | 320 KiB | ||||
6 | Accepted | 1ms | 320 KiB | ||||
7 | Accepted | 1ms | 396 KiB | ||||
8 | Accepted | 1ms | 320 KiB | ||||
9 | Accepted | 1ms | 320 KiB | ||||
10 | Accepted | 1ms | 320 KiB | ||||
11 | Accepted | 1ms | 320 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 118ms | 404 KiB | ||||
13 | Wrong answer | 116ms | 408 KiB | ||||
14 | Wrong answer | 131ms | 412 KiB | ||||
15 | Wrong answer | 136ms | 508 KiB | ||||
16 | Wrong answer | 150ms | 472 KiB | ||||
17 | Wrong answer | 200ms | 1080 KiB | ||||
18 | Wrong answer | 248ms | 1988 KiB | ||||
19 | Wrong answer | 248ms | 1884 KiB | ||||
20 | Wrong answer | 246ms | 1848 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Accepted | 122ms | 484 KiB | ||||
22 | Wrong answer | 144ms | 568 KiB | ||||
23 | Accepted | 123ms | 320 KiB | ||||
24 | Wrong answer | 146ms | 600 KiB | ||||
25 | Accepted | 131ms | 512 KiB | ||||
26 | Wrong answer | 194ms | 1204 KiB | ||||
27 | Wrong answer | 241ms | 1904 KiB | ||||
28 | Wrong answer | 246ms | 1948 KiB | ||||
29 | Wrong answer | 241ms | 1848 KiB | ||||
30 | Wrong answer | 212ms | 1848 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 1ms | 320 KiB | ||||
32 | Accepted | 1ms | 320 KiB | ||||
33 | Accepted | 1ms | 320 KiB | ||||
34 | Accepted | 1ms | 508 KiB | ||||
35 | Wrong answer | 12ms | 500 KiB | ||||
36 | Wrong answer | 137ms | 408 KiB | ||||
37 | Wrong answer | 246ms | 1984 KiB | ||||
38 | Wrong answer | 246ms | 1980 KiB | ||||
39 | Wrong answer | 247ms | 1968 KiB | ||||
40 | Wrong answer | 250ms | 1896 KiB | ||||
41 | Wrong answer | 246ms | 1848 KiB | ||||
42 | Wrong answer | 246ms | 1848 KiB |