CSES - HIIT Open 2017 - Results
Submission details
Task:Contest
Sender:Ace of Spades
Submission time:2017-05-27 13:16:55
Language:C++
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.05 sdetails
#2ACCEPTED0.04 sdetails
#3ACCEPTED0.04 sdetails
#4ACCEPTED0.05 sdetails
#5ACCEPTED0.06 sdetails
#6ACCEPTED0.07 sdetails
#7ACCEPTED0.06 sdetails
#8ACCEPTED0.06 sdetails
#9ACCEPTED0.04 sdetails
#10ACCEPTED0.04 sdetails
#11ACCEPTED0.04 sdetails
#12ACCEPTED0.04 sdetails
#13ACCEPTED0.06 sdetails
#14ACCEPTED0.05 sdetails
#15ACCEPTED0.04 sdetails
#16ACCEPTED0.05 sdetails
#17ACCEPTED0.05 sdetails
#18ACCEPTED0.03 sdetails
#19ACCEPTED0.05 sdetails
#20ACCEPTED0.06 sdetails
#21ACCEPTED0.04 sdetails
#22ACCEPTED0.05 sdetails
#23ACCEPTED0.04 sdetails
#24ACCEPTED0.05 sdetails
#25ACCEPTED0.04 sdetails
#26ACCEPTED0.06 sdetails
#27ACCEPTED0.06 sdetails
#28ACCEPTED0.06 sdetails
#29ACCEPTED0.04 sdetails
#30ACCEPTED0.06 sdetails
#31ACCEPTED0.05 sdetails
#32ACCEPTED0.08 sdetails
#33ACCEPTED0.12 sdetails
#34ACCEPTED0.09 sdetails
#35ACCEPTED0.08 sdetails
#36ACCEPTED0.11 sdetails
#37ACCEPTED0.11 sdetails
#38ACCEPTED0.07 sdetails
#39ACCEPTED0.11 sdetails
#40ACCEPTED0.08 sdetails
#41ACCEPTED0.10 sdetails
#42ACCEPTED0.09 sdetails
#43ACCEPTED0.07 sdetails
#44ACCEPTED0.13 sdetails
#45ACCEPTED0.10 sdetails
#46ACCEPTED0.10 sdetails

Code

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,k;
    cin>>n>>k;
    int lo = 0;
    int hi = k;
    if(hi > n) {
	hi = n;
	lo = k-n;
    }
    int queries = 0;
    while(lo <= hi) {
	int mid = (lo+hi)/2;
	int apos = mid;
	int bpos = k-mid;
	int aok = 1;
	int bok = 1;
	int ma = 1e9+100;
	if(apos != 0) {
	    ++queries;
	    cout<<1<<' '<<apos<<endl;
	    int q;
	    cin>>q;
	    ma = min(ma, q);
	}
	if(bpos != 0) {
	    ++queries;
	    cout<<2<<' '<<bpos<<endl;
	    int q;
	    cin>>q;
	    ma = min(ma, q);
	}
	/*
	cout<<apos<<' '<<bpos<<endl;
	cout<<"MA "<<ma<<endl;
	*/
	if(apos != n) {
	    ++queries;
	    cout<<1<<' '<<apos+1<<endl;
	    int q;
	    cin>>q;
	    if(q > ma) aok = 0;
	}
	if(bpos != n) {
	    ++queries;
	    cout<<2<<' '<<bpos+1<<endl;
	    int q;
	    cin>>q;
	    if(q > ma) bok = 0;
	}
	/*
	cout<<"lol"<<endl;
	cout<<aok<<' '<<bok<<endl;
	*/
	if(aok && bok) {
	    ++queries;
	    if(queries > 100) while(1);
	    cout<<3<<' '<<ma<<endl;
	    return 0;
	}
	if(!bok && !aok) {
	    cout<<"LOL FAIL"<<endl;
	    while(1);
	}
	if(!bok) {
	    hi = mid-1;
	}
	if(!aok) {
	    lo = mid+1;
	}
	//cout<<lo<<' '<<hi<<endl;
    }

}

Test details

Test 1

Verdict: ACCEPTED

input
1 1
33
18

correct output
(empty)

user output
1 1
2 1
18
1 1
33
...

Test 2

Verdict: ACCEPTED

input
1 1
37
55

correct output
(empty)

user output
1 1
2 1
55
1 1
37
...

