結果

問題 No.938 賢人を探せ
ユーザー MayimgMayimg
提出日時 2020-01-14 07:20:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 2,923 ms
コンパイル使用メモリ 208,004 KB
実行使用メモリ 5,912 KB
最終ジャッジ日時 2023-08-21 03:42:57
合計ジャッジ時間 4,190 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
5,912 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 13 ms
5,380 KB
testcase_09 AC 12 ms
4,872 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 22 ms
5,836 KB
testcase_12 AC 13 ms
4,580 KB
testcase_13 AC 13 ms
4,876 KB
testcase_14 AC 13 ms
4,592 KB
testcase_15 AC 13 ms
4,556 KB
testcase_16 AC 13 ms
4,592 KB
testcase_17 AC 14 ms
4,784 KB
testcase_18 AC 13 ms
4,612 KB
testcase_19 AC 14 ms
4,528 KB
testcase_20 AC 14 ms
4,604 KB
testcase_21 AC 13 ms
4,604 KB
testcase_22 AC 19 ms
5,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<string> a(n), b(n);
  set<string> ok;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    ok.insert(b[i]);
  }
  for (int i = 0; i < n; i++) {
    if (ok.count(a[i])) ok.erase(a[i]);
  }
  for (int i = 0; i < n; i++) {
    if (ok.count(b[i])) {
      cout << b[i] << '\n';
      ok.erase(b[i]);
    }
  }
  return 0;
}
0