結果

問題 No.938 賢人を探せ
ユーザー t33f
提出日時 2019-12-15 10:07:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 964 ms
コンパイル使用メモリ 80,876 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 11:52:45
合計ジャッジ時間 1,959 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <set>
#include <vector>
#include <iostream>
using namespace std;

int main() {
    int n; cin >> n;
    vector<string> A, B;
    set<string> ok;
    while (n--) {
        string a, b; cin >> a >> b;
        A.push_back(a); B.push_back(b);
        ok.insert(b);
    }
    for (string &a : A) ok.erase(a);
    for (string &b : B)
        if (ok.find(b) != ok.end()) {
            cout << b << endl;
            ok.erase(b);
        }
}
0