Submission #1637

# Submission time Handle Problem Language Result Execution time Memory
1637 2013-07-11T11:29:16 Z ainta 지우개 (GA4_eraser) C++
100 / 100
25 ms 1276 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
int w[100001],n,i;
long long c,s,g,res,Mod=1000000007;
int main()
{
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&w[i]);
	sort(w,w+n);
	for(i=n-1;i>=0;i--){
		if(i!=n-1 && w[i]!=w[i+1])
		{
			g=(g+s*c*w[i+1])%Mod;
			s=(s+c*w[i+1])%Mod;
			c=0;
		}
		c++;
		res=(res+g*w[i])%Mod;
	}
	printf("%lld\n",res);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1276 KB Output is correct
2 Correct 0 ms 1276 KB Output is correct
3 Correct 0 ms 1276 KB Output is correct
4 Correct 0 ms 1276 KB Output is correct
5 Correct 0 ms 1276 KB Output is correct
6 Correct 0 ms 1276 KB Output is correct
7 Correct 0 ms 1276 KB Output is correct
8 Correct 0 ms 1276 KB Output is correct
9 Correct 0 ms 1276 KB Output is correct
10 Correct 0 ms 1276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1276 KB Output is correct
2 Correct 0 ms 1276 KB Output is correct
3 Correct 0 ms 1276 KB Output is correct
4 Correct 0 ms 1276 KB Output is correct
5 Correct 0 ms 1276 KB Output is correct
6 Correct 0 ms 1276 KB Output is correct
7 Correct 0 ms 1276 KB Output is correct
8 Correct 0 ms 1276 KB Output is correct
9 Correct 0 ms 1276 KB Output is correct
10 Correct 0 ms 1276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1276 KB Output is correct
2 Correct 0 ms 1276 KB Output is correct
3 Correct 0 ms 1276 KB Output is correct
4 Correct 0 ms 1276 KB Output is correct
5 Correct 0 ms 1276 KB Output is correct
6 Correct 0 ms 1276 KB Output is correct
7 Correct 0 ms 1276 KB Output is correct
8 Correct 0 ms 1276 KB Output is correct
9 Correct 0 ms 1276 KB Output is correct
10 Correct 0 ms 1276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1276 KB Output is correct
2 Correct 0 ms 1276 KB Output is correct
3 Correct 0 ms 1276 KB Output is correct
4 Correct 0 ms 1276 KB Output is correct
5 Correct 0 ms 1276 KB Output is correct
6 Correct 0 ms 1276 KB Output is correct
7 Correct 0 ms 1276 KB Output is correct
8 Correct 0 ms 1276 KB Output is correct
9 Correct 0 ms 1276 KB Output is correct
10 Correct 0 ms 1276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1276 KB Output is correct
2 Correct 3 ms 1276 KB Output is correct
3 Correct 4 ms 1276 KB Output is correct
4 Correct 19 ms 1276 KB Output is correct
5 Correct 0 ms 1276 KB Output is correct
6 Correct 14 ms 1276 KB Output is correct
7 Correct 6 ms 1276 KB Output is correct
8 Correct 25 ms 1276 KB Output is correct
9 Correct 15 ms 1276 KB Output is correct
10 Correct 21 ms 1276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1276 KB Output is correct
2 Correct 1 ms 1276 KB Output is correct
3 Correct 22 ms 1276 KB Output is correct
4 Correct 4 ms 1276 KB Output is correct
5 Correct 23 ms 1276 KB Output is correct
6 Correct 4 ms 1276 KB Output is correct
7 Correct 16 ms 1276 KB Output is correct
8 Correct 17 ms 1276 KB Output is correct
9 Correct 25 ms 1276 KB Output is correct
10 Correct 16 ms 1276 KB Output is correct