提出 #73499112
ソースコード 拡げる
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
public static int count(int[] arr,int k){
int x= arr[k];
int c=1;
for (int q=k;q<arr.length;q++){
if (arr[q]== x){
x++;
c++;
}}
return c;
}
public static void main (String[] args) throws java.lang.Exception
{
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();
int l=0;
int max=0;
while(l<n){
max= Math.max(count(a,l),max);
l++;
}
System.out.println(max-1);
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Max Straight |
| ユーザ | Krr1ssh_ |
| 言語 | Java24 (OpenJDK 24.0.2) |
| 得点 | 0 |
| コード長 | 686 Byte |
| 結果 | TLE |
| 実行時間 | > 2000 ms |
| メモリ | 67904 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 400 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_00.txt | AC | 70 ms | 40728 KiB |
| 00_sample_01.txt | AC | 70 ms | 40776 KiB |
| 00_sample_02.txt | AC | 71 ms | 40236 KiB |
| 01_random_00.txt | AC | 69 ms | 40320 KiB |
| 01_random_01.txt | AC | 71 ms | 40948 KiB |
| 01_random_02.txt | AC | 72 ms | 41020 KiB |
| 01_random_03.txt | TLE | > 2000 ms | 47676 KiB |
| 01_random_04.txt | TLE | > 2000 ms | 48044 KiB |
| 01_random_05.txt | AC | 1898 ms | 67904 KiB |
| 01_random_06.txt | AC | 762 ms | 67328 KiB |
| 01_random_07.txt | TLE | > 2000 ms | 47944 KiB |
| 01_random_08.txt | AC | 1113 ms | 67780 KiB |
| 01_random_09.txt | AC | 107 ms | 41520 KiB |
| 01_random_10.txt | TLE | > 2000 ms | 47312 KiB |
| 01_random_11.txt | TLE | > 2000 ms | 47680 KiB |
| 01_random_12.txt | AC | 270 ms | 58212 KiB |
| 01_random_13.txt | TLE | > 2000 ms | 47448 KiB |
| 01_random_14.txt | AC | 162 ms | 46568 KiB |
| 01_random_15.txt | TLE | > 2000 ms | 47408 KiB |
| 01_random_16.txt | AC | 1580 ms | 67800 KiB |
| 01_random_17.txt | TLE | > 2000 ms | 47852 KiB |
| 01_random_18.txt | TLE | > 2000 ms | 47316 KiB |
| 01_random_19.txt | TLE | > 2000 ms | 47344 KiB |
| 01_random_20.txt | TLE | > 2000 ms | 46768 KiB |
| 01_random_21.txt | TLE | > 2000 ms | 47460 KiB |
| 01_random_22.txt | AC | 236 ms | 55708 KiB |