結果

問題 No.938 賢人を探せ
ユーザー sash2104sash2104
提出日時 2019-12-01 01:58:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 413 bytes
コンパイル時間 763 ms
コンパイル使用メモリ 79,248 KB
実行使用メモリ 6,988 KB
最終ジャッジ日時 2024-12-14 11:42:34
合計ジャッジ時間 1,992 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  int n;
  cin >> n;
  vector<string> ok;
  set<string> ng;
  for (int i = 0; i < n; ++i) { 
    string a, b;
    cin >> a >> b;
    // cerr << a << " " << b << endl;
    ng.insert(a);
    ok.push_back(b);
  }
  for (string &b: ok) { 
    if (ng.find(b) != ng.end()) continue;
    ng.insert(b);
    cout << b << endl;
  }
}

0