QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#548372 | #6394. Turn on the Light | pandapythoner# | AC ✓ | 1ms | 3716kb | C++23 | 2.0kb | 2024-09-05 17:38:52 | 2024-09-05 17:38:52 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define len(a) int((a).size())
#define all(a) begin(a), end(a)
#define rep(i, n) for (int i = 0; i < (n); i++)
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
#ifdef LOCAL
int x = rand() % n;
cerr << "x=" << x << endl;
int cur_ans_ = 0;
set<int> was;
#endif
auto query = [&](int pos) {
cout << "? " << pos + 1 << endl;
#ifdef LOCAL
assert(was.insert(pos).second);
if (pos < x) {
cur_ans_++;
} else if (pos > x) {
cur_ans_--;
}
return abs(cur_ans_);
#else
int res;
cin >> res;
return res;
#endif
};
int q0 = query(0);
if (q0 == 0) {
cout << "! 1" << endl;
return 0;
}
int q1 = query(1);
if (q1 == q0) {
cout << "! 2" << endl;
return 0;
}
assert(q1 == 2);
int l = 2, r = n;
while (r - l > 1) {
int mid = (l + r) / 2;
int cur = query(mid);
if (cur == 2) {
cout << "! " << mid + 1 << endl;
#ifdef LOCAL
assert(mid == x);
#endif
return 0;
}
// cerr << "[" << l << ", " << r << "]: " << mid << endl;
assert(r - l > 1);
if (cur == 1) {
r = mid;
if (r - l == 1) break;
int tmp = query(l);
if (tmp == 1) {
cout << "! " << l + 1 << endl;
return 0;
}
assert(tmp == 2);
l++;
} else {
assert(cur == 3);
l = mid + 1;
if (r - l == 1) break;
int tmp = query(r - 1);
if (tmp == 3) {
cout << "! " << r << endl;
return 0;
}
assert(tmp == 2);
r--;
}
}
cout << "! " << r << endl;
#ifdef LOCAL
assert(l == x);
#endif
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3660kb
input:
3 1 2
output:
? 1 ? 2 ! 3
result:
ok Correct position at 3
Test #2:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
10 1 2 1 2 1
output:
? 1 ? 2 ? 7 ? 3 ? 5 ! 4
result:
ok Correct position at 4
Test #3:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
9 1 2 3 2 2
output:
? 1 ? 2 ? 6 ? 9 ? 8 ! 8
result:
ok Correct position at 8
Test #4:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
8 1 2 1 2 2
output:
? 1 ? 2 ? 6 ? 3 ? 5 ! 5
result:
ok Correct position at 5
Test #5:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
7 1 2 3 2
output:
? 1 ? 2 ? 5 ? 7 ! 6
result:
ok Correct position at 6
Test #6:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
6 1 2 1 1
output:
? 1 ? 2 ? 5 ? 3 ! 3
result:
ok Correct position at 3
Test #7:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
5 1 2 3
output:
? 1 ? 2 ? 4 ! 5
result:
ok Correct position at 5
Test #8:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
4 1 2 2
output:
? 1 ? 2 ? 4 ! 4
result:
ok Correct position at 4
Test #9:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
3 1 1
output:
? 1 ? 2 ! 2
result:
ok Correct position at 2
Test #10:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
2 1 1
output:
? 1 ? 2 ! 2
result:
ok Correct position at 2
Test #11:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
1 0
output:
? 1 ! 1
result:
ok Correct position at 1
Test #12:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
1000000 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2
output:
? 1 ? 2 ? 500002 ? 3 ? 250003 ? 4 ? 125004 ? 5 ? 62505 ? 6 ? 31256 ? 7 ? 15632 ? 8 ? 7820 ? 9 ? 3915 ? 10 ? 1963 ? 11 ? 987 ? 12 ? 500 ? 13 ? 257 ? 14 ? 136 ? 15 ? 76 ? 16 ? 46 ? 75 ? 61 ? 47 ? 54 ? 48 ? 51 ? 49 ! 50
result:
ok Correct position at 50
Test #13:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
999999 1 2 3 2 3 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2
output:
? 1 ? 2 ? 500001 ? 999999 ? 750000 ? 999998 ? 874999 ? 750001 ? 812500 ? 750002 ? 781251 ? 750003 ? 765627 ? 781250 ? 773439 ? 765628 ? 769534 ? 765629 ? 767582 ? 765630 ? 766606 ? 765631 ? 766119 ? 765632 ? 765876 ? 765633 ? 765755 ? 765634 ? 765695 ? 765635 ? 765665 ? 765694 ? 765680 ? 765666 ? 76...
result:
ok Correct position at 765669
Test #14:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
999998 1 2 1 2 3 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2
output:
? 1 ? 2 ? 500001 ? 3 ? 250002 ? 500000 ? 375001 ? 250003 ? 312502 ? 250004 ? 281253 ? 250005 ? 265629 ? 281252 ? 273441 ? 265630 ? 269536 ? 265631 ? 267584 ? 265632 ? 266608 ? 265633 ? 266121 ? 265634 ? 265878 ? 265635 ? 265757 ? 265636 ? 265697 ? 265637 ? 265667 ? 265696 ? 265682 ? 265668 ? 265675 ...
result:
ok Correct position at 265671
Test #15:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
999997 1 2 3 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2
output:
? 1 ? 2 ? 500000 ? 999997 ? 749999 ? 500001 ? 625000 ? 500002 ? 562501 ? 500003 ? 531252 ? 500004 ? 515628 ? 531251 ? 523440 ? 515629 ? 519535 ? 515630 ? 517583 ? 515631 ? 516607 ? 515632 ? 516120 ? 515633 ? 515877 ? 515634 ? 515756 ? 515635 ? 515696 ? 515636 ? 515666 ? 515695 ? 515681 ? 515667 ? 51...
result:
ok Correct position at 515670
Test #16:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
999996 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2
output:
? 1 ? 2 ? 500000 ? 3 ? 250002 ? 4 ? 125003 ? 5 ? 62504 ? 6 ? 31255 ? 7 ? 15631 ? 31254 ? 23443 ? 15632 ? 19538 ? 15633 ? 17586 ? 15634 ? 16610 ? 15635 ? 16123 ? 15636 ? 15880 ? 15637 ? 15759 ? 15638 ? 15699 ? 15639 ? 15669 ? 15698 ? 15684 ? 15670 ? 15677 ? 15671 ? 15674 ? 15672 ! 15673
result:
ok Correct position at 15673
Test #17:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
999995 1 2 3 2 3 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2
output:
? 1 ? 2 ? 499999 ? 999995 ? 749997 ? 999994 ? 874996 ? 749998 ? 812497 ? 749999 ? 781248 ? 750000 ? 765624 ? 781247 ? 773436 ? 765625 ? 769531 ? 765626 ? 767579 ? 765627 ? 766603 ? 765628 ? 766116 ? 765629 ? 765873 ? 765630 ? 765752 ? 765631 ? 765692 ? 765632 ? 765662 ? 765691 ? 765677 ? 765663 ? 76...
result:
ok Correct position at 765666
Test #18:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
999994 1 2 1 2 3 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2
output:
? 1 ? 2 ? 499999 ? 3 ? 250001 ? 499998 ? 375000 ? 250002 ? 312501 ? 250003 ? 281252 ? 250004 ? 265628 ? 281251 ? 273440 ? 265629 ? 269535 ? 265630 ? 267583 ? 265631 ? 266607 ? 265632 ? 266120 ? 265633 ? 265877 ? 265634 ? 265756 ? 265635 ? 265696 ? 265636 ? 265666 ? 265695 ? 265681 ? 265667 ? 265674 ...
result:
ok Correct position at 265670
Test #19:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
999993 1 2 3 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2
output:
? 1 ? 2 ? 499998 ? 999993 ? 749996 ? 499999 ? 624998 ? 500000 ? 562499 ? 500001 ? 531250 ? 500002 ? 515626 ? 531249 ? 523438 ? 515627 ? 519533 ? 515628 ? 517581 ? 515629 ? 516605 ? 515630 ? 516118 ? 515631 ? 515875 ? 515632 ? 515754 ? 515633 ? 515694 ? 515634 ? 515664 ? 515693 ? 515679 ? 515665 ? 51...
result:
ok Correct position at 515668
Test #20:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
999992 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2
output:
? 1 ? 2 ? 499998 ? 3 ? 250001 ? 4 ? 125003 ? 5 ? 62504 ? 6 ? 31255 ? 7 ? 15631 ? 31254 ? 23443 ? 15632 ? 19538 ? 15633 ? 17586 ? 15634 ? 16610 ? 15635 ? 16123 ? 15636 ? 15880 ? 15637 ? 15759 ? 15638 ? 15699 ? 15639 ? 15669 ? 15698 ? 15684 ? 15670 ? 15677 ? 15671 ? 15674 ? 15672 ! 15673
result:
ok Correct position at 15673
Test #21:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
999991 1 2 3 2 3 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2
output:
? 1 ? 2 ? 499997 ? 999991 ? 749994 ? 999990 ? 874992 ? 749995 ? 812494 ? 749996 ? 781245 ? 749997 ? 765621 ? 781244 ? 773433 ? 765622 ? 769528 ? 765623 ? 767576 ? 765624 ? 766600 ? 765625 ? 766113 ? 765626 ? 765870 ? 765627 ? 765749 ? 765628 ? 765689 ? 765629 ? 765659 ? 765688 ? 765674 ? 765660 ? 76...
result:
ok Correct position at 765663
Test #22:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
1000000 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 3 2 3
output:
? 1 ? 2 ? 500002 ? 3 ? 250003 ? 4 ? 125004 ? 5 ? 62505 ? 6 ? 31256 ? 7 ? 15632 ? 8 ? 7820 ? 9 ? 3915 ? 10 ? 1963 ? 11 ? 987 ? 12 ? 500 ? 13 ? 257 ? 14 ? 136 ? 15 ? 76 ? 16 ? 46 ? 17 ? 32 ? 45 ? 39 ? 44 ? 42 ! 43
result:
ok Correct position at 43
Test #23:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
999999 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 2
output:
? 1 ? 2 ? 500001 ? 3 ? 250002 ? 4 ? 125003 ? 5 ? 62504 ? 6 ? 31255 ? 7 ? 15631 ? 8 ? 7820 ? 9 ? 3915 ? 10 ? 1963 ? 11 ? 987 ? 12 ? 500 ? 13 ? 257 ? 14 ? 136 ? 15 ? 76 ? 16 ? 46 ? 75 ? 61 ? 47 ? 54 ? 48 ? 51 ! 51
result:
ok Correct position at 51
Test #24:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
999998 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 2
output:
? 1 ? 2 ? 500001 ? 3 ? 250002 ? 4 ? 125003 ? 5 ? 62504 ? 6 ? 31255 ? 7 ? 15631 ? 8 ? 7820 ? 9 ? 3915 ? 10 ? 1963 ? 11 ? 987 ? 12 ? 500 ? 13 ? 257 ? 14 ? 136 ? 15 ? 76 ? 16 ? 46 ? 75 ? 61 ? 47 ? 54 ? 48 ? 51 ! 51
result:
ok Correct position at 51
Test #25:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
999997 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 2
output:
? 1 ? 2 ? 500000 ? 3 ? 250002 ? 4 ? 125003 ? 5 ? 62504 ? 6 ? 31255 ? 7 ? 15631 ? 8 ? 7820 ? 9 ? 3915 ? 10 ? 1963 ? 11 ? 987 ? 12 ? 500 ? 13 ? 257 ? 14 ? 136 ? 15 ? 76 ? 16 ? 46 ? 75 ? 61 ? 47 ? 54 ? 48 ? 51 ! 51
result:
ok Correct position at 51
Test #26:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
1000000 1 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 1 2 1 2 3 2 1 2 1 1
output:
? 1 ? 2 ? 500002 ? 1000000 ? 750001 ? 999999 ? 875000 ? 999998 ? 937499 ? 999997 ? 968748 ? 999996 ? 984372 ? 999995 ? 992184 ? 999994 ? 996089 ? 999993 ? 998041 ? 999992 ? 999017 ? 999991 ? 999504 ? 999990 ? 999747 ? 999989 ? 999868 ? 999748 ? 999808 ? 999749 ? 999779 ? 999807 ? 999793 ? 999780 ? 9...
result:
ok Correct position at 999781
Test #27:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
999999 1 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 1 2
output:
? 1 ? 2 ? 500001 ? 999999 ? 750000 ? 999998 ? 874999 ? 999997 ? 937498 ? 999996 ? 968747 ? 999995 ? 984371 ? 999994 ? 992183 ? 999993 ? 996088 ? 999992 ? 998040 ? 999991 ? 999016 ? 999990 ? 999503 ? 999989 ? 999746 ? 999988 ? 999867 ? 999987 ? 999927 ? 999986 ? 999957 ? 999985 ? 999971 ? 999984 ? 99...
result:
ok Correct position at 999980
Test #28:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
999998 1 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 1 2
output:
? 1 ? 2 ? 500001 ? 999998 ? 750000 ? 999997 ? 874999 ? 999996 ? 937498 ? 999995 ? 968747 ? 999994 ? 984371 ? 999993 ? 992182 ? 999992 ? 996087 ? 999991 ? 998039 ? 999990 ? 999015 ? 999989 ? 999502 ? 999988 ? 999745 ? 999987 ? 999866 ? 999986 ? 999926 ? 999985 ? 999956 ? 999984 ? 999970 ? 999983 ? 99...
result:
ok Correct position at 999979
Test #29:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
999997 1 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 1 2
output:
? 1 ? 2 ? 500000 ? 999997 ? 749999 ? 999996 ? 874998 ? 999995 ? 937497 ? 999994 ? 968746 ? 999993 ? 984370 ? 999992 ? 992181 ? 999991 ? 996086 ? 999990 ? 998038 ? 999989 ? 999014 ? 999988 ? 999501 ? 999987 ? 999744 ? 999986 ? 999865 ? 999985 ? 999925 ? 999984 ? 999955 ? 999983 ? 999969 ? 999982 ? 99...
result:
ok Correct position at 999978
Test #30:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
1000000 1 2 1 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 1 2 3 2 1 1
output:
? 1 ? 2 ? 500002 ? 3 ? 250003 ? 500001 ? 375002 ? 500000 ? 437501 ? 499999 ? 468750 ? 499998 ? 484374 ? 499997 ? 492186 ? 499996 ? 496091 ? 499995 ? 498043 ? 499994 ? 499019 ? 499993 ? 499506 ? 499992 ? 499749 ? 499991 ? 499870 ? 499990 ? 499930 ? 499989 ? 499960 ? 499931 ? 499946 ? 499959 ? 499953 ...
result:
ok Correct position at 499947
Test #31:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
999999 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 3 2 3 2 3
output:
? 1 ? 2 ? 500001 ? 999999 ? 750000 ? 500002 ? 625001 ? 500003 ? 562502 ? 500004 ? 531253 ? 500005 ? 515629 ? 500006 ? 507818 ? 500007 ? 503913 ? 500008 ? 501961 ? 500009 ? 500985 ? 500010 ? 500498 ? 500011 ? 500255 ? 500012 ? 500134 ? 500013 ? 500074 ? 500014 ? 500044 ? 500073 ? 500059 ? 500072 ? 50...
result:
ok Correct position at 500070
Test #32:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
999998 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 1
output:
? 1 ? 2 ? 500001 ? 999998 ? 750000 ? 500002 ? 625001 ? 500003 ? 562502 ? 500004 ? 531253 ? 500005 ? 515629 ? 500006 ? 507818 ? 500007 ? 503913 ? 500008 ? 501961 ? 500009 ? 500985 ? 500010 ? 500498 ? 500011 ? 500255 ? 500012 ? 500134 ? 500013 ? 500074 ? 500133 ? 500104 ? 500075 ? 500090 ? 500076 ! 50...
result:
ok Correct position at 500076
Test #33:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
999997 1 2 1 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 1 2 1 2 3 3
output:
? 1 ? 2 ? 500000 ? 3 ? 250002 ? 499999 ? 375001 ? 499998 ? 437500 ? 499997 ? 468749 ? 499996 ? 484373 ? 499995 ? 492184 ? 499994 ? 496089 ? 499993 ? 498041 ? 499992 ? 499017 ? 499991 ? 499504 ? 499990 ? 499747 ? 499989 ? 499868 ? 499988 ? 499928 ? 499987 ? 499958 ? 499986 ? 499972 ? 499959 ? 499966 ...
result:
ok Correct position at 499965
Test #34:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
1000000 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1
output:
? 1 ? 2 ? 500002 ? 3 ? 250003 ? 4 ? 125004 ? 5 ? 62505 ? 6 ? 31256 ? 7 ? 15632 ? 8 ? 7820 ? 9 ? 3915 ? 10 ? 1963 ? 11 ? 987 ? 12 ? 500 ? 13 ? 257 ? 14 ? 136 ? 15 ? 76 ? 16 ? 46 ? 17 ? 32 ? 18 ? 25 ? 19 ? 22 ? 20 ! 20
result:
ok Correct position at 20
Test #35:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
999999 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1
output:
? 1 ? 2 ? 500001 ? 3 ? 250002 ? 4 ? 125003 ? 5 ? 62504 ? 6 ? 31255 ? 7 ? 15631 ? 8 ? 7820 ? 9 ? 3915 ? 10 ? 1963 ? 11 ? 987 ? 12 ? 500 ? 13 ? 257 ? 14 ? 136 ? 15 ? 76 ? 16 ? 46 ? 17 ? 32 ? 18 ? 25 ? 19 ? 22 ? 20 ! 20
result:
ok Correct position at 20
Test #36:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
999998 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1
output:
? 1 ? 2 ? 500001 ? 3 ? 250002 ? 4 ? 125003 ? 5 ? 62504 ? 6 ? 31255 ? 7 ? 15631 ? 8 ? 7820 ? 9 ? 3915 ? 10 ? 1963 ? 11 ? 987 ? 12 ? 500 ? 13 ? 257 ? 14 ? 136 ? 15 ? 76 ? 16 ? 46 ? 17 ? 32 ? 18 ? 25 ? 19 ? 22 ? 20 ! 20
result:
ok Correct position at 20
Test #37:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
999997 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1
output:
? 1 ? 2 ? 500000 ? 3 ? 250002 ? 4 ? 125003 ? 5 ? 62504 ? 6 ? 31255 ? 7 ? 15631 ? 8 ? 7820 ? 9 ? 3915 ? 10 ? 1963 ? 11 ? 987 ? 12 ? 500 ? 13 ? 257 ? 14 ? 136 ? 15 ? 76 ? 16 ? 46 ? 17 ? 32 ? 18 ? 25 ? 19 ? 22 ? 20 ! 20
result:
ok Correct position at 20
Test #38:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
1000000 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 3 2 1 2 3 2 3 3
output:
? 1 ? 2 ? 500002 ? 3 ? 250003 ? 4 ? 125004 ? 5 ? 62505 ? 6 ? 31256 ? 7 ? 15632 ? 8 ? 7820 ? 15631 ? 11726 ? 7821 ? 9774 ? 7822 ? 8798 ? 9773 ? 9286 ? 8799 ? 9043 ? 8800 ? 8922 ? 8801 ? 8862 ? 8802 ? 8832 ? 8861 ? 8847 ? 8833 ? 8840 ? 8846 ? 8843 ? 8845 ! 8845
result:
ok Correct position at 8845
Test #39:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
999999 1 2 3 2 3 2 3 2 3 2 3 2 3 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 3 2 1 2 3 2 3 3
output:
? 1 ? 2 ? 500001 ? 999999 ? 750000 ? 999998 ? 874999 ? 999997 ? 937498 ? 999996 ? 968747 ? 999995 ? 984371 ? 999994 ? 992183 ? 984372 ? 988278 ? 984373 ? 986326 ? 984374 ? 985350 ? 986325 ? 985838 ? 985351 ? 985595 ? 985352 ? 985474 ? 985353 ? 985414 ? 985354 ? 985384 ? 985413 ? 985399 ? 985385 ? 98...
result:
ok Correct position at 985397
Test #40:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
999998 1 2 1 2 3 2 3 2 3 2 3 2 3 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 3 2 1 2 3 2 3 3
output:
? 1 ? 2 ? 500001 ? 3 ? 250002 ? 500000 ? 375001 ? 499999 ? 437500 ? 499998 ? 468749 ? 499997 ? 484373 ? 499996 ? 492185 ? 484374 ? 488280 ? 484375 ? 486328 ? 484376 ? 485352 ? 486327 ? 485840 ? 485353 ? 485597 ? 485354 ? 485476 ? 485355 ? 485416 ? 485356 ? 485386 ? 485415 ? 485401 ? 485387 ? 485394 ...
result:
ok Correct position at 485399
Test #41:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
999997 1 2 3 2 1 2 3 2 3 2 3 2 3 2 1 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 3 2 1 2 3 2 3 3
output:
? 1 ? 2 ? 500000 ? 999997 ? 749999 ? 500001 ? 625000 ? 749998 ? 687499 ? 749997 ? 718748 ? 749996 ? 734372 ? 749995 ? 742184 ? 734373 ? 738279 ? 734374 ? 736327 ? 734375 ? 735351 ? 736326 ? 735839 ? 735352 ? 735596 ? 735353 ? 735475 ? 735354 ? 735415 ? 735355 ? 735385 ? 735414 ? 735400 ? 735386 ? 73...
result:
ok Correct position at 735398
Test #42:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
1000000 1 2 3 3
output:
? 1 ? 2 ? 500002 ? 1000000 ! 1000000
result:
ok Correct position at 1000000
Test #43:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
1000000 0
output:
? 1 ! 1
result:
ok Correct position at 1