提出 #68742743


ソースコード 拡げる

#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
const int maxn=2e5+5;

int a[maxn],b[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n,q;
    cin>>n>>q;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    long long ans=0;
    for (int i=1;i<=n;i++)
    {
        cin>>b[i];
        ans+=min(a[i],b[i]);
    }
    while (q--)
    {
        char op;
        int x,y;
        cin>>op>>x>>y;
        ans-=min(a[x],b[x]);
        if (op=='A')
            a[x]=y;
        else
            b[x]=y;
        ans+=min(a[x],b[x]);
        cout<<ans<<'\n';
    }

}

提出情報

提出日時
問題 C - Sum of Min Query
ユーザ Alliy666
言語 C++ 23 (gcc 12.2)
得点 300
コード長 724 Byte
結果 AC
実行時間 59 ms
メモリ 5196 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 23
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3404 KiB
00_sample_01.txt AC 1 ms 3528 KiB
00_sample_02.txt AC 1 ms 3400 KiB
01_random_00.txt AC 1 ms 3476 KiB
01_random_01.txt AC 59 ms 5196 KiB
01_random_02.txt AC 53 ms 5040 KiB
01_random_03.txt AC 26 ms 4256 KiB
01_random_04.txt AC 54 ms 4876 KiB
01_random_05.txt AC 25 ms 4400 KiB
01_random_06.txt AC 42 ms 4148 KiB
01_random_07.txt AC 15 ms 4104 KiB
01_random_08.txt AC 56 ms 5000 KiB
01_random_09.txt AC 56 ms 5028 KiB
01_random_10.txt AC 57 ms 5164 KiB
01_random_11.txt AC 52 ms 5036 KiB
01_random_12.txt AC 57 ms 5024 KiB
01_random_13.txt AC 58 ms 4952 KiB
01_random_14.txt AC 58 ms 4992 KiB
01_random_15.txt AC 59 ms 5040 KiB
01_random_16.txt AC 57 ms 5040 KiB
01_random_17.txt AC 58 ms 5028 KiB
01_random_18.txt AC 56 ms 4904 KiB
01_random_19.txt AC 57 ms 5040 KiB