Submission #876010

#TimeUsernameProblemLanguageResultExecution timeMemory
876010RegulusRoad Construction (JOI21_road_construction)C++17
5 / 100
53 ms7096 KiB
#include <bits/stdc++.h>            // pA
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define debug(x) cerr << #x << " = " << (x) << ' '
#define endl cerr << '\n'
#define all(v) (v).begin(), (v).end()
#define lowbit(x) (x)&-(x)
#define pb emplace_back
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

const int N = 2e5+5;
//sconst int INF = 2e9;
pll p[N];
vector<ll> v;

int main(void)
{ IO
    ll n, i, Q, j;

    cin >> n >> Q;
    if (n > 1000) assert(0);
    for (i=1; i <= n; ++i) cin >> p[i].F >> p[i].S;

    for (i=1; i <= n; ++i)
    {
        for (j=1; j < i; ++j) v.pb(abs(p[i].F-p[j].F)+abs(p[i].S-p[j].S));
    }
    
    sort(all(v));
    for (i=0; i < Q; ++i) cout << v[i] << '\n';



    return 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...