結果
問題 | No.938 賢人を探せ |
ユーザー | hipopo |
提出日時 | 2019-12-25 13:26:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 495 bytes |
コンパイル時間 | 2,088 ms |
コンパイル使用メモリ | 203,776 KB |
最終ジャッジ日時 | 2025-01-08 15:11:08 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> a(n), b(n); for (int i = 0; i < n; i++) { cin >> a.at(i) >> b.at(i); } set<string> s; for (int i = 0; i < n; i++) { s.insert(b.at(i)); } for (int i = 0; i < n; i++) { s.erase(a.at(i)); } for (int i = 0; i < n; i++) { if (s.count(b.at(i))) { cout << b.at(i) << endl; s.erase(b.at(i)); } } }