結果
問題 |
No.365 ジェンガソート
|
ユーザー |
![]() |
提出日時 | 2019-11-21 11:02:01 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 604 ms / 2,000 ms |
コード長 | 439 bytes |
コンパイル時間 | 2,253 ms |
コンパイル使用メモリ | 74,472 KB |
実行使用メモリ | 59,608 KB |
最終ジャッジ日時 | 2024-10-09 13:37:28 |
合計ジャッジ時間 | 19,194 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n + 1]; for (int i = 0; i < n; i++) { int x = sc.nextInt(); arr[x] = i; } int max = n - 1; for (int i = n; i > 1; i--) { if (arr[i] > arr[i - 1]) { max--; } else { break; } } System.out.println(max); } }