#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
#define int long long
#define ll long long
#define vi vector<long long>
#define pb push_back
#define sz(s) (int)s.size()
#define all(v) v.begin(), v.end()
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define pp pair<int,int>
#define FF first
#define SS second
#define endl "\n"
#define ld long double
const int N = 1e6 + 2, N3 = 1e3 + 6, inf = 1e9 + 7, LOG = 20;
map<char, int> md{{'N', 0}, {'E', 1}, {'S', 2}, {'W', 3}};
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
string stepDir = "RDLU";
int n, k, x[N], y[N];
multiset <int> st;
main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
cin >> n >> k;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) {
st.insert(abs(x[i] - x[j]) + abs(y[i] - y[j]));
}
}
for (auto to : st) {
cout << to << "\n";
k--;
if (k == 0) break;
}
return 0;
}
Compilation message
road_construction.cpp:3: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
3 | #pragma comment(linker, "/stack:200000000")
|
road_construction.cpp:31:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
31 | main () {
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
371 ms |
26400 KB |
Output is correct |
2 |
Correct |
398 ms |
26344 KB |
Output is correct |
3 |
Correct |
162 ms |
14656 KB |
Output is correct |
4 |
Correct |
148 ms |
14648 KB |
Output is correct |
5 |
Correct |
312 ms |
25164 KB |
Output is correct |
6 |
Correct |
169 ms |
23832 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
10065 ms |
362008 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
10063 ms |
357152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
10063 ms |
357152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
371 ms |
26400 KB |
Output is correct |
2 |
Correct |
398 ms |
26344 KB |
Output is correct |
3 |
Correct |
162 ms |
14656 KB |
Output is correct |
4 |
Correct |
148 ms |
14648 KB |
Output is correct |
5 |
Correct |
312 ms |
25164 KB |
Output is correct |
6 |
Correct |
169 ms |
23832 KB |
Output is correct |
7 |
Execution timed out |
10074 ms |
373608 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
371 ms |
26400 KB |
Output is correct |
2 |
Correct |
398 ms |
26344 KB |
Output is correct |
3 |
Correct |
162 ms |
14656 KB |
Output is correct |
4 |
Correct |
148 ms |
14648 KB |
Output is correct |
5 |
Correct |
312 ms |
25164 KB |
Output is correct |
6 |
Correct |
169 ms |
23832 KB |
Output is correct |
7 |
Execution timed out |
10065 ms |
362008 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |