Submission details
Task:Distances
Sender:RKondratavicius
Submission time:2026-04-17 12:21:06 +0300
Language:C++ (C++20)
Status:READY
Result:21
Feedback
subtaskverdictscore
#1ACCEPTED11
#2ACCEPTED4
#3ACCEPTED6
#40
#50
#60
Test results
testverdicttimesubtask
#1ACCEPTED0.00 s1, 4, 6details
#2ACCEPTED0.00 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
#160.00 s4, 6details
#170.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
#23ACCEPTED0.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
#29ACCEPTED0.00 s2, 6details
#30ACCEPTED0.00 s3, 4, 5, 6details
#310.00 s4, 5, 6details
#320.01 s4, 5, 6details
#330.00 s4, 5, 6details
#340.00 s5, 6details
#350.00 s5, 6details
#360.00 s5, 6details
#370.00 s6details
#380.00 s6details
#39ACCEPTED0.00 s2, 6details
#400.00 s6details
#410.00 s6details
#420.00 s6details
#430.00 s6details
#440.00 s6details

Code

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int kiekmax = n*(n-1)/2;
    if(n==1)
    {
        cout << "1 1";
    }
    else if(n==2)
    {
        if(k==0)
        {
            cout << "1 1\n2 2";
        }
        else
        {
            cout << "1 1\n1 2";
        }
    }
    else if(n==3)
    {
        if(k==0)
        {
            cout << "1 1\n2 2\n3 3";
        }
        if(k==1)
        {
            cout << "1 1\n1 2\n2 3";
        }
        if(k==2)
        {
            cout << "1 1\n1 2\n2 2";
        }
        if(k==3)
        {
            cout << "1 1\n1 2\n1 3";
        }
    }
    else if(n==4)
    {
        if(k==0)
        {
            cout << "1 1\n2 2\n3 3\n4 4";
        }
        if(k==1)
        {
            cout << "1 1\n1 2\n2 3\n3 4";
        }
        if(k==2)
        {
            cout << "1 1\n1 2\n2 2\n3 3";
        }
        if(k==3)
        {
            cout << "1 1\n1 2\n1 3\n2 4";
        }
        if(k==4)
        {
            cout << "1 1\n1 2\n2 1\n2 2";
        }
        if(k==5)
        {
            cout << "1 1\n3 1\n4 1\n4 5";
        }
        if(k==6)
        {
            cout << "1 1\n1 2\n1 3\n1 4";
        }
    }
    else if(k==kiekmax)
    {
        for(int i=0; i<n; i++)
        {
            cout << "1 " << i+1 << "\n";
        }
    }
    else if(k==0)
    {
        for(int i=0; i<n; i++)
        {
            cout << i+1 << ' ' << i+1 << "\n";
        }
    }
    else
    {
        int kiekpaimta = 0;
        int kiek_pasiekta = 0;
        int sluoksnis = 1;
        int dab_jau = 0;
        bool ar_imtis = 0;
        int eile = 99;
        while(kiek_pasiekta < k)
        {
            if(k-kiek_pasiekta < 3 && n-kiekpaimta < 3)
            {
                ar_imtis = 1;
                break;
            }
            if(kiek_pasiekta+dab_jau > k)
            {
                dab_jau  = 0;
                sluoksnis++;
            }
            else
            {
                kiekpaimta++;
                kiek_pasiekta += dab_jau;
                dab_jau++;
                eile++;
                cout << sluoksnis*1e7 << ' ' << eile << "\n";
            }
        }
        if(ar_imtis)
        {
            cout << 1e7-1 << " 100\n";
            if(k-kiek_pasiekta == 2)
            {
                cout << 1e7-3 << " 96\n";
                kiekpaimta++;
                kiek_pasiekta++;
            }
            kiek_pasiekta++;
            kiekpaimta++;
        }
        sluoksnis++;
        while(kiekpaimta < n)
        {
            cout << sluoksnis*1e7 << ' ' << eile << "\n";
            sluoksnis++;
            eile++;
            kiekpaimta++;
        }
    }
    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
1 1
1 2
2 2

Test 2

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

Verdict: ACCEPTED

input
1 0

correct output
1 0

user output
1 1

Test 3

Subtask: 1, 3, 4, 5, 6

Verdict: ACCEPTED

input
2 0

correct output
1 0
804289383 846930886

user output
1 1
2 2

Test 4

Subtask: 1, 2, 4, 6

Verdict: ACCEPTED

input
2 1

correct output
1 0
2 0

user output
1 1
1 2

Test 5

Subtask: 1, 3, 4, 5, 6

Verdict: ACCEPTED

input
3 0

