結果
問題 | No.397 NO MORE KADOMATSU |
ユーザー | nCk_cv |
提出日時 | 2016-08-28 20:43:49 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 788 bytes |
コンパイル時間 | 2,366 ms |
コンパイル使用メモリ | 79,004 KB |
実行使用メモリ | 75,104 KB |
平均クエリ数 | 626.61 |
最終ジャッジ日時 | 2023-09-23 11:23:30 |
合計ジャッジ時間 | 9,299 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 178 ms
72,976 KB |
testcase_01 | RE | - |
testcase_02 | AC | 147 ms
70,636 KB |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | AC | 155 ms
72,288 KB |
testcase_10 | RE | - |
testcase_11 | AC | 158 ms
72,104 KB |
testcase_12 | AC | 290 ms
72,848 KB |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | AC | 149 ms
70,988 KB |
testcase_17 | AC | 146 ms
71,644 KB |
ソースコード
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { static int INF = 2 << 27; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N]; for(int i = 0; i < N; i++) { A[i] = sc.nextInt(); } List<Integer> u = new ArrayList<>(); List<Integer> v = new ArrayList<>(); for(int i = 0; i < N; i++) { for(int j = i+1; j < N-1; j++) { if(A[j] > A[j+1]) { int tmp = A[j]; A[j] = A[j+1]; A[j+1] = tmp; u.add(j); v.add(j+1); } } } System.out.println(u.size()); for(int i = 0; i < u.size(); i++) { System.out.println(u.get(i) + " " + v.get(i)); } System.out.flush(); sc.nextInt(); } }