6171 | 2023-11-05 11:58:06 | Gervid | Szemetessor | cpp17 | Wrong answer 17/100 | 244ms | 8036 KiB |
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, k, i, out = 0;
cin >> n >> k;
vector<int> cap(n);
for (i = 0; i < n; i++)
{
cin >> cap[i];
}
vector<int> bins(n);
pair<int, int> current;
for (i = 0; i < k; i++)
{
cin >> current.first >> current.second;
if (bins[current.first] + current.second > cap[current.first])
{
out += cap[current.first] - bins[current.first];
bins[current.first] = current.second;
}
else
{
bins[current.first] += current.second;
}
}
for (i = 0; i < n; i++)
{
if (bins[i])
{
out += cap[i] - bins[i];
}
}
cout << out;
}
//5 7
//66 73 68 79 78
//2 50
//3 69
//0 1
//2 20
//4 12
//1 44
//3 11
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1808 KiB | ||||
2 | Accepted | 3ms | 2056 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 2ms | 2152 KiB | ||||
4 | Accepted | 2ms | 2272 KiB | ||||
5 | Accepted | 2ms | 2484 KiB | ||||
6 | Accepted | 3ms | 2700 KiB | ||||
7 | Accepted | 3ms | 2908 KiB | ||||
8 | Accepted | 2ms | 3024 KiB | ||||
9 | Accepted | 2ms | 3024 KiB | ||||
10 | Accepted | 3ms | 3156 KiB | ||||
11 | Accepted | 2ms | 3232 KiB | ||||
subtask3 | 0/25 | ||||||
12 | Wrong answer | 118ms | 3236 KiB | ||||
13 | Wrong answer | 119ms | 3348 KiB | ||||
14 | Wrong answer | 131ms | 3436 KiB | ||||
15 | Wrong answer | 136ms | 3688 KiB | ||||
16 | Wrong answer | 149ms | 3912 KiB | ||||
17 | Wrong answer | 194ms | 5236 KiB | ||||
18 | Wrong answer | 241ms | 7136 KiB | ||||
19 | Wrong answer | 240ms | 7264 KiB | ||||
20 | Wrong answer | 240ms | 7204 KiB | ||||
subtask4 | 0/20 | ||||||
21 | Accepted | 123ms | 4180 KiB | ||||
22 | Wrong answer | 144ms | 4804 KiB | ||||
23 | Accepted | 125ms | 4176 KiB | ||||
24 | Wrong answer | 146ms | 4720 KiB | ||||
25 | Accepted | 131ms | 4532 KiB | ||||
26 | Wrong answer | 190ms | 5876 KiB | ||||
27 | Wrong answer | 238ms | 7216 KiB | ||||
28 | Wrong answer | 238ms | 7500 KiB | ||||
29 | Wrong answer | 238ms | 7580 KiB | ||||
30 | Wrong answer | 211ms | 7556 KiB | ||||
subtask5 | 0/38 | ||||||
31 | Accepted | 3ms | 4736 KiB | ||||
32 | Accepted | 3ms | 4832 KiB | ||||
33 | Accepted | 3ms | 4864 KiB | ||||
34 | Accepted | 3ms | 4876 KiB | ||||
35 | Wrong answer | 14ms | 4840 KiB | ||||
36 | Wrong answer | 136ms | 4812 KiB | ||||
37 | Wrong answer | 244ms | 7820 KiB | ||||
38 | Wrong answer | 244ms | 8036 KiB | ||||
39 | Wrong answer | 244ms | 7956 KiB | ||||
40 | Wrong answer | 244ms | 8020 KiB | ||||
41 | Wrong answer | 244ms | 7960 KiB | ||||
42 | Wrong answer | 243ms | 8024 KiB |