結果

問題 No.938 賢人を探せ
ユーザー MisterMister
提出日時 2020-04-21 19:31:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 1,014 ms
コンパイル使用メモリ 82,200 KB
最終ジャッジ日時 2025-01-09 22:05:47
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <set>

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::string> ps;
    std::set<std::string> outs;

    while (n--) {
        std::string a, b;
        std::cin >> a >> b;
        ps.push_back(a);
        ps.push_back(b);
        outs.insert(a);
    }

    for (const auto& p : ps) {
        if (outs.count(p)) continue;

        std::cout << p << std::endl;
        outs.insert(p);
    }
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0