제출 #98449

#제출 시각아이디문제언어결과실행 시간메모리
98449Leonardo_PaesZoltan (COCI16_zoltan)C++11
14 / 140
112 ms1144 KiB
#include <bits/stdc++.h>

using namespace std;

int vet[200100];

int power(int x, int y, int p){
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
        res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

int main(){

    int n;

    cin >> n;

    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++;
        if(atual==1)atual=0;
            resp=(resp*power(2,atual,mod))%mod;
            atual=0;
        }
    }
    cout << length << " " << resp << endl;

    return 0;

}

#Verdict Execution timeMemoryGrader output
Fetching results...