Submission #5632

# Submission time Handle Problem Language Result Execution time Memory
5632 2014-05-09T04:11:36 Z gs13073 지우개 (GA4_eraser) C++
0 / 100
52 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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4996 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4996 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4996 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4996 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 4996 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 4996 KB Output isn't correct
2 Halted 0 ms 0 KB -