# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
2419 |
2013-07-21T09:31:49 Z |
hana5505 |
지우개 (GA4_eraser) |
C++ |
|
23 ms |
4012 KB |
#include<stdio.h>
int mod=1000000007;
long long ar[100001];
long long aa[100001];
long long sum1[100001];
long long sum2[100001];
int main()
{
long long s=0;
int n,i,size=0;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%lld",&ar[i]);
aa[(int)ar[i]]++;
}
for(i=1;i<=100000;i++){
if(aa[i])
ar[++size]=i;
}
for(i=1;i<=size;i++){
sum1[i]=(sum1[i-1]+(ar[i]*aa[ar[i]])%mod)%mod;
sum2[i]=(sum2[i-1]+(( (ar[i]*aa[ar[i]])%mod )* (ar[i]*aa[ar[i]])%mod)%mod)%mod;
}
for(i=1;i<=size-2;i++){
s+=((aa[(int)ar[i]]*ar[i])%mod*(((((sum1[size]-sum1[i]+1000000007)%mod)*((sum1[size]-sum1[i]+1000000007)%mod)-(sum2[size]-sum2[i]+1000000007)%mod)/2)%mod))%mod;
s=s%mod;
}
printf("%lld",s);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4012 KB |
Output is correct |
2 |
Correct |
0 ms |
4012 KB |
Output is correct |
3 |
Correct |
0 ms |
4012 KB |
Output is correct |
4 |
Correct |
0 ms |
4012 KB |
Output is correct |
5 |
Correct |
0 ms |
4012 KB |
Output is correct |
6 |
Correct |
0 ms |
4012 KB |
Output is correct |
7 |
Correct |
0 ms |
4012 KB |
Output is correct |
8 |
Correct |
0 ms |
4012 KB |
Output is correct |
9 |
Correct |
0 ms |
4012 KB |
Output is correct |
10 |
Correct |
0 ms |
4012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4012 KB |
Output is correct |
2 |
Correct |
0 ms |
4012 KB |
Output is correct |
3 |
Correct |
0 ms |
4012 KB |
Output is correct |
4 |
Correct |
0 ms |
4012 KB |
Output is correct |
5 |
Correct |
0 ms |
4012 KB |
Output is correct |
6 |
Correct |
0 ms |
4012 KB |
Output is correct |
7 |
Correct |
0 ms |
4012 KB |
Output is correct |
8 |
Correct |
0 ms |
4012 KB |
Output is correct |
9 |
Correct |
0 ms |
4012 KB |
Output is correct |
10 |
Correct |
0 ms |
4012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4012 KB |
Output is correct |
2 |
Correct |
0 ms |
4012 KB |
Output is correct |
3 |
Correct |
0 ms |
4012 KB |
Output is correct |
4 |
Correct |
0 ms |
4012 KB |
Output is correct |
5 |
Correct |
0 ms |
4012 KB |
Output is correct |
6 |
Correct |
0 ms |
4012 KB |
Output is correct |
7 |
Correct |
0 ms |
4012 KB |
Output is correct |
8 |
Correct |
0 ms |
4012 KB |
Output is correct |
9 |
Correct |
0 ms |
4012 KB |
Output is correct |
10 |
Correct |
0 ms |
4012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4012 KB |
Output is correct |
2 |
Correct |
0 ms |
4012 KB |
Output is correct |
3 |
Correct |
0 ms |
4012 KB |
Output is correct |
4 |
Correct |
0 ms |
4012 KB |
Output is correct |
5 |
Correct |
0 ms |
4012 KB |
Output is correct |
6 |
Correct |
0 ms |
4012 KB |
Output is correct |
7 |
Correct |
0 ms |
4012 KB |
Output is correct |
8 |
Correct |
0 ms |
4012 KB |
Output is correct |
9 |
Correct |
0 ms |
4012 KB |
Output is correct |
10 |
Correct |
0 ms |
4012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
4012 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
4012 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |