Submission #2435

# Submission time Handle Problem Language Result Execution time Memory
2435 2013-07-21T13:04:03 Z rkdrjs0327 지우개 (GA4_eraser) C++
0 / 100
18 ms 4792 KB
#include<stdio.h>
#include<algorithm>

int n,c;
long long dtemp[100001],s[100001],temp[100001];

struct data
{
    long long  sum,val;
}; data d[100001];

void input()
{
    int i;
    scanf("%d",&n);
    for(i=1; i<=n; i++) scanf("%lld",&dtemp[i]);
}

void process()
{
    int i;
    std::sort(dtemp+1,dtemp+n+1);
    for(i=1; i<=n; i++){
        if(dtemp[i]==d[c].val) d[c].sum+=dtemp[i];
        else{
            d[++c].val=dtemp[i];
            d[c].sum=dtemp[i];
        }
    }
    for(i=1; i<=c; i++) s[i]=s[i-1]+d[i].sum;
    
    for(i=1; i<=c; i++) temp[i]=d[i].sum*s[i-1];
    for(i=1; i<=c; i++) s[i]=s[i-1]+temp[i];
    
    for(i=1; i<=c; i++) temp[i]=d[i].sum*s[i-1];
    for(i=1; i<=c; i++) s[i]=s[i-1]+temp[i];
    
    printf("%lld\n",s[c]);
}

int main()
{
    input();
    process();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 4792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 4792 KB Output isn't correct
2 Halted 0 ms 0 KB -