Submission #68747728


Source Code Expand

#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N = 2e5+5;

int a[N];
int b[N];

signed main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ///
    int n, q;
    cin >> n >> q;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
        ans += min(a[i], b[i]);
    }
    for (int i = 0; i < q; ++i) {
        char c;
        int x, v;
        cin >> c >> x >> v;
        --x;
        ans -= min(a[x], b[x]);
        if (c == 'A') a[x] = v;
        else b[x] = v;
        ans += min(a[x], b[x]);
        cout << ans << '\n';
    }
}

Submission Info

Submission Time
Task C - Sum of Min Query
User PabloNo
Language C++ 20 (gcc 12.2)
Score 300
Code Size 695 Byte
Status AC
Exec Time 72 ms
Memory 6704 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 23
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3520 KiB
00_sample_01.txt AC 1 ms 3472 KiB
00_sample_02.txt AC 1 ms 3480 KiB
01_random_00.txt AC 1 ms 3412 KiB
01_random_01.txt AC 72 ms 6704 KiB
01_random_02.txt AC 61 ms 6592 KiB
01_random_03.txt AC 29 ms 5168 KiB
01_random_04.txt AC 64 ms 6224 KiB
01_random_05.txt AC 28 ms 5392 KiB
01_random_06.txt AC 47 ms 4916 KiB
01_random_07.txt AC 16 ms 5012 KiB
01_random_08.txt AC 66 ms 6660 KiB
01_random_09.txt AC 63 ms 6604 KiB
01_random_10.txt AC 65 ms 6600 KiB
01_random_11.txt AC 60 ms 6604 KiB
01_random_12.txt AC 68 ms 6656 KiB
01_random_13.txt AC 72 ms 6540 KiB
01_random_14.txt AC 66 ms 6552 KiB
01_random_15.txt AC 67 ms 6604 KiB
01_random_16.txt AC 69 ms 6600 KiB
01_random_17.txt AC 68 ms 6556 KiB
01_random_18.txt AC 66 ms 6384 KiB
01_random_19.txt AC 68 ms 6620 KiB