Submission #1591909


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[100000];
        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<100000; 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 0
Code Size 809 Byte
Status RE
Exec Time 415 ms
Memory 51952 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
RE × 1
AC × 4
RE × 5
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 103 ms 18900 KB
0_001.txt AC 94 ms 18900 KB
0_002.txt RE 91 ms 19668 KB
1_003.txt RE 92 ms 19796 KB
1_004.txt AC 390 ms 51952 KB
1_005.txt RE 95 ms 21588 KB
1_006.txt RE 93 ms 23764 KB
1_007.txt RE 96 ms 18900 KB
1_008.txt AC 415 ms 50924 KB