Submission details
Task:Distances
Sender:Juan_Alejandro
Submission time:2026-04-18 19:33:19 +0300
Language:C++ (C++20)
Status:READY
Result:17
Feedback
subtaskverdictscore
#1ACCEPTED11
#20
#3ACCEPTED6
#40
#50
#60
Test results
testverdicttimesubtask
#1ACCEPTED0.00 s1, 4, 6details
#2ACCEPTED0.01 s1, 2, 3, 4, 5, 6details
#3ACCEPTED0.00 s1, 3, 4, 5, 6details
#4ACCEPTED0.00 s1, 2, 4, 6details
#5ACCEPTED0.00 s1, 3, 4, 5, 6details
#6ACCEPTED0.00 s1, 4, 6details
#7ACCEPTED0.00 s1, 4, 6details
#8ACCEPTED0.00 s1, 2, 4, 6details
#9ACCEPTED0.00 s1, 3, 4, 5, 6details
#10ACCEPTED0.00 s1, 4, 5, 6details
#11ACCEPTED0.00 s1, 4, 6details
#12ACCEPTED0.00 s1, 4, 6details
#13ACCEPTED0.00 s1, 4, 6details
#14ACCEPTED0.00 s1, 6details
#15ACCEPTED0.00 s1, 2, 6details
#16ACCEPTED0.00 s4, 6details
#17ACCEPTED0.00 s4, 6details
#18ACCEPTED0.00 s3, 4, 5, 6details
#190.00 s4, 5, 6details
#200.00 s4, 5, 6details
#210.00 s5, 6details
#220.00 s5, 6details
#230.00 s2, 6details
#24ACCEPTED0.00 s3, 4, 5, 6details
#250.00 s4, 5, 6details
#260.00 s4, 5, 6details
#270.00 s5, 6details
#280.00 s5, 6details
#290.00 s2, 6details
#30ACCEPTED0.00 s3, 4, 5, 6details
#31ACCEPTED0.00 s4, 5, 6details
#32ACCEPTED0.00 s4, 5, 6details
#330.00 s4, 5, 6details
#340.00 s5, 6details
#350.00 s5, 6details
#360.01 s5, 6details
#370.00 s6details
#380.00 s6details
#390.00 s2, 6details
#400.00 s6details
#410.01 s6details
#420.00 s6details
#430.00 s6details
#440.00 s6details

Compiler report

input/code.cpp: In function 'long long int asdd(long long int, long long int, std::vector<std::pair<long long int, long long int> >&)':
input/code.cpp:11:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int k=0;k<x.size();k++)
      |                 ~^~~~~~~~~
input/code.cpp: In function 'bool asddd(long long int, long long int, std::vector<std::pair<long long int, long long int> >&)':
input/code.cpp:23:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int k=0;k<x.size();k++)
      |                 ~^~~~~~~~~
input/code.cpp:22:9: warning: unused variable 'c' [-Wunused-variable]
   22 |     int c=0;
      |         ^
input/code.cpp: In function 'int32_t...

Code

