結果

問題 No.938 賢人を探せ
ユーザー kyo1
提出日時 2021-01-12 00:33:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 419 bytes
コンパイル時間 2,089 ms
コンパイル使用メモリ 205,300 KB
最終ジャッジ日時 2025-01-17 16:16:30
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 10 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<string> S;
  map<string, bool> mp;
  for (int i = 0; i < N; i++) {
    string a, b;
    cin >> a >> b;
    S.emplace_back(b);
    mp[a] = false;
    if (mp.find(b) == mp.end() || mp[b]) mp[b] = true;
  }
  for (auto s : S) {
    if (mp[s]) cout << s << '\n';
  }
  return 0;
}
0