답안 #5921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
5921 2014-05-23T10:20:19 Z baneling100 지우개 (GA4_eraser) C++
22 / 100
16 ms 3432 KB
#include <stdio.h>
#define MOD 1000000007

long long N, A[100001], M, B[100001], C[100001], Ans;

void input(void)
{
    int i;
    long long temp;

    scanf("%lld",&N);
    for(i=1 ; i<=N ; i++)
    {
        scanf("%lld",&temp);
        C[i]=temp;
        B[temp]=1;
        A[temp]+=temp;
        if(M<temp)
            M=temp;
    }
    for(i=M-1 ; i>=1 ; i--)
        A[i]+=A[i+1];
    for(i=1 ; i<=M ; i++)
        if(B[i])
            B[i]=i*A[i+1];
    for(i=M-1 ; i>=1 ; i--)
    {
        B[i]+=B[i+1];
        B[i]%=MOD;
    }
}

void process(void)
{
    int i;

    for(i=1 ; i<=N ; i++)
    {
        Ans+=C[i]*B[C[i]+1];
        Ans%=MOD;
    }
}

void output(void)
{
    printf("%lld",Ans);
}

int main(void)
{
    input();
    process();
    output();

    return 0;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 3432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 3432 KB Output isn't correct
2 Halted 0 ms 0 KB -