# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
943215 | shoryu386 | Road Construction (JOI21_road_construction) | C++17 | 4517 ms | 2097152 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
main(){
int n, k; cin >> n >> k;
pair<int, int> arr[n];
for (int x = 0; x < n; x++){
cin >> arr[x].first >> arr[x].second;
}
//consider manhattan distance trick?
for (int x = 0; x < n; x++){
arr[x] = {arr[x].first + arr[x].second, arr[x].first - arr[x].second};
}
//now chebyshev distance, dist = max of difference
//I want to bsearch, but bsearch only gives location of boundary; I need sum of boundary
//subtask first ig
vector<int> clown;
for (int x = 0; x < n; x++){
for (int y = x+1; y < n; y++){
clown.push_back(max( abs(arr[x].first - arr[y].first), abs(arr[x].second - arr[y].second) ));
}
}
int ans = 0;
sort(clown.begin(), clown.end());
for (int x = 0; x < k; x++) cout << clown[x] << '\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |