結果

問題 No.938 賢人を探せ
ユーザー kuhakukuhaku
提出日時 2019-12-15 00:51:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 1,495 bytes
コンパイル時間 1,864 ms
コンパイル使用メモリ 174,820 KB
実行使用メモリ 7,216 KB
最終ジャッジ日時 2023-08-21 03:39:51
合計ジャッジ時間 3,093 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
7,128 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 13 ms
5,396 KB
testcase_09 AC 13 ms
5,168 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 14 ms
5,600 KB
testcase_12 AC 14 ms
4,916 KB
testcase_13 AC 14 ms
4,588 KB
testcase_14 AC 14 ms
4,556 KB
testcase_15 AC 14 ms
4,616 KB
testcase_16 AC 14 ms
4,944 KB
testcase_17 AC 14 ms
4,684 KB
testcase_18 AC 14 ms
4,940 KB
testcase_19 AC 14 ms
4,752 KB
testcase_20 AC 14 ms
4,544 KB
testcase_21 AC 14 ms
4,600 KB
testcase_22 AC 47 ms
7,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//confilm 0LL and 1LL
//confilm cornercase such as 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n;
	cin >> n;
	vector<string> a(n), b(n);
	rep(i, n) cin >> a[i] >> b[i];

	unordered_set<string> st;
	rep(i, n) st.insert(b[i]);
	rep(i, n) st.erase(a[i]);

	unordered_set<string> ans;
	rep(i, n){
		if(st.count(b[i]) && !ans.count(b[i])){
			co(b[i]);
			ans.insert(b[i]);
		}
	}

	return 0;
}
0