Test 3

Verdict: ACCEPTED

input
1 2
80
38

correct output
(empty)

user output
1 2
1 1
80
2 1
38
...

Test 4

Verdict: ACCEPTED

input
1 2
29
48

correct output
(empty)

user output
1 2
1 1
29
2 1
48
...

Test 5

Verdict: ACCEPTED

input
2 1
98 91
83 14

correct output
(empty)

user output
2 1
2 1
83
1 1
98
...

Test 6

Verdict: ACCEPTED

input
2 1
25 23
39 31

correct output
(empty)

user output
2 1
2 1
39
1 1
25
...

Test 7

Verdict: ACCEPTED

input
2 1
73 57
77 32

correct output
(empty)

user output
2 1
2 1
77
1 1
73
...

Test 8

Verdict: ACCEPTED

input
2 2
77 64
63 2

correct output
(empty)

user output
2 2
1 1
77
2 1
63
...

Test 9

Verdict: ACCEPTED

input
2 2
61 28
97 90

correct output
(empty)

user output
2 2
1 1
61
2 1
97
...

Test 10

Verdict: ACCEPTED

input
2 2
87 66
75 38

correct output
(empty)

user output
2 2
1 1
87
2 1
75
...

Test 11

Verdict: ACCEPTED

input
2 4
70 39
33 12

correct output
(empty)

user output
2 4
1 2
39
2 2
12
...

Test 12

Verdict: ACCEPTED

input
2 4
47 20
67 52

correct output
(empty)

user output
2 4
1 2
20
2 2
52
...

Test 13

Verdict: ACCEPTED

input
2 4
54 20
90 1

correct output
(empty)

user output
2 4
1 2
20
2 2
1
...

Test 14

Verdict: ACCEPTED

input
2 4
68 66
64 61

correct output
(empty)

user output
2 4
1 2
66
2 2
61
...

Test 15

Verdict: ACCEPTED

input
2 4
35 27
68 66

correct output
(empty)

user output
2 4
1 2
27
2 2
66
...

Test 16

Verdict: ACCEPTED

input
2 4
51 32
25 18

correct output
(empty)

user output
2 4
1 2
32
2 2
18
...

Test 17

Verdict: ACCEPTED

input
10 1
100 78 74 72 71 70 64 57 43 39
29 26 22 21 15 13 11 9 4 3

correct output
(empty)

user output
10 1
2 1
29
1 1
100
...

Test 18

Verdict: ACCEPTED

input
10 1
56 52 49 48 17 14 13 12 9 3
99 98 84 80 78 75 69 67 66 62

correct output
(empty)

user output
10 1
2 1
99
1 1
56
...

Test 19

Verdict: ACCEPTED

input
10 1
91 86 73 65 53 42 28 14 13 6
100 77 70 58 52 41 35 33 17 9

correct output
(empty)

user output
10 1
2 1
100
1 1
91
...

Test 20

Verdict: ACCEPTED

input
10 2
88 87 69 68 64 63 57 55 54 51
50 36 35 31 27 22 15 14 8 1

correct output
(empty)

user output
10 2
1 1
88
2 1
50
...

Test 21

Verdict: ACCEPTED

input
10 2
31 28 26 16 13 9 8 6 5 2
95 87 80 78 76 65 59 53 41 40

correct output
(empty)

user output
10 2
1 1
31
2 1
95
...

Test 22

Verdict: ACCEPTED

input
10 2
98 93 89 68 61 41 32 30 23 4
96 86 76 75 73 58 35 29 26 7

correct output
(empty)

user output
10 2
1 1
98
2 1
96
...

Test 23

Verdict: ACCEPTED

input
10 10
99 86 85 84 82 81 77 74 71 69
45 27 26 24 21 18 15 13 11 4

correct output
(empty)

user output
10 10
1 5
82
2 5
21
...

Test 24

Verdict: ACCEPTED

input
10 10
46 41 40 28 24 23 18 14 8 4
100 94 90 85 78 77 75 68 59 54

correct output
(empty)

user output
10 10
1 5
24
2 5
78
...

Test 25

Verdict: ACCEPTED

input
10 10
91 80 68 39 38 37 31 30 7 1
100 95 87 71 67 41 33 18 17 11

correct output
(empty)

user output
10 10
1 5
38
2 5
67
...

Test 26