#include <bits/stdc++.h>
#define int long long 
#define endl " \n"
#define vec vector 
#define all(x) x.begin(),x.end()
#pragma GCC optimize("O2,unroll-loops")
using namespace std;
int asdd(int i,int j,vec<pair<int,int>> &x)
{
    int c=0;
    for(int k=0;k<x.size();k++)
    {
        if(floorl(sqrtl((long double)((x[k].first-i)*(x[k].first-i)+(x[k].second-j)*(x[k].second-j))))==ceill(sqrtl((long double)((x[k].first-i)*(x[k].first-i)+(x[k].second-j)*(x[k].second-j)))))
        {
            c++;
        }
    }
    return c;
}
bool asddd(int i,int j,vec<pair<int,int>> &x)
{
    int c=0;
    for(int k=0;k<x.size();k++)
    {
        if(floorl(sqrtl((long double)((x[k].first-i)*(x[k].first-i)+(x[k].second-j)*(x[k].second-j))))==ceill(sqrtl((long double)((x[k].first-i)*(x[k].first-i)+(x[k].second-j)*(x[k].second-j)))))
        {
            return 1;
        }
    }
    return 0;
}
void f(int y,vec<pair<int,int>> &x,int &k,int &c)
{
    if(k==c||y>=8)return;
    int xx=0;
    //cout<<asdd(1e6,y,x)<<" "<<c<<" "<<k<<endl[1];
    if(asdd(1e6,y,x)+c>k)
    {
        f(y+4,x,k,c);
        return;
    }
    while(asdd(xx,y,x)+c>k||((!asdd(xx,y,x))&&y!=0))xx--;

    c+=asdd(xx,y,x);
    //cout<<"+"<<asdd(xx,y,x)<<endl[1];
    x.push_back({xx,y});
    if(k==c)return;
    xx=-3;

    if(asdd(1e6,y,x)+c>k)
    {
        f(y+4,x,k,c);
        return;
    }
    while(asdd(xx,y,x)+c>k)xx--;

    c+=asdd(xx,y,x);
    //cout<<"+"<<asdd(xx,y,x)<<endl[1];
    x.push_back({xx,y});
    if(k==c)return;
    xx=3;

    if(asdd(1e6,y,x)+c>k)
    {
        f(y+4,x,k,c);
        return;
    }
    while(asdd(xx,y,x)+c>k)xx--;

    c+=asdd(xx,y,x);
    //cout<<"+"<<asdd(xx,y,x)<<endl[1];
    x.push_back({xx,y});
    if(k==c)return;

    xx=1;
    while(asdd(1e6,y,x)+c<=k){
        while(asdd(xx,y,x)+c>k){xx++;}
        c+=asdd(xx,y,x);
        //cout<<"+"<<asdd(xx,y,x)<<endl[1];
        x.push_back({xx,y});
    }
    if(asdd(1e6,y,x)+c>k)
    f(y+4,x,k,c);
}
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
    int n,k;
    cin>>n>>k;
    int i=0,j=0,c=0;
    vec<pair<int,int>> x;
    f(0,x,k,c);
    while(x.size()<n)
    {
        while(asddd(i,j,x)) 
        i++,j++;
        x.push_back({i,j});
    }
    for(const auto&[xx,y]:x)
    {
        cout<<xx<<" "<<y<<endl[1];
    }
    return 0;
}

Test details

Test 1

Subtask: 1, 4, 6

Verdict: ACCEPTED

input
3 2

correct output
1 1
1 2
2 2

user output
0 0
-3 0
-6 4

Test 2

Subtask: 1, 2, 3, 4, 5, 6

Verdict: ACCEPTED

input
1 0

correct output
1 0

user output
0 0

Test 3

Subtask: 1, 3, 4, 5, 6

Verdict: ACCEPTED

input
2 0

correct output
1 0
804289383 846930886

user output
0 0
1 1

Test 4

Subtask: 1, 2, 4, 6

Verdict: ACCEPTED

input
2 1

correct output
1 0
2 0

user output
0 0
-3 0

Test 5

Subtask: 1, 3, 4, 5, 6

Verdict: ACCEPTED

input
3 0

correct output
1 0
804289383 846930886
681692777 714636915

user output
0 0
1 1
2 2

Test 6

Subtask: 1, 4, 6

Verdict: ACCEPTED

input
3 1

correct output
1 0
2 0
804289383 846930886

user output
0 0
-3 0
1 1

Test 7

Subtask: 1, 4, 6

Verdict: ACCEPTED

input
3 2

correct output
1 1
1 2
2 2

user output
0 0
-3 0
-6 4

Test 8

Subtask: 1, 2, 4, 6

Verdict: ACCEPTED

input
3 3

correct output
1 0
2 0
3 0

user output
0 0
-3 0
3 0

Test 9

Subtask: 1, 3, 4, 5, 6

Verdict: ACCEPTED

input
4 0

correct output
1 0
804289383 846930886
681692777 714636915
957747793 424238335

user output
0 0
1 1
2 2
3 3

Test 10

Subtask: 1, 4, 5, 6

Verdict: ACCEPTED

input
4 1

correct output
1 0
2 0
804289383 846930886
681692777 714636915

user output
0 0
-3 0
1 1
2 2

Test 11

Subtask: 1, 4, 6

Verdict: ACCEPTED

input
4 2

correct output
21392 0
1 0
0 510510
804289383 846930886

user output
0 0
-3 0
-6 4
1 1

Test 12

Subtask: 1, 4, 6

Verdict: ACCEPTED

input
4 3

correct output
1 0
2 0
3 0
804289383 846930886

