結果
問題 | No.938 賢人を探せ |
ユーザー | kinsei0916 |
提出日時 | 2019-12-01 17:36:26 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 3,085 bytes |
コンパイル時間 | 2,525 ms |
コンパイル使用メモリ | 171,484 KB |
実行使用メモリ | 7,672 KB |
最終ジャッジ日時 | 2024-12-14 11:44:37 |
合計ジャッジ時間 | 2,564 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#pragma region #include <bits/stdc++.h> using namespace std; #define ALL(x) (x).begin(), (x).end() #define POW2(n) (1LL << (n)) #define FOR(i, begin, end) for (int i = (begin); i < (end); i++) #define IFOR(i, begin, end) for (int i = (end)-1; i >= (begin); i--) #define REP(i, n) FOR(i, 0, n) #define IREP(i, n) IFOR(i, 0, n) #define MOD 1000000007 #define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl; typedef long long ll; template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { os << "vec[ "; REP(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i]; os << " ]"; return os; } template <typename T> ostream &operator<<(ostream &os, const deque<T> &deq) { os << "deq[ "; REP(i, deq.size()) i == 0 ? os << deq[i] : os << ", " << deq[i]; os << " ]"; return os; } template <typename T> ostream &operator<<(ostream &os, const set<T> &set) { os << "{ "; for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s; os << " }"; return os; } template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &set) { os << "{ "; for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s; os << " }"; return os; } template <typename T> ostream &operator<<(ostream &os, const multiset<T> &set) { os << "{ "; for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s; os << " }"; return os; } template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &set) { os << "{ "; for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s; os << " }"; return os; } template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; } template <typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &m) { os << "{ "; for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second; os << " }"; return os; } template <typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &m) { os << "{ "; for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second; os << " }"; return os; } #pragma endregion bool isCollided(vector<vector<bool>> &map, int h, int w, int x, int y) { REP(i, w) REP(j, h) if (map[y + j][x + i]) return true; return false; } int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10); int N; cin >> N; set<string> A, C; vector<string> B(N), result; string a, b; REP(i, N) { cin >> a >> B[i]; A.insert(a); } for (string &b : B) { if (A.find(b) == A.end() && C.find(b) == C.end()) { result.push_back(b); C.insert(b); } } for (string &r : result) cout << r << "\n"; }