116612024-11-04 11:41:36bzySzemetessorcpp17Wrong answer 25/100250ms6972 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll  long long

int main()
{
    int n, k; cin >> n >> k;
    vector <int> C(n);
    for(int &c : C) cin >> c;
    ll ans = 0;
    vector <int> K(n, 0);
    for(int i = 0; i < k; i++){
        int t, q; cin >> t >> q;
        if(K[t] + q <= C[t]) K[t] += q;
        else{
            ans += C[t] - K[t];
            K[t] = q;
        }
    }
    for(int i = 0; i < n; i++) ans += C[i] - K[i];
    cout << ans;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms320 KiB
2Accepted1ms320 KiB
subtask20/17
3Accepted1ms320 KiB
4Accepted1ms320 KiB
5Accepted1ms320 KiB
6Wrong answer1ms320 KiB
7Accepted1ms320 KiB
8Accepted1ms404 KiB
9Wrong answer1ms408 KiB
10Accepted1ms320 KiB
11Wrong answer1ms320 KiB
subtask325/25
12Accepted119ms2432 KiB
13Accepted118ms2364 KiB
14Accepted133ms2828 KiB
15Accepted137ms2844 KiB
16Accepted150ms3280 KiB
17Accepted202ms5016 KiB
18Accepted247ms6948 KiB
19Accepted247ms6940 KiB
20Accepted246ms6972 KiB
subtask40/20
21Wrong answer122ms2620 KiB
22Wrong answer145ms3384 KiB
23Wrong answer125ms2616 KiB
24Wrong answer145ms3380 KiB
25Wrong answer133ms2896 KiB
26Wrong answer195ms4920 KiB
27Wrong answer241ms6596 KiB
28Wrong answer248ms6676 KiB
29Wrong answer244ms6712 KiB
30Wrong answer215ms5944 KiB
subtask50/38
31Accepted2ms320 KiB
32Accepted1ms320 KiB
33Wrong answer1ms320 KiB
34Wrong answer1ms320 KiB
35Wrong answer13ms720 KiB
36Wrong answer138ms2872 KiB
37Wrong answer250ms6944 KiB
38Wrong answer250ms6876 KiB
39Wrong answer250ms6812 KiB
40Wrong answer248ms6968 KiB
41Wrong answer248ms6968 KiB
42Wrong answer248ms6940 KiB