結果
問題 |
No.3196 Unique Nickname
|
ユーザー |
![]() |
提出日時 | 2025-07-11 22:01:29 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 134 ms / 2,000 ms |
コード長 | 730 bytes |
コンパイル時間 | 3,084 ms |
コンパイル使用メモリ | 80,172 KB |
実行使用メモリ | 46,720 KB |
最終ジャッジ日時 | 2025-07-11 22:01:42 |
合計ジャッジ時間 | 6,359 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] s = new String[n]; String[] t = new String[n]; for (int i = 0; i < n; i++) { s[i] = sc.next(); t[i] = sc.next(); } sc.close(); for (int i = 0; i < n; i++) { boolean flg1 = true; boolean flg2 = true; for (int j = 0; j < n; j++) { if (i != j) { if (s[i].equals(s[j]) || s[i].equals(t[j])) { flg1 = false; } if (t[i].equals(s[j]) || t[i].equals(t[j])) { flg2 = false; } } } if (!flg1 && !flg2) { System.out.println("No"); return; } } System.out.println("Yes"); } }