Submission #68742419


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

using LL = long long;
#define endl '\n'
using db = double;
template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, Q;
    cin >> n >> Q;
    vector<LL> a(n + 1), b(n + 1);
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    for (int i = 1; i <= n; ++i)
        cin >> b[i];
    LL sum = 0;
    for (int i = 1; i <= n; ++i)
        sum += min(a[i], b[i]);
    while (Q--)
    {
        char p;
        LL i, x;
        cin >> p >> i >> x;
        sum -= min(a[i], b[i]);
        if (p == 'A')
            a[i] = x;
        else
            b[i] = x;
        sum += min(a[i], b[i]);
        cout << sum << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task C - Sum of Min Query
User hialine
Language C++ 20 (gcc 12.2)
Score 300
Code Size 882 Byte
Status AC
Exec Time 61 ms
Memory 6748 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 3384 KiB
00_sample_01.txt AC 1 ms 3352 KiB
00_sample_02.txt AC 1 ms 3348 KiB
01_random_00.txt AC 1 ms 3392 KiB
01_random_01.txt AC 61 ms 6748 KiB
01_random_02.txt AC 52 ms 6156 KiB
01_random_03.txt AC 27 ms 4668 KiB
01_random_04.txt AC 56 ms 6216 KiB
01_random_05.txt AC 25 ms 5184 KiB
01_random_06.txt AC 44 ms 4940 KiB
01_random_07.txt AC 16 ms 4628 KiB
01_random_08.txt AC 58 ms 6568 KiB
01_random_09.txt AC 56 ms 6428 KiB
01_random_10.txt AC 58 ms 6544 KiB
01_random_11.txt AC 52 ms 6228 KiB
01_random_12.txt AC 59 ms 6576 KiB
01_random_13.txt AC 59 ms 6612 KiB
01_random_14.txt AC 59 ms 6628 KiB
01_random_15.txt AC 59 ms 6492 KiB
01_random_16.txt AC 59 ms 6544 KiB
01_random_17.txt AC 59 ms 6608 KiB
01_random_18.txt AC 57 ms 6220 KiB
01_random_19.txt AC 60 ms 6612 KiB