QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#378516 | #6394. Turn on the Light | AINgray | AC ✓ | 1ms | 3728kb | C++23 | 4.3kb | 2024-04-06 13:20:21 | 2024-04-06 13:20:22 |
Judging History
answer
// #define NDEBUG
// #pragma GCC optimize(2)
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using ll = long long;
using db = double;
void Main(void);
int main(void)
{
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#if defined(TEXT_IO) and defined(LOCAL) and not defined(ONLINE_JUDGE)
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
#endif
Main();
return 0;
}
/**************************************************/
namespace my
{
#if defined(LOCAL) and not defined(ONLINE_JUDGE)
#include "D:\VScodeFile\LOCAL\debug.h"
#define DBG(x) std::cerr << "! " #x " = " << (x) << std::endl
#else
#define dbg(...) ((void)0)
#define DBG(...) ((void)0)
#endif
#define VE std::vector
#define STR std::string
#define HEAP std::priority_queue
#define PLL std::pair<ll, ll>
#define fi first
#define se second
#define EDL '\n'
#define WS ' '
#define SDP(x) std::fixed << std::setprecision(x)
#define SZ(x) ((ll)x.size())
#define FOR(i, l, r) for (ll i = (l); i <= (r); ++i)
#define ROF(i, r, l) for (ll i = (r); i >= (l); --i)
constexpr int inf = 0x3f3f3f3f;
constexpr long long INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr db EPS = 1.0e-9;
constexpr ll MOD2 = 1e9 + 7;
constexpr ll MOD = 998244353;
constexpr ll SZ2 = 1e3 + 3;
constexpr ll SZ = 2e5 + 5;
}
using namespace my;
namespace fastIO
{
constexpr ll BUF_SZ = 1e5 + 5;
bool IOrun = true;
char NC(void)
{
static char buf[BUF_SZ], *p = buf + BUF_SZ, *ed = buf + BUF_SZ;
if (p != ed)
return *p++;
p = buf;
ed = buf + fread(buf, 1, BUF_SZ, stdin);
if (p == ed)
{
IOrun = false;
return -1;
}
return *p++;
}
bool BLK(char c) { return c == WS or c == EDL or c == '\r' or c == '\t'; }
template <class T>
bool FIN(T &x)
{
bool sign = false;
char c = NC();
x = 0;
while (BLK(c))
c = NC();
if (not IOrun)
return false;
if (c == '-')
{
sign = true;
c = NC();
}
while ('0' <= c and c <= '9')
{
x = x * 10 + c - '0';
c = NC();
}
if (sign)
x = -x;
return true;
}
bool FIN(db &x)
{
bool sign = false;
char c = NC();
x = 0;
while (BLK(c))
c = NC();
if (not IOrun)
return false;
if (c == '-')
{
sign = true;
c = NC();
}
while ('0' <= c and c <= '9')
{
x = x * 10 + c - '0';
c = NC();
}
if (c == '.')
{
db w = 1.0;
c = NC();
while ('0' <= c and c <= '9')
{
w /= 10.0;
x += w * (c - '0');
c = NC();
}
}
if (sign)
x = -x;
return true;
}
bool FIN(char &c)
{
c = NC();
while (BLK(c))
c = NC();
if (not IOrun)
{
c = -1;
return false;
}
return true;
}
bool FIN(char *s)
{
char c = NC();
while (BLK(c))
c = NC();
if (not IOrun)
return false;
while (IOrun and not BLK(c))
{
*s++ = c;
c = NC();
}
*s = 0;
return true;
}
bool LIN(char *s)
{
char c = NC();
while (BLK(c))
c = NC();
if (not IOrun)
return false;
while (IOrun and c != EDL)
{
*s++ = c;
c = NC();
}
*s = 0;
return true;
}
template <class T, class... Y>
bool FIN(T &x, Y &...o) { return FIN(x) and FIN(o...); }
void FIN(ll *a, ll l, ll r)
{
FOR(i, l, r)
FIN(a[i]);
return;
}
void FIN(db *a, ll l, ll r)
{
FOR(i, l, r)
FIN(a[i]);
return;
}
void FIN(char *a, ll l, ll r)
{
FOR(i, l, r)
FIN(a[i]);
return;
}
}
using fastIO::FIN;
using fastIO::LIN;
/**************************************************/
ll Qry(ll x)
{
cout << "? " << x << std::endl;
cout.flush();
ll res;
cin >> res;
return res;
}
void Ans(ll x)
{
cout << "! " << x << std::endl;
cout.flush();
return;
}
void Main(void)
{
ll n;
cin >> n;
ll l = 1, r = n, aim = 0;
while (l <= r)
{
if (aim == 0)
{
ll res1 = Qry(l);
if (res1 == 0)
{
Ans(l);
return;
}
if (l + 1 == r)
{
ll res2 = Qry(r);
if (res2 == res1)
{
Ans(r);
return;
}
else
{
Ans(l);
return;
}
}
l = l + 1;
aim = res1;
}
ll m = (l + r) >> 1;
ll res = Qry(m);
if (res == aim)
{
Ans(m);
return;
}
else if (res > aim)
{
l = m + 1;
}
else
r = m - 1;
aim = res;
}
return;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3600kb
input:
3 1 2 2
output:
? 1 ? 2 ? 3 ! 3
result:
ok Correct position at 3
Test #2:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
10 1 0 1 0 0
output:
? 1 ? 6 ? 2 ? 4 ? 3 ! 3
result:
ok Correct position at 3
Test #3:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
9 1 2 3 3
output:
? 1 ? 5 ? 7 ? 8 ! 8
result:
ok Correct position at 8
Test #4:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
8 1 0 1 1
output:
? 1 ? 5 ? 2 ? 3 ! 3
result:
ok Correct position at 3
Test #5:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
7 1 2 3 3
output:
? 1 ? 4 ? 6 ? 7 ! 7
result:
ok Correct position at 7
Test #6:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
6 1 0 1 1
output:
? 1 ? 4 ? 2 ? 3 ! 3
result:
ok Correct position at 3
Test #7:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
5 1 2 3 3
output:
? 1 ? 3 ? 4 ? 5 ! 5
result:
ok Correct position at 5
Test #8:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
4 1 1
output:
? 1 ? 3 ! 3
result:
ok Correct position at 3
Test #9:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
3 1 1
output:
? 1 ? 2 ! 2
result:
ok Correct position at 2
Test #10:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
2 1 1
output:
? 1 ? 2 ! 2
result:
ok Correct position at 2
Test #11:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
1 0
output:
? 1 ! 1
result:
ok Correct position at 1
Test #12:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
1000000 1 0 1 2 3 2 1 0 1 2 1 0 1 2 1 2 3 4 5 6 5 4 4
output:
? 1 ? 500001 ? 2 ? 250001 ? 375001 ? 437501 ? 406251 ? 390626 ? 375002 ? 382814 ? 386720 ? 384767 ? 382815 ? 383791 ? 384279 ? 384035 ? 384157 ? 384218 ? 384248 ? 384263 ? 384271 ? 384267 ? 384265 ! 384265
result:
ok Correct position at 384265
Test #13:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
999999 1 2 3 2 3 2 1 2 3 4 3 4 5 6 7 8 9 10 11 12 12
output:
? 1 ? 500000 ? 750000 ? 875000 ? 812500 ? 843750 ? 828125 ? 820312 ? 824218 ? 826171 ? 827148 ? 826659 ? 826903 ? 827025 ? 827086 ? 827117 ? 827132 ? 827140 ? 827144 ? 827146 ? 827147 ! 827147
result:
ok Correct position at 827147
Test #14:
score: 0
Accepted
time: 1ms
memory: 3724kb
input:
999998 1 0 1 0 1 0 1 0 1 2 3 4 5 6 5 6 7 8 9 8 9 8 9 8 8
output:
? 1 ? 500000 ? 2 ? 250001 ? 3 ? 125002 ? 4 ? 62503 ? 5 ? 31254 ? 46878 ? 54690 ? 58596 ? 60549 ? 61526 ? 61037 ? 61281 ? 61403 ? 61464 ? 61495 ? 61479 ? 61487 ? 61483 ? 61485 ? 61484 ! 61484
result:
ok Correct position at 61484
Test #15:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
999997 1 2 3 2 3 2 1 2 3 4 3 4 5 6 7 8 9 10 11 12 12
output:
? 1 ? 499999 ? 749998 ? 874998 ? 812498 ? 843748 ? 828123 ? 820310 ? 824216 ? 826169 ? 827146 ? 826657 ? 826901 ? 827023 ? 827084 ? 827115 ? 827130 ? 827138 ? 827142 ? 827144 ? 827145 ! 827145
result:
ok Correct position at 827145
Test #16:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
999996 1 0 1 2 3 2 1 0 1 2 1 0 1 2 1 2 3 4 5 6 5 4 4
output:
? 1 ? 499999 ? 2 ? 250000 ? 374999 ? 437499 ? 406249 ? 390624 ? 375000 ? 382812 ? 386718 ? 384765 ? 382813 ? 383789 ? 384277 ? 384033 ? 384155 ? 384216 ? 384246 ? 384261 ? 384269 ? 384265 ? 384263 ! 384263
result:
ok Correct position at 384263
Test #17:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
999995 1 2 3 4 5 4 3 4 5 6 5 6 7 8 9 10 11 12 13 14 14
output:
? 1 ? 499998 ? 749997 ? 874996 ? 937496 ? 968746 ? 953121 ? 945308 ? 949214 ? 951167 ? 952144 ? 951655 ? 951899 ? 952021 ? 952082 ? 952113 ? 952128 ? 952136 ? 952140 ? 952142 ? 952143 ! 952143
result:
ok Correct position at 952143
Test #18:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
999994 1 0 1 0 1 2 3 2 1 2 3 4 5 6 7 8 9 10 11 10 9 10 10
output:
? 1 ? 499998 ? 2 ? 250000 ? 3 ? 125001 ? 187500 ? 218750 ? 203125 ? 195312 ? 199218 ? 201171 ? 202148 ? 202636 ? 202880 ? 203002 ? 203063 ? 203094 ? 203109 ? 203117 ? 203113 ? 203111 ? 203112 ! 203112
result:
ok Correct position at 203112
Test #19:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
999993 1 2 3 4 5 4 3 4 5 6 5 6 7 8 9 10 11 12 13 14 14
output:
? 1 ? 499997 ? 749995 ? 874994 ? 937494 ? 968744 ? 953119 ? 945306 ? 949212 ? 951165 ? 952142 ? 951653 ? 951897 ? 952019 ? 952080 ? 952111 ? 952126 ? 952134 ? 952138 ? 952140 ? 952141 ! 952141
result:
ok Correct position at 952141
Test #20:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
999992 1 0 1 2 3 4 3 2 3 4 5 4 5 6 7 8 9 10 11 10 11 11
output:
? 1 ? 499997 ? 2 ? 249999 ? 374998 ? 437497 ? 468747 ? 453122 ? 445309 ? 449215 ? 451168 ? 452145 ? 451656 ? 451900 ? 452022 ? 452083 ? 452114 ? 452129 ? 452137 ? 452141 ? 452139 ? 452140 ! 452140
result:
ok Correct position at 452140
Test #21:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
999991 1 2 3 2 3 2 1 2 3 4 3 4 5 6 7 8 9 10 11 12 12
output:
? 1 ? 499996 ? 749994 ? 874993 ? 812493 ? 843743 ? 828118 ? 820305 ? 824211 ? 826164 ? 827141 ? 826652 ? 826896 ? 827018 ? 827079 ? 827110 ? 827125 ? 827133 ? 827137 ? 827139 ? 827140 ! 827140
result:
ok Correct position at 827140
Test #22:
score: 0
Accepted
time: 1ms
memory: 3728kb
input:
1000000 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2 3 4 5 5
output:
? 1 ? 500001 ? 2 ? 250001 ? 3 ? 125002 ? 4 ? 62503 ? 5 ? 31254 ? 6 ? 15630 ? 7 ? 7818 ? 8 ? 3913 ? 9 ? 1961 ? 10 ? 985 ? 11 ? 498 ? 12 ? 255 ? 13 ? 134 ? 14 ? 74 ? 15 ? 44 ? 16 ? 30 ? 37 ? 40 ? 42 ? 43 ! 43
result:
ok Correct position at 43
Test #23:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
999999 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2 1 1
output:
? 1 ? 500000 ? 2 ? 250001 ? 3 ? 125002 ? 4 ? 62503 ? 5 ? 31254 ? 6 ? 15630 ? 7 ? 7818 ? 8 ? 3913 ? 9 ? 1961 ? 10 ? 985 ? 11 ? 498 ? 12 ? 255 ? 13 ? 134 ? 14 ? 74 ? 15 ? 44 ? 59 ? 51 ! 51
result:
ok Correct position at 51
Test #24:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
999998 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2 1 1
output:
? 1 ? 500000 ? 2 ? 250001 ? 3 ? 125002 ? 4 ? 62503 ? 5 ? 31254 ? 6 ? 15630 ? 7 ? 7818 ? 8 ? 3913 ? 9 ? 1961 ? 10 ? 985 ? 11 ? 498 ? 12 ? 255 ? 13 ? 134 ? 14 ? 74 ? 15 ? 44 ? 59 ? 51 ! 51
result:
ok Correct position at 51
Test #25:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
999997 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2 1 1
output:
? 1 ? 499999 ? 2 ? 250000 ? 3 ? 125001 ? 4 ? 62502 ? 5 ? 31253 ? 6 ? 15629 ? 7 ? 7818 ? 8 ? 3913 ? 9 ? 1961 ? 10 ? 985 ? 11 ? 498 ? 12 ? 255 ? 13 ? 134 ? 14 ? 74 ? 15 ? 44 ? 59 ? 51 ! 51
result:
ok Correct position at 51
Test #26:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
1000000 1 2 3 4 5 6 7 8 9 10 11 12 13 12 11 10 11 12 11 12 12
output:
? 1 ? 500001 ? 750001 ? 875001 ? 937501 ? 968751 ? 984376 ? 992188 ? 996094 ? 998047 ? 999024 ? 999512 ? 999756 ? 999878 ? 999817 ? 999786 ? 999771 ? 999778 ? 999782 ? 999780 ? 999781 ! 999781
result:
ok Correct position at 999781
Test #27:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
999999 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 15 16 16
output:
? 1 ? 500000 ? 750000 ? 875000 ? 937500 ? 968750 ? 984375 ? 992187 ? 996093 ? 998046 ? 999023 ? 999511 ? 999755 ? 999877 ? 999938 ? 999969 ? 999984 ? 999976 ? 999980 ! 999980
result:
ok Correct position at 999980
Test #28:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
999998 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 15 16 16
output:
? 1 ? 500000 ? 749999 ? 874999 ? 937499 ? 968749 ? 984374 ? 992186 ? 996092 ? 998045 ? 999022 ? 999510 ? 999754 ? 999876 ? 999937 ? 999968 ? 999983 ? 999975 ? 999979 ! 999979
result:
ok Correct position at 999979
Test #29:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
999997 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 15 16 16
output:
? 1 ? 499999 ? 749998 ? 874998 ? 937498 ? 968748 ? 984373 ? 992185 ? 996091 ? 998044 ? 999021 ? 999509 ? 999753 ? 999875 ? 999936 ? 999967 ? 999982 ? 999974 ? 999978 ! 999978
result:
ok Correct position at 999978
Test #30:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
1000000 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 13 12 13 12 11 11
output:
? 1 ? 500001 ? 2 ? 250001 ? 375001 ? 437501 ? 468751 ? 484376 ? 492188 ? 496094 ? 498047 ? 499024 ? 499512 ? 499756 ? 499878 ? 499939 ? 499970 ? 499954 ? 499946 ? 499950 ? 499948 ? 499947 ! 499947
result:
ok Correct position at 499947
Test #31:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
999999 1 2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2 3 4 5 6 6
output:
? 1 ? 500000 ? 750000 ? 625000 ? 500001 ? 562500 ? 500002 ? 531251 ? 500003 ? 515627 ? 500004 ? 507815 ? 500005 ? 503910 ? 500006 ? 501958 ? 500007 ? 500982 ? 500008 ? 500495 ? 500009 ? 500252 ? 500010 ? 500131 ? 500011 ? 500071 ? 500012 ? 500041 ? 500056 ? 500063 ? 500067 ? 500069 ? 500070 ! 500070
result:
ok Correct position at 500070
Test #32:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
999998 1 2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2 1 0 1 0 1 1
output:
? 1 ? 500000 ? 749999 ? 624999 ? 500001 ? 562500 ? 500002 ? 531251 ? 500003 ? 515627 ? 500004 ? 507815 ? 500005 ? 503910 ? 500006 ? 501958 ? 500007 ? 500982 ? 500008 ? 500495 ? 500009 ? 500252 ? 500010 ? 500131 ? 500011 ? 500071 ? 500101 ? 500086 ? 500072 ? 500079 ? 500073 ? 500076 ! 500076
result:
ok Correct position at 500076
Test #33:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
999997 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 13 14 15 16 15 15
output:
? 1 ? 499999 ? 2 ? 250000 ? 374999 ? 437499 ? 468749 ? 484374 ? 492186 ? 496092 ? 498045 ? 499022 ? 499510 ? 499754 ? 499876 ? 499937 ? 499968 ? 499952 ? 499960 ? 499964 ? 499966 ? 499965 ! 499965
result:
ok Correct position at 499965
Test #34:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
1000000 1 0 1 2 1 0 1 2 1 2 3 4 3 4 5 6 7 6 7 6 5 4 4
output:
? 1 ? 500001 ? 2 ? 250001 ? 375001 ? 312501 ? 250002 ? 281251 ? 296876 ? 289063 ? 292969 ? 294922 ? 295899 ? 295410 ? 295654 ? 295776 ? 295837 ? 295868 ? 295852 ? 295860 ? 295856 ? 295854 ? 295853 ! 295853
result:
ok Correct position at 295853
Test #35:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
999999 1 2 1 0 1 2 1 0 1 0 1 2 1 2 3 4 5 6 5 6 5 4 3 3
output:
? 1 ? 500000 ? 750000 ? 625000 ? 500001 ? 562500 ? 593750 ? 578125 ? 562501 ? 570313 ? 562502 ? 566407 ? 568360 ? 567383 ? 567871 ? 568115 ? 568237 ? 568298 ? 568329 ? 568313 ? 568321 ? 568317 ? 568315 ? 568314 ! 568314
result:
ok Correct position at 568314
Test #36:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
999998 1 0 1 0 1 0 1 0 1 0 1 0 1 2 1 0 1 0 1 2 1 0 1 2 3 4 3 2 1 1
output:
? 1 ? 500000 ? 2 ? 250001 ? 3 ? 125002 ? 4 ? 62503 ? 5 ? 31254 ? 6 ? 15630 ? 7 ? 7818 ? 11724 ? 9771 ? 7819 ? 8795 ? 7820 ? 8307 ? 8551 ? 8429 ? 8308 ? 8368 ? 8398 ? 8413 ? 8421 ? 8417 ? 8415 ? 8414 ! 8414
result:
ok Correct position at 8414
Test #37:
score: 0
Accepted
time: 1ms
memory: 3728kb
input:
999997 1 2 3 2 1 0 1 2 3 4 5 4 5 6 7 8 7 8 7 6 5 5
output:
? 1 ? 499999 ? 749998 ? 874998 ? 812498 ? 781248 ? 749999 ? 765623 ? 773435 ? 777341 ? 779294 ? 780271 ? 779782 ? 780026 ? 780148 ? 780209 ? 780240 ? 780224 ? 780232 ? 780228 ? 780226 ? 780225 ! 780225
result:
ok Correct position at 780225
Test #38:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
1000000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 20
output:
? 1 ? 500001 ? 750001 ? 875001 ? 937501 ? 968751 ? 984376 ? 992188 ? 996094 ? 998047 ? 999024 ? 999512 ? 999756 ? 999878 ? 999939 ? 999970 ? 999985 ? 999993 ? 999997 ? 999999 ? 1000000 ! 1000000
result:
ok Correct position at 1000000
Test #39:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
999999 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 20
output:
? 1 ? 500000 ? 750000 ? 875000 ? 937500 ? 968750 ? 984375 ? 992187 ? 996093 ? 998046 ? 999023 ? 999511 ? 999755 ? 999877 ? 999938 ? 999969 ? 999984 ? 999992 ? 999996 ? 999998 ? 999999 ! 999999
result:
ok Correct position at 999999
Test #40:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
999998 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 20
output:
? 1 ? 500000 ? 749999 ? 874999 ? 937499 ? 968749 ? 984374 ? 992186 ? 996092 ? 998045 ? 999022 ? 999510 ? 999754 ? 999876 ? 999937 ? 999968 ? 999983 ? 999991 ? 999995 ? 999997 ? 999998 ! 999998
result:
ok Correct position at 999998
Test #41:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
999997 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 20
output:
? 1 ? 499999 ? 749998 ? 874998 ? 937498 ? 968748 ? 984373 ? 992185 ? 996091 ? 998044 ? 999021 ? 999509 ? 999753 ? 999875 ? 999936 ? 999967 ? 999982 ? 999990 ? 999994 ? 999996 ? 999997 ! 999997
result:
ok Correct position at 999997
Test #42:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
1000000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 20
output:
? 1 ? 500001 ? 750001 ? 875001 ? 937501 ? 968751 ? 984376 ? 992188 ? 996094 ? 998047 ? 999024 ? 999512 ? 999756 ? 999878 ? 999939 ? 999970 ? 999985 ? 999993 ? 999997 ? 999999 ? 1000000 ! 1000000
result:
ok Correct position at 1000000
Test #43:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
1000000 0
output:
? 1 ! 1
result:
ok Correct position at 1