Submission details
Task:Distances
Sender:FZiuzin
Submission time:2026-04-17 14:57:44 +0300
Language:C++ (C++20)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:34:19: warning: 'void std::random_shuffle(_RAIter, _RAIter, _Generator&&) [with _RAIter = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Generator = int]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
   34 |     random_shuffle(all(pos), 57575);
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
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:4620:5: note: declared here
 4620 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h: In instantiation of 'void std::random_shuffle(_RAIter, _RAIter, _Generator&&) [with _RAIter = __gnu_cxx::__normal_iterator<pair<long int, long int>*, vector<pair<long int, long int> > >; _Gener...

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({rand() % 1000, rand() % 1000});
        }
    }
    random_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;
}