# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
13858 |
2015-04-08T07:38:14 Z |
gs14004 |
사회적 불평등 (TOKI14_social) |
C++14 |
|
300 ms |
1944 KB |
#include <cstdio>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> pi;
const int MAX = 10000;
int n;
pi a[100005];
int elem[10005], t[10005];
long long solve(){
long long ret = 0;
for (int i=0; i<n; i++) {
for (int j=i+1; j<n; j++) {
if(a[i].second < a[j].second){
ret += (a[j].second - a[i].second) * (a[j].first - a[i].first);
}
}
}
return ret;
}
int main(){
scanf("%d",&n);
for (int i=0; i<n; i++) {
scanf("%d %d",&a[i].first,&a[i].second);
}
sort(a,a+n);
long long ret = solve();
for (int i=0; i<n; i++) {
a[i].second = MAX + 1 - a[i].second;
}
ret += solve();
printf("%lld",ret);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1944 KB |
Output is correct |
2 |
Correct |
0 ms |
1944 KB |
Output is correct |
3 |
Correct |
0 ms |
1944 KB |
Output is correct |
4 |
Correct |
0 ms |
1944 KB |
Output is correct |
5 |
Correct |
0 ms |
1944 KB |
Output is correct |
6 |
Correct |
0 ms |
1944 KB |
Output is correct |
7 |
Correct |
0 ms |
1944 KB |
Output is correct |
8 |
Correct |
5 ms |
1944 KB |
Output is correct |
9 |
Correct |
17 ms |
1944 KB |
Output is correct |
10 |
Correct |
54 ms |
1944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
300 ms |
1940 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
300 ms |
1940 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
300 ms |
1940 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |