結果
問題 |
No.1722 [Cherry 3rd Tune C] In my way
|
ユーザー |
![]() |
提出日時 | 2021-10-29 21:25:33 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 244 ms / 2,000 ms |
コード長 | 597 bytes |
コンパイル時間 | 2,032 ms |
コンパイル使用メモリ | 75,972 KB |
実行使用メモリ | 44,456 KB |
最終ジャッジ日時 | 2024-10-07 09:44:03 |
合計ジャッジ時間 | 7,440 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
import java.util.Scanner; import java.util.TreeSet; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] x = new int[n]; for (int i = 0; i < n; i++) { x[i] = sc.nextInt(); } TreeSet<Integer> y = new TreeSet<>(); for (int i = 0; i < m; i++) { y.add(sc.nextInt()); } sc.close(); for (int i = 0; i < n; i++) { Integer a = y.higher(x[i]); if (a == null) { System.out.println("Infinity"); } else { System.out.println(a - x[i]); } } } }