답안 #17439

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17439 2015-12-11T15:04:10 Z atomzeno 지우개 (GA4_eraser) C++
46 / 100
30 ms 3660 KB
#include<stdio.h>
#define MX 110001
#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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3660 KB Output is correct
2 Correct 0 ms 3660 KB Output is correct
3 Correct 0 ms 3660 KB Output is correct
4 Correct 0 ms 3660 KB Output is correct
5 Correct 0 ms 3660 KB Output is correct
6 Correct 0 ms 3660 KB Output is correct
7 Correct 0 ms 3660 KB Output is correct
8 Correct 0 ms 3660 KB Output is correct
9 Correct 0 ms 3660 KB Output is correct
10 Correct 0 ms 3660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3660 KB Output is correct
2 Correct 0 ms 3660 KB Output is correct
3 Correct 0 ms 3660 KB Output is correct
4 Correct 0 ms 3660 KB Output is correct
5 Correct 0 ms 3660 KB Output is correct
6 Correct 0 ms 3660 KB Output is correct
7 Correct 0 ms 3660 KB Output is correct
8 Correct 0 ms 3660 KB Output is correct
9 Correct 0 ms 3660 KB Output is correct
10 Correct 0 ms 3660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3660 KB Output is correct
2 Correct 0 ms 3660 KB Output is correct
3 Correct 0 ms 3660 KB Output is correct
4 Correct 0 ms 3660 KB Output is correct
5 Correct 0 ms 3660 KB Output is correct
6 Correct 0 ms 3660 KB Output is correct
7 Correct 0 ms 3660 KB Output is correct
8 Correct 0 ms 3660 KB Output is correct
9 Correct 0 ms 3660 KB Output is correct
10 Correct 0 ms 3660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3660 KB Output is correct
2 Correct 0 ms 3660 KB Output is correct
3 Correct 0 ms 3660 KB Output is correct
4 Correct 0 ms 3660 KB Output is correct
5 Correct 0 ms 3660 KB Output is correct
6 Correct 0 ms 3660 KB Output is correct
7 Correct 0 ms 3660 KB Output is correct
8 Correct 0 ms 3660 KB Output is correct
9 Correct 0 ms 3660 KB Output is correct
10 Correct 0 ms 3660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 3660 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 3660 KB Output isn't correct
2 Halted 0 ms 0 KB -