結果

問題 No.3196 Unique Nickname
ユーザー Rumain831
提出日時 2025-07-11 22:44:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 1,016 ms
コンパイル使用メモリ 87,852 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2025-07-11 22:44:32
合計ジャッジ時間 1,795 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
  int n; cin >> n;
  vector<string> s(n), t(n);
  map<string, int> cnt;
  for(int i=0; i<n; i++) cin >> s[i] >> t[i], cnt[s[i]]++, cnt[t[i]]++;
  for(int i=0; i<n; i++){
    if(cnt[s[i]]!=1&&cnt[t[i]]!=1){
      cout << "No" << endl; return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
0