Verdict: ACCEPTED

input
10 18
87 86 85 80 79 74 64 60 59 47
43 39 37 34 29 27 26 16 6 5

correct output
(empty)

user output
10 18
1 9
59
2 9
6
...

Test 27

Verdict: ACCEPTED

input
10 18
54 48 42 38 28 27 22 19 15 5
100 96 91 84 79 73 72 64 63 60

correct output
(empty)

user output
10 18
1 9
15
2 9
63
...

Test 28

Verdict: ACCEPTED

input
10 18
98 87 84 71 62 59 45 38 34 10
89 86 77 73 69 67 46 32 31 6

correct output
(empty)

user output
10 18
1 9
34
2 9
31
...

Test 29

Verdict: ACCEPTED

input
10 20
91 90 86 79 73 71 67 65 61 56
46 44 36 25 18 11 6 5 3 1

correct output
(empty)

user output
10 20
1 10
56
2 10
1
...

Test 30

Verdict: ACCEPTED

input
10 20
56 48 47 46 35 28 26 18 10 3
95 90 89 85 79 77 67 66 62 59

correct output
(empty)

user output
10 20
1 10
3
2 10
59
...

Test 31

Verdict: ACCEPTED

input
10 20
81 80 79 76 71 63 57 34 29 24
96 70 61 59 52 36 22 5 4 2

correct output
(empty)

user output
10 20
1 10
24
2 10
2
...

Test 32

Verdict: ACCEPTED

input
100000 1
999998453 999997813 999980598 ...

correct output
(empty)

user output
100000 1
2 1
501385639
1 1
999998453
...

Test 33

Verdict: ACCEPTED

input
100000 1
498482877 498480230 498478078 ...

correct output
(empty)

user output
100000 1
2 1
999998503
1 1
498482877
...

Test 34

Verdict: ACCEPTED

input
100000 1
999986977 999979153 999972315 ...

correct output
(empty)

user output
100000 1
2 1
999999598
1 1
999986977
...

Test 35

Verdict: ACCEPTED

input
100000 20000
999990977 999974610 999971985 ...

correct output
(empty)

user output
100000 20000
1 10000
950169971
2 10000
451028277
...

Test 36

Verdict: ACCEPTED

input
100000 20000
501434689 501431546 501422578 ...

correct output
(empty)

user output
100000 20000
1 10000
451341105
2 10000
950469656
...

Test 37

Verdict: ACCEPTED

input
100000 20000
999995686 999994228 999993000 ...

correct output
(empty)

user output
100000 20000
1 10000
900678332
2 10000
899674635
...

Test 38

Verdict: ACCEPTED

input
100000 100000
999992342 999991618 999988963 ...

correct output
(empty)

user output
100000 100000
1 50000
750743799
2 50000
249323673
...

Test 39

Verdict: ACCEPTED

input
100000 100000
500754694 500749114 500734428 ...

correct output
(empty)

user output
100000 100000
1 50000
249818189
2 50000
750771880
...

Test 40

Verdict: ACCEPTED

input
100000 100000
999988713 999962210 999939592 ...

correct output
(empty)

user output
100000 100000
1 50000
499530532
2 50000
499176370
...

Test 41

Verdict: ACCEPTED

input
100000 180000
999994001 999991970 999991811 ...

correct output
(empty)

user output
100000 180000
1 90000
549258882
2 90000
50126530
...

Test 42

Verdict: ACCEPTED

input
100000 180000
499560736 499555703 499549265 ...

correct output
(empty)

user output
100000 180000
1 90000
48927497
2 90000
548853417
...

Test 43

Verdict: ACCEPTED

input
100000 180000
999996507 999993660 999990414 ...

correct output
(empty)

user output
100000 180000
1 90000
97972596
2 90000
98995321
...

Test 44

Verdict: ACCEPTED

input
100000 200000
999987384 999983480 999981446 ...

correct output
(empty)

user output
100000 200000
1 100000
499647604
2 100000
16029
...

Test 45

Verdict: ACCEPTED

input
100000 200000
500801844 500800718 500792295 ...

correct output
(empty)

user output
100000 200000
1 100000
8183
2 100000
500805123
...

Test 46

Verdict: ACCEPTED

input
100000 200000
999984710 999974756 999965175 ...

correct output
(empty)

user output
100000 200000
1 100000
13769
2 100000
2005
...