1 条题解

  • 0
    @ 2025-5-15 20:14:33
    #include <iostream>
    #include <unordered_map>
    #include <unordered_set>
    using namespace std;
    long long n,t1;
    unsigned long long t2;
    __int128 ans;
    int q,opt;
    unordered_map <long long,__int128> ma;
    unordered_set <long long> se;
    void print(__int128 x){
    	if(x>9) print(x/10);
    	putchar(x%10+'0');
    }
    int main(){
        ios::sync_with_stdio(false);
        cin.tie(0);
        cin >> n >> q >> opt;
        for (int i = 1;i<=n;i++){
            cin >> t1 >> t2;
            if (opt == 2) se.insert(t1);
            if (ma[t1] < t2) ma[t1] = t2;
        }
        for (int i = 1;i<=q;i++){
            cin >> t1;
            ans += ma[t1];
        }
        print(ans);
        putchar('\n');
        if (opt == 2) printf("%lld\n",se.size());
        return 0;
    }
    

    [GLR-Dec-Eit E] 前一天晚上出的题目不会梦到数据没有锅

    信息

    ID
    2
    时间
    1000ms
    内存
    256MiB
    难度
    3
    标签
    递交数
    5
    已通过
    3
    上传者