結果
| 問題 |
No.397 NO MORE KADOMATSU
|
| ユーザー |
|
| 提出日時 | 2016-07-15 23:31:47 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 311 ms / 2,000 ms |
| コード長 | 909 bytes |
| コンパイル時間 | 3,675 ms |
| コンパイル使用メモリ | 79,460 KB |
| 実行使用メモリ | 73,576 KB |
| 平均クエリ数 | 414.83 |
| 最終ジャッジ日時 | 2024-07-17 00:08:14 |
| 合計ジャッジ時間 | 9,117 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
import java.util.Scanner;
public class Yukicoder397 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(), cnt = 0;
int[] a = new int[n];
int[] res = new int[10000];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (a[i] < a[j]) {
int buf = a[i];
a[i] = a[j];
a[j] = buf;
res[cnt * 2] = i;
res[cnt * 2 + 1] = j;
cnt++;
}
}
}
System.out.println(cnt);
for (int i = 0; i < cnt; i++) {
System.out.println(res[i * 2] + " " + res[i * 2 + 1]);
}
System.out.flush();
sc.nextInt();
}
}