結果
| 問題 |
No.938 賢人を探せ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-01 14:51:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 55 ms / 2,000 ms |
| コード長 | 519 bytes |
| コンパイル時間 | 2,266 ms |
| コンパイル使用メモリ | 203,960 KB |
| 最終ジャッジ日時 | 2025-01-08 06:36:37 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<string> A(N), B(N);
for (int i = 0; i < N; ++i) {
cin >> A[i] >> B[i];
}
vector<string> names;
set<string> known;
set<string> cheat;
for (int i = 0; i < N; ++i) {
if (!known.count(B[i])) names.push_back(B[i]);
known.insert(B[i]);
cheat.insert(A[i]);
}
for (string name : names) {
if (cheat.count(name)) continue;
cout << name << endl;
}
return 0;
}