結果
問題 |
No.365 ジェンガソート
|
ユーザー |
|
提出日時 | 2017-04-01 11:43:33 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 594 bytes |
コンパイル時間 | 3,170 ms |
コンパイル使用メモリ | 75,960 KB |
実行使用メモリ | 78,772 KB |
最終ジャッジ日時 | 2024-07-07 18:47:06 |
合計ジャッジ時間 | 9,381 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 TLE * 1 -- * 24 |
ソースコード
import java.util.ArrayList; import java.util.Scanner; public class Jengasort { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner s = new Scanner(System.in); int N = s.nextInt(); ArrayList<Integer> list = new ArrayList<>(); for(int i = 0;i < N;i++){ list.add(s.nextInt()); } s.close(); int count = 0; for(int i = N;i > 1;i--){ if(list.indexOf(i) < list.indexOf(i-1)){ count++; list.remove(list.indexOf(i-1)); list.add(0, i-1); //System.out.println(list); } } System.out.println(count); } }