Submission #1591913


Source Code Expand

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner reader= new Scanner(System.in);
        int num=reader.nextInt();
        int[] A= new int[100001];
        for(int i=0; i<num; i++){
            int x= reader.nextInt();
            if (x==0){
                A[0]++;
                A[1]++;
            }
            else
            {if(x==9999){
                A[9999]++;
                A[9998]++;
            }
            else{
                A[x]++;
                A[x+1]++;
                A[x-1]++;
            }}}
            int max=A[0];
            for (int j=1; j<100001; j++){
                if (A[j]>max)
                    max=A[j];
            }
            System.out.println(max);
        }

    }

Submission Info

Submission Time
Task C - Together
User lucy2903
Language Java8 (OpenJDK 1.8.0)
Score 300
Code Size 809 Byte
Status AC
Exec Time 418 ms
Memory 50224 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 9
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt
Case Name Status Exec Time Memory
0_000.txt AC 94 ms 20684 KB
0_001.txt AC 96 ms 18644 KB
0_002.txt AC 105 ms 21204 KB
1_003.txt AC 104 ms 20564 KB
1_004.txt AC 367 ms 45612 KB
1_005.txt AC 404 ms 46312 KB
1_006.txt AC 414 ms 46812 KB
1_007.txt AC 396 ms 48108 KB
1_008.txt AC 418 ms 50224 KB