結果

問題 No.938 賢人を探せ
ユーザー kyo1kyo1
提出日時 2021-01-12 00:33:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 419 bytes
コンパイル時間 2,222 ms
コンパイル使用メモリ 214,068 KB
実行使用メモリ 7,016 KB
最終ジャッジ日時 2024-05-01 06:58:18
合計ジャッジ時間 3,632 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
7,016 KB
testcase_01 WA -
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 21 ms
6,940 KB
testcase_09 AC 24 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 30 ms
6,944 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 27 ms
7,012 KB
権限があれば一括ダウンロードができます

ソースコード

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