結果
問題 |
No.1130 Grid Numbers
|
ユーザー |
|
提出日時 | 2020-08-02 12:11:30 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 63 ms / 2,000 ms |
コード長 | 876 bytes |
コンパイル時間 | 2,235 ms |
コンパイル使用メモリ | 75,856 KB |
実行使用メモリ | 37,244 KB |
最終ジャッジ日時 | 2024-07-18 10:33:59 |
合計ジャッジ時間 | 3,544 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
import java.io.*; import java.util.ArrayList; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" "); int h = Integer.parseInt(line[0]), w = Integer.parseInt(line[1]); ArrayList<Integer> arr = new ArrayList<Integer>(h * w); for (int i = 0; i < h; i++) { line = br.readLine().split(" "); for (int j = 0; j < w; j++) { arr.add(Integer.parseInt(line[j])); } } arr.sort(null); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (j > 0) System.out.print(" "); System.out.print(arr.get(i * w + j)); } System.out.println(); } } }