結果
問題 |
No.365 ジェンガソート
|
ユーザー |
|
提出日時 | 2018-07-04 02:27:40 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 450 bytes |
コンパイル時間 | 3,553 ms |
コンパイル使用メモリ | 74,988 KB |
実行使用メモリ | 78,540 KB |
最終ジャッジ日時 | 2024-07-01 02:06:55 |
合計ジャッジ時間 | 12,262 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 6 TLE * 2 -- * 23 |
ソースコード
import java.util.*; public class No365{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayList<Integer> a = new ArrayList<Integer>(); for(int i = 0; i < n; i++){ a.add(sc.nextInt()); } int count = 0; int idx = 0; for(int i = 0; i < n; i++){ if(a.get(idx) != i+1){ a.remove(a.indexOf(i+1)); count++; }else{ idx++; } } System.out.println(count); } }