結果

問題 No.938 賢人を探せ
ユーザー erbowlerbowl
提出日時 2019-12-15 20:20:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 1,965 ms
コンパイル使用メモリ 177,552 KB
実行使用メモリ 8,500 KB
最終ジャッジ日時 2023-08-21 03:39:47
合計ジャッジ時間 3,331 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
8,296 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 27 ms
6,500 KB
testcase_09 AC 28 ms
6,148 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 37 ms
6,720 KB
testcase_12 AC 28 ms
5,572 KB
testcase_13 AC 28 ms
5,612 KB
testcase_14 AC 28 ms
5,608 KB
testcase_15 AC 28 ms
5,688 KB
testcase_16 AC 28 ms
5,744 KB
testcase_17 AC 28 ms
5,608 KB
testcase_18 AC 28 ms
5,540 KB
testcase_19 AC 29 ms
5,576 KB
testcase_20 AC 28 ms
5,528 KB
testcase_21 AC 29 ms
5,528 KB
testcase_22 AC 64 ms
8,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
#include <bits/stdc++.h>
using namespace std;

int main() {
    ll n;
    std::cin >> n;
    
    std::map<string, bool> ok;
    std::map<string, bool> out;
    
    vector<string> ab;
    
    for (int i = 0; i < n; i++) {
        string t1,t2;
        std::cin >> t1>>t2;
        ab.push_back(t2);
        ok[t2] = true;
        out[t1] = true;
    }
    
    for (int i = 0; i < n; i++) {
        if(ok[ab[i]] && !out[ab[i]]){
            std::cout << ab[i] << std::endl;
            ok[ab[i]] = false;
        }
    }
    
}
0