| Task: | Distances |
| Sender: | FZiuzin |
| Submission time: | 2026-04-17 14:28:28 +0300 |
| Language: | C++ (C++20) |
| Status: | COMPILE ERROR |
Compiler report
In file included from /usr/include/c++/13/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
from input/code.cpp:1:
/usr/include/c++/13/bits/stl_algo.h: In instantiation of 'void std::shuffle(_RAIter, _RAIter, _UGenerator&&) [with _RAIter = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _UGenerator = int]':
input/code.cpp:34:12: required from here
/usr/include/c++/13/bits/stl_algo.h:3763:9: error: 'std::remove_reference<int>::type' {aka 'int'} is not a class, struct, or union type
3763 | __uc_type;
| ^~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:3791:44: error: 'std::remove_reference<int>::type' {aka 'int'} is not a class, struct, or union type
3791 | const pair<__uc_type, __uc_type> __pospos =
| ^~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:3791:44: error: 'std::remove_reference<int>::type' {aka 'int'...Code
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
const int INF = 1e14;
const int MAXN = 2e5 + 5;
#define pb push_back
#define all(a) a.begin(), a.end()
bool dist(pair<int,int> a, pair<int,int> b)
{
int v = (a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second);
int sq = sqrt(v);
if (sq * sq == v)
{
return true;
}
return false;
}
signed main()
{
int n,k;
cin >> n >> k;
vector<pair<int,int>> points;
vector<pair<int, int>> pos;
for (int di = 0;di < 200;di++)
{
for (int dj = 0;dj < 200;dj++)
{
pos.pb({di, dj});
}
}
shuffle(all(pos), 57575);
for (int i = 0;i < n;i++)
{
pair<int,int> best;
int val_best = -1;
for (auto d : pos)
{
int di = d.first;
int dj = d.second;
int cr = 0;
bool ok = true;
for (auto p: points)
{
if (dist({di, dj}, p))
{
cr++;
}
if (di == p.first && dj == p.second)
{
ok = false;
}
}
if (cr > k || !ok)
{
continue;
}
if (cr > val_best)
{
best = {di, dj};
val_best = cr;
}
}
k -= val_best;
points.pb(best);
}
assert(k == 0);
for (auto i: points)
{
cout << i.first << " " << i.second << '\n';
}
return 0;
}