結果
| 問題 | No.938 賢人を探せ |
| コンテスト | |
| ユーザー |
xardas
|
| 提出日時 | 2019-12-21 13:20:14 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 65 ms / 2,000 ms |
| コード長 | 711 bytes |
| 記録 | |
| コンパイル時間 | 935 ms |
| コンパイル使用メモリ | 88,576 KB |
| 最終ジャッジ日時 | 2025-01-08 13:47:41 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
// Example program
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
#include <vector>
int main()
{
int n;
std::cin >> n;
std::set<std::string> all, cheaters, non_cheaters;
std::vector<std::string> order;
for (int i=0;i<n;++i) {
std::string a,b;
std::cin >> a >> b;
all.insert(b);
cheaters.insert(a);
order.push_back(b);
}
std::set_difference(all.begin(), all.end(), cheaters.begin(), cheaters.end(), std::inserter(non_cheaters, non_cheaters.end()));
for (const auto& s : order)
{
if (non_cheaters.count(s))
std::cout << s << std::endl;
non_cheaters.erase(s);
}
return 0;
}
xardas