結果
問題 |
No.938 賢人を探せ
|
ユーザー |
|
提出日時 | 2020-01-14 07:20:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 489 bytes |
コンパイル時間 | 2,174 ms |
コンパイル使用メモリ | 200,744 KB |
最終ジャッジ日時 | 2025-01-08 17:54:40 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#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; }