49222023-04-07 12:26:03zolmikiNegáló rendezés (55 pont)javaTime limit exceeded 16/55234ms78796 KiB
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Hashtable;

public class main {

    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        int[] numbers = new int[N];
        String [] readed = br.readLine().split(" ");
        for(int i = 0; i < N; i++){
            numbers[i] = Integer.parseInt(readed[i]);
        }

        Hashtable<Integer, Integer> agenda = new Hashtable<Integer, Integer>();
        for(int n : numbers){
            if(agenda.containsKey(n)){
                agenda.put(n, agenda.get(n) + 1);
            } else {
                agenda.put(n, 1);
            }
        }

        int minimum = Integer.MAX_VALUE;
        for(int i : agenda.keySet()){
            if(minimum > i){
                minimum = i;
            }
        }
        agenda.remove(minimum);

        int modulo = (int)Math.pow(10, 9) + 7;
        long result = 1;
        for(int i : agenda.keySet()){
            result = ( result * (agenda.get(i) + 1)) % modulo;
        }

        System.out.println(result);

    }
}
SubtaskSumTestVerdictTimeMemory
base16/55
1Accepted0/086ms46468 KiB
2Time limit exceeded0/0234ms78796 KiB
3Accepted2/283ms47432 KiB
4Accepted2/282ms47492 KiB
5Accepted2/290ms49224 KiB
6Accepted2/286ms49492 KiB
7Accepted3/390ms49468 KiB
8Accepted2/292ms50020 KiB
9Accepted3/3103ms52648 KiB
10Runtime error0/3172ms75560 KiB
11Runtime error0/3177ms75352 KiB
12Runtime error0/3172ms75092 KiB
13Runtime error0/3173ms74996 KiB
14Runtime error0/3172ms75004 KiB
15Runtime error0/3167ms74776 KiB
16Runtime error0/3182ms74376 KiB
17Runtime error0/3178ms74160 KiB
18Runtime error0/3178ms73912 KiB
19Runtime error0/3174ms73980 KiB
20Runtime error0/3182ms73868 KiB
21Runtime error0/3165ms73640 KiB
22Runtime error0/3174ms73712 KiB