Submission #98453

# Submission time Handle Problem Language Result Execution time Memory
98453 2019-02-23T17:38:33 Z Leonardo_Paes Zoltan (COCI16_zoltan) C++11
7 / 140
128 ms 2008 KB
#include <bits/stdc++.h>

using namespace std;

long long vet[200100];

long long power(long long x, long long y, long long p){
    long long 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-1,mod))%mod;
            resp=(resp*atual)%mod;
            atual=0;
        }
    }
    cout << length << " " << resp%mod << endl;

    return 0;

}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Incorrect 3 ms 384 KB Output isn't correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Incorrect 2 ms 256 KB Output isn't correct
6 Correct 2 ms 384 KB Output is correct
7 Incorrect 3 ms 384 KB Output isn't correct
8 Incorrect 3 ms 384 KB Output isn't correct
9 Incorrect 3 ms 256 KB Output isn't correct
10 Incorrect 3 ms 256 KB Output isn't correct
11 Incorrect 76 ms 1528 KB Output isn't correct
12 Incorrect 99 ms 1400 KB Output isn't correct
13 Incorrect 62 ms 1372 KB Output isn't correct
14 Incorrect 77 ms 1400 KB Output isn't correct
15 Incorrect 96 ms 1656 KB Output isn't correct
16 Incorrect 128 ms 1912 KB Output isn't correct
17 Incorrect 97 ms 1912 KB Output isn't correct
18 Incorrect 117 ms 2008 KB Output isn't correct
19 Incorrect 79 ms 1912 KB Output isn't correct
20 Incorrect 83 ms 1888 KB Output isn't correct