提出 #73902648


ソースコード 拡げる

#include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;
using ll = long long;
using db = double;
const ll N = 1e6 + 5;
const ll md = 998244353;
const ll MOD = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db eps = 1e-6;
const db E = 2.718281828459045;
typedef pair<ll, ll> PLL;
#define fi first
#define se second
ll a[N],x[N];
void solve()
{
    ll n, q;
    cin >> n >> q;
    map<ll, ll> mp;
    for (ll i = 1; i <= n;i++)
    {
        cin >> a[i];
        mp[a[i]]++;
    }
    ll k;
    while(q--)
    {
        cin >> k;
        for (ll i = 1; i <= k;i++)
        {
            cin >> x[i];
            if(mp[a[x[i]]]==1)
                mp.erase(a[x[i]]);
            else
                mp[a[x[i]]]--;
        }
        ll ans = 0;
        for(auto f:mp){
            ans = f.fi;
            break;
        }
        for (ll i = 1; i <= k;i++)
        {
            mp[a[x[i]]]++;
        }
        cout << ans << '\n';
    }
}
int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int T;
    T = 1;
    //cin>>T;
    while (T--)
    {
        solve();
    }
}

提出情報

提出日時
問題 C - Except and Min
ユーザ AChievedreaM
言語 C++23 (GCC 15.2.0)
得点 300
コード長 1230 Byte
結果 AC
実行時間 422 ms
メモリ 24764 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 1
AC × 19
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.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, 02_random_2_00.txt, 02_random_2_01.txt, 02_random_2_02.txt, 02_random_2_03.txt, 02_random_2_04.txt, 02_random_2_05.txt, 03_random_3_00.txt, 03_random_3_01.txt, 03_random_3_02.txt, 03_random_3_03.txt, 03_random_3_04.txt, 03_random_3_05.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 2 ms 3624 KiB
01_random_00.txt AC 422 ms 24688 KiB
01_random_01.txt AC 47 ms 5964 KiB
01_random_02.txt AC 418 ms 24588 KiB
01_random_03.txt AC 417 ms 24652 KiB
01_random_04.txt AC 202 ms 9012 KiB
01_random_05.txt AC 143 ms 6808 KiB
02_random_2_00.txt AC 336 ms 24764 KiB
02_random_2_01.txt AC 324 ms 24200 KiB
02_random_2_02.txt AC 88 ms 6204 KiB
02_random_2_03.txt AC 335 ms 24628 KiB
02_random_2_04.txt AC 79 ms 5992 KiB
02_random_2_05.txt AC 78 ms 6000 KiB
03_random_3_00.txt AC 251 ms 24728 KiB
03_random_3_01.txt AC 250 ms 24760 KiB
03_random_3_02.txt AC 248 ms 24728 KiB
03_random_3_03.txt AC 248 ms 24592 KiB
03_random_3_04.txt AC 250 ms 24716 KiB
03_random_3_05.txt AC 250 ms 24708 KiB