結果

問題 No.938 賢人を探せ
ユーザー ajiruajiruajiruajiru
提出日時 2019-12-04 21:54:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 754 ms
コンパイル使用メモリ 78,996 KB
実行使用メモリ 7,020 KB
最終ジャッジ日時 2024-12-14 11:47:27
合計ジャッジ時間 1,970 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
using namespace std;

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n; cin >> n;
	vector<string> candidates;
	set<string> cheaters;
	string s;
	for (int i = 0; i < n; ++i) {
		cin >> s;
		cheaters.insert(s);
		cin >> s;
		candidates.push_back(s);
	}

	set<string> named;
	for (int i = 0; i < candidates.size(); ++i) {
		if (cheaters.count(candidates[i]) == 0 
			&& named.count(candidates[i]) == 0) 
			cout << candidates[i] << endl;
		named.insert(candidates[i]);
	}
	return 0;
}
0