# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
3150 |
2013-08-26T08:41:42 Z |
movie_jo |
점 모으기 (KOI13_collect) |
C++ |
|
40 ms |
1868 KB |
#include <stdio.h>
#include "algorithm"
using namespace std;
int x[100000], y[100000];
int main(void)
{
int N, M, i, cx, cy, s = 0;
scanf("%d %d", &N, &M);
for(i = 0; i < M; i++)
scanf("%d %d",&x[i], &y[i]);
sort(x, x+M);
sort(y, y+M);
cx = x[M / 2];
cy = y[M / 2];
for(i = 0; i < M; i++)
{
s += cx > x[i] ? cx - x[i] : x[i] - cx;
s += cy > y[i] ? cy - y[i] : y[i] - cy;
}
printf("%d\n", s);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1868 KB |
Output is correct |
2 |
Correct |
0 ms |
1868 KB |
Output is correct |
3 |
Correct |
0 ms |
1868 KB |
Output is correct |
4 |
Correct |
0 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1868 KB |
Output is correct |
2 |
Correct |
0 ms |
1868 KB |
Output is correct |
3 |
Correct |
0 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1868 KB |
Output is correct |
2 |
Correct |
8 ms |
1868 KB |
Output is correct |
3 |
Correct |
0 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
1868 KB |
Output is correct |
2 |
Correct |
12 ms |
1868 KB |
Output is correct |
3 |
Correct |
12 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
1868 KB |
Output is correct |
2 |
Correct |
20 ms |
1868 KB |
Output is correct |
3 |
Correct |
20 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1868 KB |
Output is correct |
2 |
Correct |
36 ms |
1868 KB |
Output is correct |
3 |
Correct |
20 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1868 KB |
Output is correct |
2 |
Correct |
32 ms |
1868 KB |
Output is correct |
3 |
Correct |
36 ms |
1868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
1868 KB |
Output is correct |
2 |
Correct |
32 ms |
1868 KB |
Output is correct |
3 |
Correct |
40 ms |
1868 KB |
Output is correct |