結果

問題 No.938 賢人を探せ
ユーザー face4face4
提出日時 2019-12-01 09:03:14
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 505 bytes
コンパイル時間 877 ms
コンパイル使用メモリ 82,024 KB
実行使用メモリ 7,796 KB
最終ジャッジ日時 2023-08-21 03:28:59
合計ジャッジ時間 2,455 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
7,796 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 33 ms
6,424 KB
testcase_09 AC 32 ms
6,008 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 42 ms
6,860 KB
testcase_12 AC 35 ms
5,652 KB
testcase_13 AC 35 ms
5,608 KB
testcase_14 AC 35 ms
5,648 KB
testcase_15 AC 35 ms
5,916 KB
testcase_16 AC 35 ms
5,604 KB
testcase_17 AC 35 ms
5,856 KB
testcase_18 AC 35 ms
5,600 KB
testcase_19 AC 35 ms
5,780 KB
testcase_20 AC 34 ms
5,652 KB
testcase_21 AC 35 ms
5,660 KB
testcase_22 AC 67 ms
7,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    set<string> a;
    set<string> b;
    vector<string> v;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string x, y;
        cin >> x >> y;
        if(a.count(x)==0&&b.count(x)==0)    v.push_back(x);
        if(a.count(y)==0&&b.count(y)==0)    v.push_back(y);
        a.insert(x);
        b.insert(y);
    }
    for(string s : v)   if(a.count(s)==0)   cout << s << endl;
    return 0;
}
0