답안 #98455

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
98455 2019-02-23T17:51:29 Z Leonardo_Paes Zoltan (COCI16_zoltan) C++11
14 / 140
112 ms 3580 KB
#include <bits/stdc++.h>

using namespace std;

long long vet[200100], dp[200100];

long long power(long long x, long long p){
    if(dp[x]!=-1)return dp[x];
    if(x<=1)return 1;
    else return dp[x] = (x%p * (x-1)%p)%p;
}


int main(){

    int n;

    cin >> n;

    memset(dp, -1, sizeof dp);

    for(int i=1; i<=n; i++){
        cin >> vet[i];
    }

    sort(vet+1, vet+n+1);

    long long int resp=1, atual=1;

    long long int mod = 1e9 + 7;

    int length=0;
    for(int i=1; i<=n; i++){
        if(vet[i+1]==vet[i]){
            atual++;
        }
        else{
            length++;
            resp=(resp*atual*power(atual, mod))%mod;
            atual=1;
        }
    }
    cout << length << " " << resp%mod << endl;

    return 0;

}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1920 KB Output isn't correct
2 Incorrect 4 ms 1920 KB Output isn't correct
3 Incorrect 3 ms 1920 KB Output isn't correct
4 Correct 3 ms 1920 KB Output is correct
5 Correct 4 ms 1920 KB Output is correct
6 Incorrect 4 ms 1920 KB Output isn't correct
7 Incorrect 4 ms 1920 KB Output isn't correct
8 Incorrect 4 ms 1920 KB Output isn't correct
9 Incorrect 4 ms 1920 KB Output isn't correct
10 Incorrect 4 ms 1920 KB Output isn't correct
11 Incorrect 83 ms 3188 KB Output isn't correct
12 Incorrect 72 ms 2960 KB Output isn't correct
13 Incorrect 57 ms 2936 KB Output isn't correct
14 Incorrect 77 ms 2936 KB Output isn't correct
15 Incorrect 93 ms 3192 KB Output isn't correct
16 Incorrect 112 ms 3448 KB Output isn't correct
17 Incorrect 96 ms 3444 KB Output isn't correct
18 Incorrect 107 ms 3420 KB Output isn't correct
19 Incorrect 93 ms 3580 KB Output isn't correct
20 Incorrect 80 ms 3448 KB Output isn't correct