CSES - Datatähti 2025 loppu - Results
Submission details
Task:Leikkijät
Sender:OorigamiK
Submission time:2025-01-18 16:27:52 +0200
Language:C++ (C++20)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
#40
#50
#60
Test results
testverdicttimegroup
#10.00 s1, 2, 5, 6details
#20.00 s1, 2, 3, 5, 6details
#30.00 s1, 2, 5, 6details
#40.00 s1, 2, 4, 5, 6details
#50.00 s2, 5, 6details
#60.00 s2, 3, 5, 6details
#70.01 s2, 5, 6details
#80.00 s2, 4, 5, 6details
#90.00 s5, 6details
#100.08 s6details
#110.00 s1, 2, 5, 6details
#120.05 s6details
#13ACCEPTED0.00 s3, 5, 6details
#140.00 s3, 5, 6details
#150.00 s4, 5, 6details
#160.00 s5, 6details
#170.07 s6details
#180.00 s4, 5, 6details
#190.00 s5, 6details
#200.06 s6details
#210.07 s6details
#220.00 s5, 6details

Code

#include <iostream>
#include <vector>
using namespace std;

void calculateOrder(vector<int>& order, int n){
    order[0]=2;
    int offset=2;
    for (int i=1;i<n;i++){
        if (order[i-1]+offset<=n){
            order[i]=(order[i-1]+offset);
        }
        else{
            if (i==n-1){
                order[i]=(2*n-(-1+2*(offset-(n-order[i-1]))))%n;
                if (order[i]==0){
                    order[i]=n;
                }
                break;
            }
            order[i]=-1+2*(offset-(n-order[i-1]));
            offset*=2;
        }
    }
}

int main(){
    int t;
    cin>>t;
    std::vector<int> A(t);
    std::vector<int> B(t);
    for (int i=0;i<t;i++){
        int a;
        int b;
        cin>>a>>b;
        A[i]=a;
        B[i]=b;
    }
    for (int i=0;i<t;i++){
        if (A[i]%2==0){
            if (B[i]==A[i]+2){
                cout<<A[i]+2<<"\n";
            }
            else if (B[i]==1){
                cout<<A[i]+1<<"\n";
            }
            else{
                cout<<-1<<"\n";
            }
        }
    }
}













































/*int leavingStep[1000000];
//2^20>1e6
int powersOfTwo[30];
int offsets[30];

void precompute(){
    int offset=2;
    offsets[0]=0
    for (int i=1;i<19;i++){
        offsets[i]=offset;
        int k=powersOfTwo[i];
        int index=offset;
        while(index<1000000){
            leavingStep[index]=i;
            index+=k;
        }
        offset+=k/2;
    }
    //leavingStep
}

int check(int a, int b){
    if (leavingStep[a]==leavingStep[b]){
        if (b-a==powersOfTwo[leavingStep[a]]){
            cout<<b<<std::endl;
        }
    }
    if (leavingStep[b]=leavingStep[a]+1){
        int i=1;
        while (offsets[i]<b){
            i++;
        }
        if (offsets[i]==b){

        }
    }
}

int test(int a, int b){
return 0;
}

int main(){
    powersOfTwo[0]=1;
    for (int i=1;i<30;i++){
        powersOfTwo[i]=2*powersOfTwo[i-1];
    }
    precompute();


}
*/

Test details

Test 1

Group: 1, 2, 5, 6

Verdict:

input
1000
42 100
73 94
1 13
31 100
...

correct output
-1
-1
-1
-1
-1
...

user output
-1
-1
-1
-1
-1
...
Truncated

Test 2

Group: 1, 2, 3, 5, 6

Verdict:

input
1000
54 3
42 44
30 1
52 3
...

correct output
54
44
31
52
15
...

user output
-1
44
31
-1
15
...
Truncated

Test 3

Group: 1, 2, 5, 6

Verdict:

input
1000
27 25
81 65
45 43
87 23
...

correct output
-1
-1
-1
139
-1
...

user output
(empty)

Test 4

Group: 1, 2, 4, 5, 6

