結果

問題 No.938 賢人を探せ
ユーザー yk356yk356
提出日時 2019-12-11 13:34:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 655 bytes
コンパイル時間 1,826 ms
コンパイル使用メモリ 183,756 KB
実行使用メモリ 7,996 KB
最終ジャッジ日時 2023-08-21 03:37:18
合計ジャッジ時間 3,345 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
7,996 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 22 ms
5,944 KB
testcase_09 AC 22 ms
5,664 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 30 ms
6,532 KB
testcase_12 AC 22 ms
5,256 KB
testcase_13 AC 22 ms
5,272 KB
testcase_14 AC 22 ms
5,256 KB
testcase_15 AC 22 ms
5,368 KB
testcase_16 AC 22 ms
5,296 KB
testcase_17 AC 22 ms
5,272 KB
testcase_18 AC 22 ms
5,256 KB
testcase_19 AC 22 ms
5,332 KB
testcase_20 AC 23 ms
5,348 KB
testcase_21 AC 23 ms
5,260 KB
testcase_22 AC 56 ms
7,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
    int n;cin>>n;
    set<string> sa;
    map<string,int> mb;
    rep(i,n){
        string a,b;cin>>a>>b;
        sa.insert(a);
        mb.insert({b,i});
    }
    for(auto itr=sa.begin();itr!=sa.end();itr++){
        auto t=mb.find(*itr);
        if(t!=mb.end())mb.erase(*itr);
    }
    map<int,string> ans;
    for(auto itr=mb.begin();itr!=mb.end();itr++){
        pair<string,int> p=*itr;
        ans.insert({p.second,p.first});
    }
    for(auto m:ans)cout<<m.second<<endl;
    return 0;
}
0