結果

問題 No.938 賢人を探せ
ユーザー QCFium
提出日時 2019-12-01 08:48:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 437 bytes
コンパイル時間 1,821 ms
コンパイル使用メモリ 175,560 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-11-21 04:20:13
合計ジャッジ時間 2,969 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 2 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main() {
    int n;
    scanf("%d", &n);
    std::pair<std::string, std::string> a[n - 1];
    std::set<std::string> pos;
    for (auto &i : a) {
        std::cin >> i.first >> i.second;
        pos.insert(i.second);
    }
    for (auto &i : a) pos.erase(i.first);
    for (auto &i : a) {
        if (pos.count(i.second)) std::cout << i.second << std::endl, pos.erase(i.second);
    }
    
    return 0;
}

0