correct output
1 0
804289383 846930886
681692777 714636915

user output
1 1
2 2
3 3

Test 6

Subtask: 1, 4, 6

Verdict: ACCEPTED

input
3 1

correct output
1 0
2 0
804289383 846930886

user output
1 1
1 2
2 3

Test 7

Subtask: 1, 4, 6

Verdict: ACCEPTED

input
3 2

correct output
1 1
1 2
2 2

user output
1 1
1 2
2 2

Test 8

Subtask: 1, 2, 4, 6

Verdict: ACCEPTED

input
3 3

correct output
1 0
2 0
3 0

user output
1 1
1 2
1 3

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
1 1
2 2
3 3
4 4

Test 10

Subtask: 1, 4, 5, 6

Verdict: ACCEPTED

input
4 1

correct output
1 0
2 0
804289383 846930886
681692777 714636915

user output
1 1
1 2
2 3
3 4

Test 11

Subtask: 1, 4, 6

Verdict: ACCEPTED

input
4 2

correct output
21392 0
1 0
0 510510
804289383 846930886

user output
1 1
1 2
2 2
3 3

Test 12

Subtask: 1, 4, 6

Verdict: ACCEPTED

input
4 3

correct output
1 0
2 0
3 0
804289383 846930886

user output
1 1
1 2
1 3
2 4

Test 13

Subtask: 1, 4, 6

Verdict: ACCEPTED

input
4 4

correct output
21392 0
1 0
2 0
0 510510

user output
1 1
1 2
2 1
2 2

Test 14

Subtask: 1, 6

Verdict: ACCEPTED

input
4 5

correct output
21392 0
22600 0
1 0
0 510510

user output
1 1
3 1
4 1
4 5

Test 15

Subtask: 1, 2, 6

Verdict: ACCEPTED

input
4 6

correct output
1 0
2 0
3 0
4 0

user output
1 1
1 2
1 3
1 4

Test 16

Subtask: 4, 6

Verdict:

input
5 5

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 100
1e+07 96

Test 17

Subtask: 4, 6

Verdict:

input
6 5

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

user output
1e+07 100
1e+07 101
1e+07 102
2e+07 103
1e+07 100
...

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
1 1
2 2
3 3
4 4
5 5
...

Test 19

Subtask: 4, 5, 6

Verdict:

input
98 97

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 20

Subtask: 4, 5, 6

Verdict:

input
98 98

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 21

Subtask: 5, 6

Verdict:

input
98 1185

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 22

Subtask: 5, 6

Verdict:

input
98 1188

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 23

Subtask: 2, 6

Verdict: ACCEPTED

input
98 4753

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

user output
1 1
1 2
1 3
1 4
1 5
...

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
1 1
2 2
3 3
4 4
5 5
...

Test 25

Subtask: 4, 5, 6

Verdict:

input
99 98

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 26

Subtask: 4, 5, 6

Verdict:

input
99 99

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 27

Subtask: 5, 6

Verdict:

input
99 1201

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 28

Subtask: 5, 6

Verdict:

input
99 1212

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 29

Subtask: 2, 6

Verdict: ACCEPTED

input
99 4851

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

user output
1 1
1 2
1 3
1 4
1 5
...

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
1 1
2 2
3 3
4 4
5 5
...

Test 31

Subtask: 4, 5, 6

Verdict:

input
100 1

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

user output
1e+07 100
1e+07 101
2e+07 101
3e+07 102
4e+07 103
...

Test 32

Subtask: 4, 5, 6

Verdict:

input
100 5

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

user output
1e+07 100
1e+07 101
1e+07 102
2e+07 103
2e+07 104
...

Test 33

Subtask: 4, 5, 6

Verdict:

input
100 100

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 34

Subtask: 5, 6

Verdict:

input
100 1000

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 35

Subtask: 5, 6

Verdict:

input
100 1232

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 36

Subtask: 5, 6

Verdict:

input
100 1237

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 37

Subtask: 6

Verdict:

input
100 2222

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 38

Subtask: 6

Verdict:

input
100 3395

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 39

Subtask: 2, 6

Verdict: ACCEPTED

input
100 4950

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

user output
1 1
1 2
1 3
1 4
1 5
...

Test 40

Subtask: 6

Verdict:

input
100 4949

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 41

Subtask: 6

Verdict:

input
100 4948

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 42

Subtask: 6

Verdict:

input
100 4930

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 43

Subtask: 6

Verdict:

input
100 4920

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...

Test 44

Subtask: 6

Verdict:

input
100 4900

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

user output
1e+07 100
1e+07 101
1e+07 102
1e+07 103
1e+07 104
...