Submission #17438

# Submission time Handle Problem Language Result Execution time Memory
17438 2015-12-11T15:03:27 Z atomzeno 지우개 (GA4_eraser) C++
46 / 100
29 ms 3428 KB
#include<stdio.h>
#define MX 100001
#include<algorithm>
using namespace std;
int n;
long long int MOD=6000000042;
long long int a[MX],b[MX],c[MX],m,s,ss=1,ans;
int main(){
    int i,n;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        s+=a[i];
        s%=MOD;
    }
    sort(a,a+n);
    m=1;
    b[1]=a[0],c[1]=1;
    for(i=1;i<n;i++){
        if(b[m]==a[i]){c[m]++;}
        else{b[++m]=a[i],c[m]++;}
    }
    ss=s;
    ss*=s;
    ss=ss%MOD;
    ss*=s;
    ss=ss%MOD;
    ans=ss;
    for(i=1;i<=m;i++){
        b[i]*=c[i];
        b[i]%=MOD;
    }
    for(i=1;i<=m;i++){
        ss=b[i]*(long long int)2;
        ss*=b[i];
        ss=ss%MOD;
        ss*=b[i];
        ss=ss%MOD;
        ss%=MOD;
        ans+=ss;
        ans%=MOD;
    }
    for(i=1;i<=m;i++){
        ss=b[i]*(long long int)3;
        ss*=b[i];
        ss=ss%MOD;
        ss*=s;
        ss=ss%MOD;
        ans+=(MOD-ss);
        ans%=MOD;
    }
    printf("%lld",ans/6);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3428 KB Output is correct
2 Correct 0 ms 3428 KB Output is correct
3 Correct 0 ms 3428 KB Output is correct
4 Correct 0 ms 3428 KB Output is correct
5 Correct 0 ms 3428 KB Output is correct
6 Correct 0 ms 3428 KB Output is correct
7 Correct 0 ms 3428 KB Output is correct
8 Correct 0 ms 3428 KB Output is correct
9 Correct 0 ms 3428 KB Output is correct
10 Correct 0 ms 3428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3428 KB Output is correct
2 Correct 0 ms 3428 KB Output is correct
3 Correct 0 ms 3428 KB Output is correct
4 Correct 0 ms 3428 KB Output is correct
5 Correct 0 ms 3428 KB Output is correct
6 Correct 0 ms 3428 KB Output is correct
7 Correct 0 ms 3428 KB Output is correct
8 Correct 0 ms 3428 KB Output is correct
9 Correct 0 ms 3428 KB Output is correct
10 Correct 0 ms 3428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3428 KB Output is correct
2 Correct 0 ms 3428 KB Output is correct
3 Correct 0 ms 3428 KB Output is correct
4 Correct 0 ms 3428 KB Output is correct
5 Correct 0 ms 3428 KB Output is correct
6 Correct 0 ms 3428 KB Output is correct
7 Correct 0 ms 3428 KB Output is correct
8 Correct 0 ms 3428 KB Output is correct
9 Correct 0 ms 3428 KB Output is correct
10 Correct 0 ms 3428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3428 KB Output is correct
2 Correct 0 ms 3428 KB Output is correct
3 Correct 0 ms 3428 KB Output is correct
4 Correct 0 ms 3428 KB Output is correct
5 Correct 0 ms 3428 KB Output is correct
6 Correct 0 ms 3428 KB Output is correct
7 Correct 0 ms 3428 KB Output is correct
8 Correct 0 ms 3428 KB Output is correct
9 Correct 0 ms 3428 KB Output is correct
10 Correct 0 ms 3428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 3428 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 3428 KB Output isn't correct
2 Halted 0 ms 0 KB -