답안 #7899

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
7899 2014-08-24T02:55:02 Z gs14004 지우개 (GA4_eraser) C++
46 / 100
20 ms 2648 KB
#include <cstdio>
#include <cstdlib>
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<=1000; i++) {
        res += a[i] * (sum[100000] - sum[i]);
        res %= mod;
    }
    if(res < 0) res += mod;
    printf("%lld",res);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2648 KB Output is correct
2 Correct 8 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 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 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 8 ms 2648 KB Output is correct
4 Correct 4 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 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 8 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 4 ms 2648 KB Output is correct
4 Correct 4 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 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 Incorrect 12 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -