結果
問題 |
No.3196 Unique Nickname
|
ユーザー |
![]() |
提出日時 | 2025-07-12 10:25:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 704 bytes |
コンパイル時間 | 777 ms |
コンパイル使用メモリ | 76,964 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-07-12 10:25:44 |
合計ジャッジ時間 | 1,574 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:31:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 31 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:36:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 36 | scanf("%s%s", s, t); | ~~~~~^~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 3196.cc: No.3196 Unique Nickname - yukicoder */ #include<cstdio> #include<string> #include<map> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 100; /* typedef */ using msi = map<string,int>; /* global variables */ string ss[MAX_N], ts[MAX_N]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); msi scs; for (int i = 0; i < n; i++) { char s[32], t[32]; scanf("%s%s", s, t); string si(s), ti(t); ss[i] = si, ts[i] = ti; scs[si]++, scs[ti]++; } for (int i = 0; i < n; i++) if (scs[ss[i]] > 1 && scs[ts[i]] > 1) { puts("No"); return 0; } puts("Yes"); return 0; }