Submission #2436

# Submission time Handle Problem Language Result Execution time Memory
2436 2013-07-21T13:08:45 Z rkdrjs0327 지우개 (GA4_eraser) C++
100 / 100
23 ms 4792 KB
#include<stdio.h>
#include<algorithm>
#define T 1000000007

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];
        }
        d[c].sum%=T;
    }
    for(i=1; i<=c; i++) s[i]=(s[i-1]+d[i].sum)%T;
    
    for(i=1; i<=c; i++) temp[i]=(d[i].sum*s[i-1])%T;
    for(i=1; i<=c; i++) s[i]=(s[i-1]+temp[i])%T;
    
    for(i=1; i<=c; i++) temp[i]=(d[i].sum*s[i-1])%T;
    for(i=1; i<=c; i++) s[i]=(s[i-1]+temp[i])%T;
    
    printf("%lld\n",s[c]);
}

int main()
{
    input();
    process();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4792 KB Output is correct
2 Correct 0 ms 4792 KB Output is correct
3 Correct 0 ms 4792 KB Output is correct
4 Correct 0 ms 4792 KB Output is correct
5 Correct 0 ms 4792 KB Output is correct
6 Correct 0 ms 4792 KB Output is correct
7 Correct 0 ms 4792 KB Output is correct
8 Correct 0 ms 4792 KB Output is correct
9 Correct 0 ms 4792 KB Output is correct
10 Correct 0 ms 4792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4792 KB Output is correct
2 Correct 0 ms 4792 KB Output is correct
3 Correct 0 ms 4792 KB Output is correct
4 Correct 0 ms 4792 KB Output is correct
5 Correct 0 ms 4792 KB Output is correct
6 Correct 0 ms 4792 KB Output is correct
7 Correct 0 ms 4792 KB Output is correct
8 Correct 0 ms 4792 KB Output is correct
9 Correct 0 ms 4792 KB Output is correct
10 Correct 0 ms 4792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4792 KB Output is correct
2 Correct 0 ms 4792 KB Output is correct
3 Correct 0 ms 4792 KB Output is correct
4 Correct 0 ms 4792 KB Output is correct
5 Correct 0 ms 4792 KB Output is correct
6 Correct 0 ms 4792 KB Output is correct
7 Correct 0 ms 4792 KB Output is correct
8 Correct 0 ms 4792 KB Output is correct
9 Correct 0 ms 4792 KB Output is correct
10 Correct 0 ms 4792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4792 KB Output is correct
2 Correct 0 ms 4792 KB Output is correct
3 Correct 0 ms 4792 KB Output is correct
4 Correct 0 ms 4792 KB Output is correct
5 Correct 0 ms 4792 KB Output is correct
6 Correct 0 ms 4792 KB Output is correct
7 Correct 0 ms 4792 KB Output is correct
8 Correct 0 ms 4792 KB Output is correct
9 Correct 0 ms 4792 KB Output is correct
10 Correct 0 ms 4792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 4792 KB Output is correct
2 Correct 3 ms 4792 KB Output is correct
3 Correct 3 ms 4792 KB Output is correct
4 Correct 15 ms 4792 KB Output is correct
5 Correct 0 ms 4792 KB Output is correct
6 Correct 14 ms 4792 KB Output is correct
7 Correct 6 ms 4792 KB Output is correct
8 Correct 23 ms 4792 KB Output is correct
9 Correct 14 ms 4792 KB Output is correct
10 Correct 20 ms 4792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 4792 KB Output is correct
2 Correct 2 ms 4792 KB Output is correct
3 Correct 20 ms 4792 KB Output is correct
4 Correct 3 ms 4792 KB Output is correct
5 Correct 19 ms 4792 KB Output is correct
6 Correct 3 ms 4792 KB Output is correct
7 Correct 18 ms 4792 KB Output is correct
8 Correct 20 ms 4792 KB Output is correct
9 Correct 21 ms 4792 KB Output is correct
10 Correct 16 ms 4792 KB Output is correct