結果
問題 |
No.938 賢人を探せ
|
ユーザー |
|
提出日時 | 2019-12-15 00:51:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 53 ms / 2,000 ms |
コード長 | 1,495 bytes |
コンパイル時間 | 1,925 ms |
コンパイル使用メモリ | 177,056 KB |
実行使用メモリ | 7,296 KB |
最終ジャッジ日時 | 2024-12-14 11:52:51 |
合計ジャッジ時間 | 2,902 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
//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; }