답안 #5633

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
5633 2014-05-09T04:13:03 Z gs13073 지우개 (GA4_eraser) C++
100 / 100
20 ms 4996 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
int a[100100],b[100100];
long long dp[4][100100];	//dp[i][j] : (1~j)까지, i개씩 곱들의 합
int main()
{
	int N,i;
	//freopen("input.txt","r",stdin);
	scanf("%d",&N);
	for(i=1;i<=N;i++)scanf("%d",&a[i]);
	sort(a+1,a+N+1);
	int j=0;
	for(i=1;i<=N;i++){
		if(a[i]!=a[i-1])j++;
		b[j]+=a[i];
	}
	int J=j;
	//for(i=1;i<=J;i++)printf("%d ",b[i]);
	//puts("");
	for(j=1;j<=J;j++)dp[1][j]=dp[1][j-1]+b[j];
	for(i=2;i<=3;i++){
		for(j=1;j<=J;j++){
			if(j<i)continue;
			int tmp=(dp[i-1][j-1]*b[j])%1000000007;
			dp[i][j]=dp[i][j-1]+tmp;
			dp[i][j]%=1000000007;
		}
	}
	/*for(i=1;i<=3;i++){
		for(j=1;j<=J;j++)printf("%d ",dp[i][j]);
		puts("");
	}*/
	printf("%lld",dp[3][J]);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4996 KB Output is correct
2 Correct 0 ms 4996 KB Output is correct
3 Correct 0 ms 4996 KB Output is correct
4 Correct 0 ms 4996 KB Output is correct
5 Correct 0 ms 4996 KB Output is correct
6 Correct 0 ms 4996 KB Output is correct
7 Correct 0 ms 4996 KB Output is correct
8 Correct 0 ms 4996 KB Output is correct
9 Correct 0 ms 4996 KB Output is correct
10 Correct 0 ms 4996 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4996 KB Output is correct
2 Correct 0 ms 4996 KB Output is correct
3 Correct 0 ms 4996 KB Output is correct
4 Correct 0 ms 4996 KB Output is correct
5 Correct 0 ms 4996 KB Output is correct
6 Correct 0 ms 4996 KB Output is correct
7 Correct 0 ms 4996 KB Output is correct
8 Correct 0 ms 4996 KB Output is correct
9 Correct 0 ms 4996 KB Output is correct
10 Correct 0 ms 4996 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4996 KB Output is correct
2 Correct 0 ms 4996 KB Output is correct
3 Correct 0 ms 4996 KB Output is correct
4 Correct 0 ms 4996 KB Output is correct
5 Correct 0 ms 4996 KB Output is correct
6 Correct 0 ms 4996 KB Output is correct
7 Correct 0 ms 4996 KB Output is correct
8 Correct 0 ms 4996 KB Output is correct
9 Correct 0 ms 4996 KB Output is correct
10 Correct 0 ms 4996 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4996 KB Output is correct
2 Correct 0 ms 4996 KB Output is correct
3 Correct 0 ms 4996 KB Output is correct
4 Correct 0 ms 4996 KB Output is correct
5 Correct 0 ms 4996 KB Output is correct
6 Correct 0 ms 4996 KB Output is correct
7 Correct 0 ms 4996 KB Output is correct
8 Correct 0 ms 4996 KB Output is correct
9 Correct 0 ms 4996 KB Output is correct
10 Correct 0 ms 4996 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 4996 KB Output is correct
2 Correct 0 ms 4996 KB Output is correct
3 Correct 4 ms 4996 KB Output is correct
4 Correct 8 ms 4996 KB Output is correct
5 Correct 0 ms 4996 KB Output is correct
6 Correct 8 ms 4996 KB Output is correct
7 Correct 4 ms 4996 KB Output is correct
8 Correct 20 ms 4996 KB Output is correct
9 Correct 12 ms 4996 KB Output is correct
10 Correct 16 ms 4996 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 4996 KB Output is correct
2 Correct 0 ms 4996 KB Output is correct
3 Correct 20 ms 4996 KB Output is correct
4 Correct 4 ms 4996 KB Output is correct
5 Correct 16 ms 4996 KB Output is correct
6 Correct 4 ms 4996 KB Output is correct
7 Correct 12 ms 4996 KB Output is correct
8 Correct 12 ms 4996 KB Output is correct
9 Correct 20 ms 4996 KB Output is correct
10 Correct 16 ms 4996 KB Output is correct