user output
0 0
-3 0
3 0
1 1

Test 13

Subtask: 1, 4, 6

Verdict: ACCEPTED

input
4 4

correct output
21392 0
1 0
2 0
0 510510

user output
0 0
-3 0
3 0
-6 4

Test 14

Subtask: 1, 6

Verdict: ACCEPTED

input
4 5

correct output
21392 0
22600 0
1 0
0 510510

user output
0 0
-3 0
3 0
-3 4

Test 15

Subtask: 1, 2, 6

Verdict: ACCEPTED

input
4 6

correct output
1 0
2 0
3 0
4 0

user output
0 0
-3 0
3 0
1 0

Test 16

Subtask: 4, 6

Verdict: ACCEPTED

input
5 5

correct output
21392 0
22600 0
1 0
0 510510
804289383 846930886

user output
0 0
-3 0
3 0
-3 4
2 2

Test 17

Subtask: 4, 6

Verdict: ACCEPTED

input
6 5

correct output
21392 0
22600 0
1 0
0 510510
804289383 846930886
...

user output
0 0
-3 0
3 0
-3 4
2 2
...

Test 18

Subtask: 3, 4, 5, 6

Verdict: ACCEPTED

input
98 0

correct output
1 0
804289383 846930886
681692777 714636915
957747793 424238335
719885386 649760492
...

user output
0 0
1 1
2 2
3 3
4 4
...

Test 19

Subtask: 4, 5, 6

Verdict:

input
98 97

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 20

Subtask: 4, 5, 6

Verdict:

input
98 98

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 21

Subtask: 5, 6

Verdict:

input
98 1185

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 22

Subtask: 5, 6

Verdict:

input
98 1188

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 23

Subtask: 2, 6

Verdict:

input
98 4753

correct output
1 0
2 0
3 0
4 0
5 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 24

Subtask: 3, 4, 5, 6

Verdict: ACCEPTED

input
99 0

correct output
1 0
804289383 846930886
681692777 714636915
957747793 424238335
719885386 649760492
...

user output
0 0
1 1
2 2
3 3
4 4
...

Test 25

Subtask: 4, 5, 6

Verdict:

input
99 98

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 26

Subtask: 4, 5, 6

Verdict:

input
99 99

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 27

Subtask: 5, 6

Verdict:

input
99 1201

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 28

Subtask: 5, 6

Verdict:

input
99 1212

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 29

Subtask: 2, 6

Verdict:

input
99 4851

correct output
1 0
2 0
3 0
4 0
5 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 30

Subtask: 3, 4, 5, 6

Verdict: ACCEPTED

input
100 0

correct output
1 0
804289383 846930886
681692777 714636915
957747793 424238335
719885386 649760492
...

user output
0 0
1 1
2 2
3 3
4 4
...

Test 31

Subtask: 4, 5, 6

Verdict: ACCEPTED

input
100 1

correct output
1 0
2 0
804289383 846930886
681692777 714636915
957747793 424238335
...

user output
0 0
-3 0
1 1
2 2
3 3
...

Test 32

Subtask: 4, 5, 6

Verdict: ACCEPTED

input
100 5

correct output
21392 0
22600 0
1 0
0 510510
804289383 846930886
...

user output
0 0
-3 0
3 0
-3 4
2 2
...

Test 33

Subtask: 4, 5, 6

Verdict:

input
100 100

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 34

Subtask: 5, 6

Verdict:

input
100 1000

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 35

Subtask: 5, 6

Verdict:

input
100 1232

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 36

Subtask: 5, 6

Verdict:

input
100 1237

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 37

Subtask: 6

Verdict:

input
100 2222

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 38

Subtask: 6

Verdict:

input
100 3395

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 39

Subtask: 2, 6

Verdict:

input
100 4950

correct output
1 0
2 0
3 0
4 0
5 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 40

Subtask: 6

Verdict:

input
100 4949

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 41

Subtask: 6

Verdict:

input
100 4948

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 42

Subtask: 6

Verdict:

input
100 4930

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 43

Subtask: 6

Verdict:

input
100 4920

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...

Test 44

Subtask: 6

Verdict:

input
100 4900

correct output
21392 0
22600 0
30056 0
34848 0
38584 0
...

user output
0 0
-3 0
3 0
1 0
1 0
...