#include <bits/stdc++.h>
using namespace std;
int median(vector<int> x)
{
if (x.size() % 2 == 0)
return (x.at((x.size() / 2) - 1) + x.at(x.size() / 2)) / 2;
else
return x.at((x.size() - 1) / 2);
}
int main()
{
int n{};
cin >> n;
vector<int> x, y;
int xi{}, yi{};
for (int i = 0; i < n; i++)
{
cin >> xi >> yi;
x.push_back(xi);
y.push_back(yi);
}
sort(x.begin(), x.end());
sort(y.begin(), y.end());
cout << median(x) << " " << median(y) << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
292 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
62 ms |
3076 KB |
Output is correct |
2 |
Correct |
70 ms |
3208 KB |
Output is correct |
3 |
Correct |
63 ms |
3144 KB |
Output is correct |
4 |
Correct |
59 ms |
3160 KB |
Output is correct |
5 |
Correct |
65 ms |
3132 KB |
Output is correct |
6 |
Correct |
75 ms |
3128 KB |
Output is correct |
7 |
Correct |
66 ms |
3104 KB |
Output is correct |
8 |
Correct |
62 ms |
3168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
292 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
102 ms |
3992 KB |
Output is correct |
2 |
Correct |
101 ms |
3988 KB |
Output is correct |
3 |
Correct |
83 ms |
4016 KB |
Output is correct |
4 |
Correct |
66 ms |
3268 KB |
Output is correct |
5 |
Correct |
122 ms |
3972 KB |
Output is correct |
6 |
Correct |
109 ms |
4084 KB |
Output is correct |
7 |
Correct |
88 ms |
3892 KB |
Output is correct |
8 |
Correct |
92 ms |
3900 KB |
Output is correct |