結果
問題 | No.938 賢人を探せ |
ユーザー |
![]() |
提出日時 | 2020-01-30 21:49:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 518 bytes |
コンパイル時間 | 1,157 ms |
コンパイル使用メモリ | 89,684 KB |
実行使用メモリ | 6,868 KB |
最終ジャッジ日時 | 2024-12-14 11:56:51 |
合計ジャッジ時間 | 2,229 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <set>#include <string>#include <vector>#include <iostream>#include <algorithm>using namespace std;int main() {cin.tie(0);ios_base::sync_with_stdio(false);int N;cin >> N;vector<string> A(N), B(N), seq;set<string> S;for (int i = 0; i < N; ++i) {cin >> A[i] >> B[i];if (S.find(B[i]) == S.end()) {S.insert(B[i]);seq.push_back(B[i]);}}sort(A.begin(), A.end());for (string s : seq) {if (!binary_search(A.begin(), A.end(), s)) {cout << s << '\n';}}return 0;}