Submission #9453

# Submission time Handle Problem Language Result Execution time Memory
9453 2014-09-28T06:33:33 Z yukariko Uniting (kriii2_U) C
0 / 4
0 ms 1352 KB
#include <stdio.h>
//#include <windows.h>
#include <stdlib.h>

int compare(const void *a , const void *b);

int main()
{
	int N;
	int s[100001];
	long long cnt;
	long long sum;
	int i;
	
	cnt = 1;
	sum = 0;
	
	scanf("%d",&N);
	
	for(i=0;i<N;i++) scanf("%d",s+i);
	
	
	
	for(i=N;i>=2;i--)
	{
		cnt *= i*(i-1);
	}
	
	for(i=0;i<N-1;i++)
	{
		sum += s[i]*s[N-1];
		s[N-1] += s[i];
		qsort(s , N , sizeof(s[0]) , compare);
	}
	
	cnt = cnt%1000000007;
	printf("%lld\n",sum);
	printf("%lld\n",cnt);
	//system("pause");
	return 0;
}


int compare(const void *a , const void *b){

        return strcmp( (char*)a , (char*)b );

}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1352 KB Output isn't correct
2 Halted 0 ms 0 KB -