g640. 璽羽的壽司 - 高中生程式解題系統

本文最後更新於:2024年1月12日 下午

Zerojudge
解題紀錄

g640. 璽羽的壽司 - 高中生程式解題系統

Zerojudge-g640.cpp

// Author : ysh
// 09/14/2022 Wed 10:46:41.51
#include<bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a,b;cin>>a>>b;
    vector<int>f(a);
    for(int &i : f) {
        cin>>i;
    }
    sort(f.begin(),f.end());
    long long ans = 0;
    for(int i = 0;i<b;i++) {
        int tmp;cin>>tmp;
        auto found = lower_bound(f.begin(),f.end(),tmp);
        if(found != f.end()) {
            ans += *found;
        }
    }
    cout<<ans;
    return 0;
}

g640. 璽羽的壽司 - 高中生程式解題系統
http://mysh212.github.io/algosolution/Zerojudge-g640.cpp/
作者
ysh
發布於
2022年9月14日
更新於
2024年1月12日
許可協議