Submission #2705

# Submission time Handle Problem Language Result Execution time Memory
2705 2013-07-31T03:35:48 Z hana5505 지우개 (GA4_eraser) C++
100 / 100
24 ms 3432 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
int ar[100001];
int aa[100001];
long long g1[100001];
long long g2[100001];
long long ab(long long k){
    return (k+2000000014)%2000000014;
}
int main()
{
    int n,i,sz=0;
    long long sum1=0,sum2=0,ans=0;
 
    scanf("%d",&n);
 
    for(i=1;i<=n;i++)
        scanf("%d",&ar[i]);
 
    sort(ar+1,ar+n+1);
 
    for(i=1;i<=n;i++){
        if(!aa[ar[i]]){
            g1[++sz]=(long long)ar[i];
            aa[ar[i]]=1;
        }
        g2[sz]++;
    }
 
    for(i=2;i<=sz;i++){
        sum1=ab(sum1+ab(g1[i]*g2[i]));
        sum2=ab(sum2+ab( ab(g1[i]*g2[i])*ab(g1[i]*g2[i]) ));
    }
 
    for(i=1;i<=sz-2;i++){
        ans=ab( ans+ab( ab(ab(g1[i]*g2[i])* ab(sum1*sum1-sum2) ))/2 );
        sum1=ab(sum1-ab(g1[i+1]*g2[i+1]));
        sum2=ab(sum2-ab( ab(g1[i+1]*g2[i+1])*ab(g1[i+1]*g2[i+1]) ));
    }
 
    printf("%lld",ans%1000000007);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3432 KB Output is correct
2 Correct 0 ms 3432 KB Output is correct
3 Correct 0 ms 3432 KB Output is correct
4 Correct 0 ms 3432 KB Output is correct
5 Correct 0 ms 3432 KB Output is correct
6 Correct 0 ms 3432 KB Output is correct
7 Correct 0 ms 3432 KB Output is correct
8 Correct 0 ms 3432 KB Output is correct
9 Correct 0 ms 3432 KB Output is correct
10 Correct 0 ms 3432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3432 KB Output is correct
2 Correct 0 ms 3432 KB Output is correct
3 Correct 0 ms 3432 KB Output is correct
4 Correct 0 ms 3432 KB Output is correct
5 Correct 0 ms 3432 KB Output is correct
6 Correct 0 ms 3432 KB Output is correct
7 Correct 0 ms 3432 KB Output is correct
8 Correct 0 ms 3432 KB Output is correct
9 Correct 0 ms 3432 KB Output is correct
10 Correct 0 ms 3432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3432 KB Output is correct
2 Correct 0 ms 3432 KB Output is correct
3 Correct 0 ms 3432 KB Output is correct
4 Correct 0 ms 3432 KB Output is correct
5 Correct 0 ms 3432 KB Output is correct
6 Correct 0 ms 3432 KB Output is correct
7 Correct 0 ms 3432 KB Output is correct
8 Correct 0 ms 3432 KB Output is correct
9 Correct 0 ms 3432 KB Output is correct
10 Correct 0 ms 3432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3432 KB Output is correct
2 Correct 0 ms 3432 KB Output is correct
3 Correct 0 ms 3432 KB Output is correct
4 Correct 0 ms 3432 KB Output is correct
5 Correct 0 ms 3432 KB Output is correct
6 Correct 0 ms 3432 KB Output is correct
7 Correct 0 ms 3432 KB Output is correct
8 Correct 0 ms 3432 KB Output is correct
9 Correct 0 ms 3432 KB Output is correct
10 Correct 0 ms 3432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 3432 KB Output is correct
2 Correct 4 ms 3432 KB Output is correct
3 Correct 4 ms 3432 KB Output is correct
4 Correct 16 ms 3432 KB Output is correct
5 Correct 0 ms 3432 KB Output is correct
6 Correct 12 ms 3432 KB Output is correct
7 Correct 4 ms 3432 KB Output is correct
8 Correct 24 ms 3432 KB Output is correct
9 Correct 8 ms 3432 KB Output is correct
10 Correct 20 ms 3432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 3432 KB Output is correct
2 Correct 0 ms 3432 KB Output is correct
3 Correct 20 ms 3432 KB Output is correct
4 Correct 4 ms 3432 KB Output is correct
5 Correct 16 ms 3432 KB Output is correct
6 Correct 0 ms 3432 KB Output is correct
7 Correct 16 ms 3432 KB Output is correct
8 Correct 20 ms 3432 KB Output is correct
9 Correct 20 ms 3432 KB Output is correct
10 Correct 20 ms 3432 KB Output is correct