Verdict:

input
1000
55 63
39 71
95 96
61 69
...

correct output
65
75
-1
72
98
...

user output
(empty)

Test 5

Group: 2, 5, 6

Verdict:

input
1000
222 56
871 832
207 364
919 980
...

correct output
-1
-1
-1
-1
-1
...

user output
-1
-1
-1
-1
-1
...
Truncated

Test 6

Group: 2, 3, 5, 6

Verdict:

input
1000
892 3
332 334
820 822
42 1
...

correct output
892
334
822
43
108
...

user output
-1
334
822
43
-1
...
Truncated

Test 7

Group: 2, 5, 6

Verdict:

input
1000
77 93
319 575
509 381
675 707
...

correct output
98
607
574
713
919
...

user output
(empty)

Test 8

Group: 2, 4, 5, 6

Verdict:

input
1000
969 985
233 489
403 659
427 555
...

correct output
992
500
777
565
261
...

user output
(empty)

Test 9

Group: 5, 6

Verdict:

input
1000
10375 364462
501875 499131
495774 7544
133830 316225
...

correct output
-1
-1
-1
-1
-1
...

user output
-1
-1
-1
-1
-1
...
Truncated

Test 10

Group: 6

Verdict:

input
100000
771321 298762
20752 494590
633649 443015
748804 831912
...

correct output
-1
-1
-1
-1
-1
...

user output
-1
-1
-1
-1
-1
...
Truncated

Test 11

Group: 1, 2, 5, 6

Verdict:

input
900
1 1
1 2
1 3
1 4
...

correct output
-1
-1
3
-1
5
...

user output
3
-1
-1
4
-1
...
Truncated

Test 12

Group: 6

Verdict:

input
90000
1 1
1 2
1 3
1 4
...

correct output
-1
-1
3
-1
5
...

user output
3
-1
-1
4
-1
...
Truncated

Test 13

Group: 3, 5, 6

Verdict: ACCEPTED

input
1000
237542 859435
965750 179154
972602 758585
453450 751662
...

correct output
-1
-1
-1
-1
-1
...

user output
-1
-1
-1
-1
-1
...
Truncated

Test 14

Group: 3, 5, 6

Verdict:

input
1000
773164 1
870426 1
309736 309738
957602 957604
...

correct output
773165
870427
309738
957604
513118
...

user output
773165
870427
309738
957604
513118
...
Truncated

Test 15

Group: 4, 5, 6

Verdict:

input
1000
178896 591355
54364 110987
361539 818612
275401 926643
...

correct output
-1
-1
-1
-1
-1
...

user output
-1
-1
-1
-1
-1
...
Truncated

Test 16

Group: 5, 6

Verdict:

input
1000
704481 704465
696919 688727
941011 949203
171023 171025
...

correct output
-1
-1
951785
-1
-1
...

user output
(empty)

Test 17

Group: 6

Verdict:

input
100000
67901 133437
637521 637537
742567 742569
864043 864044
...

correct output
148638
637540
-1
-1
652457
...

user output
(empty)

Test 18

Group: 4, 5, 6

Verdict:

input
1000
650375 650377
181841 443985
750137 750138
256969 322505
...

correct output
-1
484136
-1
341476
850152
...

user output
(empty)

Test 19

Group: 5, 6

Verdict:

input
1000
1 3
1 5
1 9
1 17
...

correct output
3
5
10
20
40
...

user output
3
4
5
-1
6
...
Truncated

Test 20

Group: 6

Verdict:

input
100000
1 3
1 5
1 9
1 17
...

correct output
3
5
10
20
40
...

user output
3
4
5
-1
6
...
Truncated

Test 21

Group: 6

Verdict:

input
100000
999999 1
999999 3
999999 5
999999 7
...

correct output
1000002
1000005
1000000
1000011
1000001
...

user output
(empty)

Test 22

Group: 5, 6

Verdict:

input
1000
999999 1
999999 3
999999 5
999999 7
...

correct output
1000002
1000005
1000000
1000011
1000001
...

user output
(empty)