답안 #7901

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
7901 2014-08-24T02:56:20 Z gs14004 지우개 (GA4_eraser) C++
100 / 100
24 ms 2648 KB
#include <cstdio>

int n;
long long a[100005];
long long sum[100005];
long long mod = 1e9+7;

int main(){
    int t;
    scanf("%d",&n);
    for (int i=0; i<n; i++) {
        scanf("%d",&t);
        a[t]++;
    }
    for (int i=1; i<=100000; i++) {
        a[i] *= i;
        a[i] %= mod;
    }
    for (int i=1; i<=100000; i++) {
        sum[i] = a[i] + sum[i-1];
        sum[i] %= mod;
    }
    for (int i=1; i<=100000; i++) {
        sum[i] = a[i] * (sum[100000] - sum[i]);
        sum[i] %= mod;
    }
    for (int i=1; i<=100000; i++) {
        sum[i] += sum[i-1];
        sum[i] %= mod;
    }
    long long res = 0;
    for (int i=1; i<=100000; i++) {
        res += a[i] * (sum[100000] - sum[i]);
        res %= mod;
    }
    if(res < 0) res += mod;
    printf("%lld",res);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2648 KB Output is correct
2 Correct 4 ms 2648 KB Output is correct
3 Correct 8 ms 2648 KB Output is correct
4 Correct 8 ms 2648 KB Output is correct
5 Correct 4 ms 2648 KB Output is correct
6 Correct 8 ms 2648 KB Output is correct
7 Correct 4 ms 2648 KB Output is correct
8 Correct 8 ms 2648 KB Output is correct
9 Correct 4 ms 2648 KB Output is correct
10 Correct 8 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 2648 KB Output is correct
2 Correct 8 ms 2648 KB Output is correct
3 Correct 4 ms 2648 KB Output is correct
4 Correct 4 ms 2648 KB Output is correct
5 Correct 4 ms 2648 KB Output is correct
6 Correct 8 ms 2648 KB Output is correct
7 Correct 8 ms 2648 KB Output is correct
8 Correct 4 ms 2648 KB Output is correct
9 Correct 8 ms 2648 KB Output is correct
10 Correct 8 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2648 KB Output is correct
2 Correct 4 ms 2648 KB Output is correct
3 Correct 4 ms 2648 KB Output is correct
4 Correct 8 ms 2648 KB Output is correct
5 Correct 8 ms 2648 KB Output is correct
6 Correct 8 ms 2648 KB Output is correct
7 Correct 8 ms 2648 KB Output is correct
8 Correct 8 ms 2648 KB Output is correct
9 Correct 8 ms 2648 KB Output is correct
10 Correct 4 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 2648 KB Output is correct
2 Correct 8 ms 2648 KB Output is correct
3 Correct 0 ms 2648 KB Output is correct
4 Correct 0 ms 2648 KB Output is correct
5 Correct 4 ms 2648 KB Output is correct
6 Correct 8 ms 2648 KB Output is correct
7 Correct 8 ms 2648 KB Output is correct
8 Correct 8 ms 2648 KB Output is correct
9 Correct 8 ms 2648 KB Output is correct
10 Correct 8 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 2648 KB Output is correct
2 Correct 8 ms 2648 KB Output is correct
3 Correct 12 ms 2648 KB Output is correct
4 Correct 20 ms 2648 KB Output is correct
5 Correct 8 ms 2648 KB Output is correct
6 Correct 20 ms 2648 KB Output is correct
7 Correct 8 ms 2648 KB Output is correct
8 Correct 24 ms 2648 KB Output is correct
9 Correct 20 ms 2648 KB Output is correct
10 Correct 24 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 2648 KB Output is correct
2 Correct 8 ms 2648 KB Output is correct
3 Correct 16 ms 2648 KB Output is correct
4 Correct 12 ms 2648 KB Output is correct
5 Correct 20 ms 2648 KB Output is correct
6 Correct 12 ms 2648 KB Output is correct
7 Correct 20 ms 2648 KB Output is correct
8 Correct 16 ms 2648 KB Output is correct
9 Correct 16 ms 2648 KB Output is correct
10 Correct 12 ms 2648 KB Output is correct