結果

問題 No.938 賢人を探せ
ユーザー iqueue02iqueue02
提出日時 2019-12-01 12:07:04
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 2,316 ms
コンパイル使用メモリ 178,584 KB
実行使用メモリ 7,612 KB
最終ジャッジ日時 2023-08-21 03:29:40
合計ジャッジ時間 3,766 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
7,612 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 23 ms
6,424 KB
testcase_09 AC 25 ms
6,580 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 31 ms
6,456 KB
testcase_12 AC 27 ms
5,692 KB
testcase_13 AC 26 ms
5,544 KB
testcase_14 AC 27 ms
5,384 KB
testcase_15 AC 27 ms
5,440 KB
testcase_16 AC 27 ms
5,616 KB
testcase_17 AC 27 ms
5,564 KB
testcase_18 AC 27 ms
5,628 KB
testcase_19 AC 27 ms
5,392 KB
testcase_20 AC 26 ms
5,452 KB
testcase_21 AC 27 ms
5,480 KB
testcase_22 AC 61 ms
7,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  map<string, int> mp;
  vector<pair<string,string>> p;
  rep(i,n) {
    string a, b;
    cin >> a >> b;
    mp[a] = 1;
    if (!mp.count(b)) mp[b] = 0;
    pair<string,string> x = make_pair(a,b);
    p.emplace_back(x);
  }

  rep(i,n) {
    if (mp[p[i].second]) continue;
    cout << p[i].second << endl;
    mp[p[i].second]++;
  }

  return 0;
}
0