# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
7900 |
2014-08-24T02:55:26 Z |
gs14004 |
지우개 (GA4_eraser) |
C++ |
|
28 ms |
2648 KB |
#include <cstdio>
#include <cstdlib>
int n;
long long a[100005];
long long sum[100005];
long long mod = 1e9+7;
int main(){
int t;
scanf("%d",&n);
for (int i=0; i<n; i++) {
scanf("%d",&t);
a[t]++;
}
for (int i=1; i<=100000; i++) {
a[i] *= i;
a[i] %= mod;
}
for (int i=1; i<=100000; i++) {
sum[i] = a[i] + sum[i-1];
sum[i] %= mod;
}
for (int i=1; i<=100000; i++) {
sum[i] = a[i] * (sum[100000] - sum[i]);
sum[i] %= mod;
}
for (int i=1; i<=100000; i++) {
sum[i] += sum[i-1];
sum[i] %= mod;
}
long long res = 0;
for (int i=1; i<=100000; i++) {
res += a[i] * (sum[100000] - sum[i]);
res %= mod;
}
if(res < 0) res += mod;
printf("%lld",res);
// iCnti
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2648 KB |
Output is correct |
2 |
Correct |
8 ms |
2648 KB |
Output is correct |
3 |
Correct |
8 ms |
2648 KB |
Output is correct |
4 |
Correct |
4 ms |
2648 KB |
Output is correct |
5 |
Correct |
8 ms |
2648 KB |
Output is correct |
6 |
Correct |
8 ms |
2648 KB |
Output is correct |
7 |
Correct |
8 ms |
2648 KB |
Output is correct |
8 |
Correct |
8 ms |
2648 KB |
Output is correct |
9 |
Correct |
8 ms |
2648 KB |
Output is correct |
10 |
Correct |
8 ms |
2648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2648 KB |
Output is correct |
2 |
Correct |
8 ms |
2648 KB |
Output is correct |
3 |
Correct |
0 ms |
2648 KB |
Output is correct |
4 |
Correct |
8 ms |
2648 KB |
Output is correct |
5 |
Correct |
4 ms |
2648 KB |
Output is correct |
6 |
Correct |
8 ms |
2648 KB |
Output is correct |
7 |
Correct |
8 ms |
2648 KB |
Output is correct |
8 |
Correct |
8 ms |
2648 KB |
Output is correct |
9 |
Correct |
8 ms |
2648 KB |
Output is correct |
10 |
Correct |
8 ms |
2648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2648 KB |
Output is correct |
2 |
Correct |
0 ms |
2648 KB |
Output is correct |
3 |
Correct |
4 ms |
2648 KB |
Output is correct |
4 |
Correct |
8 ms |
2648 KB |
Output is correct |
5 |
Correct |
8 ms |
2648 KB |
Output is correct |
6 |
Correct |
8 ms |
2648 KB |
Output is correct |
7 |
Correct |
4 ms |
2648 KB |
Output is correct |
8 |
Correct |
8 ms |
2648 KB |
Output is correct |
9 |
Correct |
8 ms |
2648 KB |
Output is correct |
10 |
Correct |
4 ms |
2648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2648 KB |
Output is correct |
2 |
Correct |
8 ms |
2648 KB |
Output is correct |
3 |
Correct |
4 ms |
2648 KB |
Output is correct |
4 |
Correct |
8 ms |
2648 KB |
Output is correct |
5 |
Correct |
8 ms |
2648 KB |
Output is correct |
6 |
Correct |
4 ms |
2648 KB |
Output is correct |
7 |
Correct |
8 ms |
2648 KB |
Output is correct |
8 |
Correct |
4 ms |
2648 KB |
Output is correct |
9 |
Correct |
8 ms |
2648 KB |
Output is correct |
10 |
Correct |
8 ms |
2648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
2648 KB |
Output is correct |
2 |
Correct |
12 ms |
2648 KB |
Output is correct |
3 |
Correct |
12 ms |
2648 KB |
Output is correct |
4 |
Correct |
16 ms |
2648 KB |
Output is correct |
5 |
Correct |
8 ms |
2648 KB |
Output is correct |
6 |
Correct |
16 ms |
2648 KB |
Output is correct |
7 |
Correct |
12 ms |
2648 KB |
Output is correct |
8 |
Correct |
20 ms |
2648 KB |
Output is correct |
9 |
Correct |
12 ms |
2648 KB |
Output is correct |
10 |
Correct |
20 ms |
2648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
2648 KB |
Output is correct |
2 |
Correct |
8 ms |
2648 KB |
Output is correct |
3 |
Correct |
20 ms |
2648 KB |
Output is correct |
4 |
Correct |
8 ms |
2648 KB |
Output is correct |
5 |
Correct |
24 ms |
2648 KB |
Output is correct |
6 |
Correct |
12 ms |
2648 KB |
Output is correct |
7 |
Correct |
16 ms |
2648 KB |
Output is correct |
8 |
Correct |
12 ms |
2648 KB |
Output is correct |
9 |
Correct |
28 ms |
2648 KB |
Output is correct |
10 |
Correct |
16 ms |
2648 KB |
Output is correct |