Submission #98448

# Submission time Handle Problem Language Result Execution time Memory
98448 2019-02-23T17:33:27 Z Leonardo_Paes Zoltan (COCI16_zoltan) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

int vet[200100];

 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;
}

 main(){

    int n;

    cin >> n;

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

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

    int resp=1, atual=1;

    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;

}

Compilation message

zoltan.cpp:9:27: error: ISO C++ forbids declaration of 'power' with no type [-fpermissive]
  power(int x, int y, int p){
                           ^
zoltan.cpp:22:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  main(){
       ^