結果
問題 |
No.397 NO MORE KADOMATSU
|
ユーザー |
![]() |
提出日時 | 2018-09-19 16:28:51 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 767 bytes |
コンパイル時間 | 2,429 ms |
コンパイル使用メモリ | 78,208 KB |
実行使用メモリ | 86,916 KB |
最終ジャッジ日時 | 2024-07-16 16:09:17 |
合計ジャッジ時間 | 5,876 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 17 |
ソースコード
import java.util.Scanner; public class Main { static StringBuilder sb; public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int[]A = new int[N]; for(int i = 0; i < N; i++) { A[i] = scan.nextInt(); } sb = new StringBuilder(); bubbleSort(A, N); System.out.print(sb.toString()); int Dummy = scan.nextInt(); scan.close(); if(Dummy == -1) { System.exit(0); } } static void bubbleSort(int[]A, int n) { boolean flag = true; while(flag) { flag = false; for(int i = n - 1; i >= 1; i--) { if(A[i] < A[i - 1]) { int t = A[i]; A[i] = A[i - 1]; A[i - 1] = t; flag = true; sb.append(i).append(" ").append(i-1); sb.append("\n"); } } } } }