49232023-04-07 12:26:08zolmikiNegáló rendezés (55 pont)javaTime limit exceeded 16/55246ms78888 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/090ms46248 KiB
2Time limit exceeded0/0246ms78888 KiB
3Accepted2/293ms47388 KiB
4Accepted2/292ms47600 KiB
5Accepted2/293ms48408 KiB
6Accepted2/286ms48892 KiB
7Accepted3/390ms49156 KiB
8Accepted2/290ms49572 KiB
9Accepted3/3104ms52040 KiB
10Runtime error0/3174ms75948 KiB
11Runtime error0/3172ms75668 KiB
12Runtime error0/3174ms75220 KiB
13Runtime error0/3172ms75176 KiB
14Runtime error0/3172ms74920 KiB
15Runtime error0/3173ms74764 KiB
16Runtime error0/3184ms74536 KiB
17Runtime error0/3164ms74288 KiB
18Runtime error0/3170ms74040 KiB
19Runtime error0/3171ms73940 KiB
20Runtime error0/3164ms73904 KiB
21Runtime error0/3164ms74028 KiB
22Runtime error0/3172ms73688 KiB