제출 #943215

#제출 시각아이디문제언어결과실행 시간메모리
943215shoryu386Road Construction (JOI21_road_construction)C++17
5 / 100
4517 ms2097152 KiB
#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'; }

컴파일 시 표준 에러 (stderr) 메시지

road_construction.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
road_construction.cpp: In function 'int main()':
road_construction.cpp:31:6: warning: unused variable 'ans' [-Wunused-variable]
   31 |  int ans = 0;
      |      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...