mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
parent
04ca89fcc7
commit
d74aba08ef
27
S2OJ/784/784.cpp
Normal file
27
S2OJ/784/784.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma GCC optimize("Ofast")
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int n, m, z, x[100005], y[100005];
|
||||
long long ans, mx, my, az;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin >> n >> m >> z;
|
||||
for (int i = 1; i <= m; i++) {
|
||||
cin >> x[i] >> y[i] >> z;
|
||||
az += z;
|
||||
}
|
||||
sort(x + 1, x + 1 + m);
|
||||
sort(y + 1, y + 1 + m);
|
||||
mx = x[m + 1 >> 1];
|
||||
my = y[m + 1 >> 1];
|
||||
for (int i = 1; i <= m; i++) {
|
||||
ans += abs(x[i] - mx) + abs(y[i] - my);
|
||||
}
|
||||
cout << ans + az << endl;
|
||||
cout << mx << ' ' << my << endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user