QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#104814 | #6394. Turn on the Light | maspy | AC ✓ | 5ms | 3476kb | C++20 | 8.6kb | 2023-05-12 00:34:13 | 2023-05-12 00:34:16 |
Judging History
answer
#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;
template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'000'000'000;
template <>
constexpr ll infty<ll> = ll(infty<int>) * infty<int> * 2;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * infty<ll>;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;
using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;
#define vv(type, name, h, ...) \
vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) \
vector<vector<vector<type>>> name( \
h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...) \
vector<vector<vector<vector<type>>>> name( \
a, vector<vector<vector<type>>>( \
b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))
// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)
#define FOR_subset(t, s) \
for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define stoi stoll
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
template <typename T, typename U>
T ceil(T x, U y) {
return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U>
T floor(T x, U y) {
return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T, typename U>
pair<T, T> divmod(T x, U y) {
T q = floor(x, y);
return {q, x - q * y};
}
template <typename T, typename U>
T SUM(const vector<U> &A) {
T sum = 0;
for (auto &&a: A) sum += a;
return sum;
}
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) \
sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()
template <typename T>
T POP(deque<T> &que) {
T a = que.front();
que.pop_front();
return a;
}
template <typename T>
T POP(pq<T> &que) {
T a = que.top();
que.pop();
return a;
}
template <typename T>
T POP(pqg<T> &que) {
assert(!que.empty());
T a = que.top();
que.pop();
return a;
}
template <typename T>
T POP(vc<T> &que) {
assert(!que.empty());
T a = que.back();
que.pop_back();
return a;
}
template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
if (check_ok) assert(check(ok));
while (abs(ok - ng) > 1) {
auto x = (ng + ok) / 2;
tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
}
return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
FOR(iter) {
double x = (ok + ng) / 2;
tie(ok, ng) = (check(x) ? mp(x, ng) : mp(ok, x));
}
return (ok + ng) / 2;
}
template <class T, class S>
inline bool chmax(T &a, const S &b) {
return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
return (a > b ? a = b, 1 : 0);
}
// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
vc<int> A(S.size());
FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
return A;
}
template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
int N = A.size();
vector<T> B(N + 1);
FOR(i, N) { B[i + 1] = B[i] + A[i]; }
if (off == 0) B.erase(B.begin());
return B;
}
// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
vector<int> ids(len(A));
iota(all(ids), 0);
sort(all(ids),
[&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
return ids;
}
// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
vc<T> B(len(I));
FOR(i, len(I)) B[i] = A[I[i]];
return B;
}
#endif
#line 1 "library/other/io2.hpp"
#define INT(...) \
int __VA_ARGS__; \
IN(__VA_ARGS__)
#define LL(...) \
ll __VA_ARGS__; \
IN(__VA_ARGS__)
#define STR(...) \
string __VA_ARGS__; \
IN(__VA_ARGS__)
#define CHR(...) \
char __VA_ARGS__; \
IN(__VA_ARGS__)
#define DBL(...) \
long double __VA_ARGS__; \
IN(__VA_ARGS__)
#define VEC(type, name, size) \
vector<type> name(size); \
read(name)
#define VV(type, name, h, w) \
vector<vector<type>> name(h, vector<type>(w)); \
read(name)
void read(int &a) { cin >> a; }
void read(long long &a) { cin >> a; }
void read(char &a) { cin >> a; }
void read(double &a) { cin >> a; }
void read(long double &a) { cin >> a; }
void read(string &a) { cin >> a; }
template <class T, class S> void read(pair<T, S> &p) { read(p.first), read(p.second); }
template <class T> void read(vector<T> &a) {for(auto &i : a) read(i);}
template <class T> void read(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &...tail) {
read(head);
IN(tail...);
}
template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& A) {
os << A.fi << " " << A.se;
return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& A) {
for (size_t i = 0; i < A.size(); i++) {
if(i) os << " ";
os << A[i];
}
return os;
}
void print() {
cout << "\n";
cout.flush();
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
cout << head;
if (sizeof...(Tail)) cout << " ";
print(forward<Tail>(tail)...);
}
void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"
void solve() {
LL(N);
vc<int> I;
auto ask = [&](int i) -> int {
I.eb(i);
print("?", i);
INT(x);
return x;
};
auto out = [&](int i) -> void { print("!", i); };
ll L = 1, R = N;
while (1) {
if (L == R) return out(L);
int k = ask(L);
if ((k + len(I)) % 2 == 1) return out(L);
++L;
int M = (L + R) / 2;
k = ask(M);
int lo = 0, hi = 0;
for (auto&& i: I) {
if (i < L) ++lo;
if (i > R) ++hi;
}
if (k == abs(lo - hi)) { return out(M); }
if (k == abs(1 + lo - hi)) {
L = M + 1;
} else {
R = M - 1;
}
}
}
signed main() {
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3460kb
input:
3 1 2
output:
? 1 ? 2 ! 3
result:
ok Correct position at 3
Test #2:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
10 1 0 1 0
output:
? 1 ? 6 ? 2 ? 4 ! 3
result:
ok Correct position at 3
Test #3:
score: 0
Accepted
time: 2ms
memory: 3432kb
input:
9 1 2 3 2
output:
? 1 ? 5 ? 6 ? 8 ! 7
result:
ok Correct position at 7
Test #4:
score: 0
Accepted
time: 2ms
memory: 3428kb
input:
8 1 0 1 1
output:
? 1 ? 5 ? 2 ? 3 ! 3
result:
ok Correct position at 3
Test #5:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
7 1 2 3 3
output:
? 1 ? 4 ? 5 ? 6 ! 6
result:
ok Correct position at 6
Test #6:
score: 0
Accepted
time: 1ms
memory: 3368kb
input:
6 1 0 1 1
output:
? 1 ? 4 ? 2 ? 3 ! 3
result:
ok Correct position at 3
Test #7:
score: 0
Accepted
time: 3ms
memory: 3400kb
input:
5 1 2 3 3
output:
? 1 ? 3 ? 4 ? 5 ! 5
result:
ok Correct position at 5
Test #8:
score: 0
Accepted
time: 2ms
memory: 3388kb
input:
4 1 1
output:
? 1 ? 3 ! 3
result:
ok Correct position at 3
Test #9:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
3 1 1
output:
? 1 ? 2 ! 2
result:
ok Correct position at 2
Test #10:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
2 1 1
output:
? 1 ? 2 ! 2
result:
ok Correct position at 2
Test #11:
score: 0
Accepted
time: 2ms
memory: 3372kb
input:
1
output:
! 1
result:
ok Correct position at 1
Test #12:
score: 0
Accepted
time: 4ms
memory: 3432kb
input:
1000000 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 16 17 18 19 20 21 22 23 24 25 26 27 28 29 28 29 30 30
output:
? 1 ? 500001 ? 2 ? 250001 ? 250002 ? 375001 ? 375002 ? 437501 ? 437502 ? 468751 ? 468752 ? 484376 ? 484377 ? 492189 ? 492190 ? 496095 ? 496096 ? 498048 ? 498049 ? 499025 ? 498050 ? 498537 ? 498538 ? 498781 ? 498782 ? 498903 ? 498904 ? 498964 ? 498965 ? 498995 ? 498996 ? 499010 ? 499011 ? 499018 ? 49...
result:
ok Correct position at 499016
Test #13:
score: 0
Accepted
time: 4ms
memory: 3368kb
input:
999999 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 18 19 20 21 22 23 24 25 26 27 28 29 30 31 30 31 32 32
output:
? 1 ? 500000 ? 500001 ? 750000 ? 750001 ? 875000 ? 875001 ? 937500 ? 937501 ? 968750 ? 968751 ? 984375 ? 984376 ? 992188 ? 992189 ? 996094 ? 996095 ? 998047 ? 998048 ? 999024 ? 998049 ? 998536 ? 998537 ? 998780 ? 998781 ? 998902 ? 998903 ? 998963 ? 998964 ? 998994 ? 998995 ? 999009 ? 999010 ? 999017...
result:
ok Correct position at 999015
Test #14:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
999998 1 0 1 0 1 0 1 0 1 2 3 2 3 4 5 6 7 8 9 8 9 10 11 12 13 14 15 16 17 18 19 20 21 20 21 22 22
output:
? 1 ? 500000 ? 2 ? 250001 ? 3 ? 125002 ? 4 ? 62503 ? 5 ? 31254 ? 31255 ? 46879 ? 31256 ? 39067 ? 39068 ? 42973 ? 42974 ? 44926 ? 44927 ? 45903 ? 44928 ? 45415 ? 45416 ? 45659 ? 45660 ? 45781 ? 45782 ? 45842 ? 45843 ? 45873 ? 45874 ? 45888 ? 45889 ? 45896 ? 45890 ? 45893 ? 45894 ! 45894
result:
ok Correct position at 45894
Test #15:
score: 0
Accepted
time: 0ms
memory: 3368kb
input:
999997 1 2 3 2 3 2 3 2 3 4 5 4 5 6 7 8 9 10 11 10 11 12 13 14 15 16 17 18 19 20 21 22 23 22 23 24 24
output:
? 1 ? 499999 ? 500000 ? 749999 ? 500001 ? 625000 ? 500002 ? 562501 ? 500003 ? 531252 ? 531253 ? 546877 ? 531254 ? 539065 ? 539066 ? 542971 ? 542972 ? 544924 ? 544925 ? 545901 ? 544926 ? 545413 ? 545414 ? 545657 ? 545658 ? 545779 ? 545780 ? 545840 ? 545841 ? 545871 ? 545872 ? 545886 ? 545887 ? 545894...
result:
ok Correct position at 545892
Test #16:
score: 0
Accepted
time: 4ms
memory: 3428kb
input:
999996 1 0 1 2 3 2 3 2 3 4 5 4 5 6 7 8 9 10 11 10 11 12 13 14 15 16 17 18 19 20 21 22 23 22 23 24 24
output:
? 1 ? 499999 ? 2 ? 250000 ? 250001 ? 375000 ? 250002 ? 312501 ? 250003 ? 281252 ? 281253 ? 296877 ? 281254 ? 289065 ? 289066 ? 292971 ? 292972 ? 294924 ? 294925 ? 295901 ? 294926 ? 295413 ? 295414 ? 295657 ? 295658 ? 295779 ? 295780 ? 295840 ? 295841 ? 295871 ? 295872 ? 295886 ? 295887 ? 295894 ? 29...
result:
ok Correct position at 295892
Test #17:
score: 0
Accepted
time: 0ms
memory: 3392kb
input:
999995 1 2 3 4 5 4 5 4 5 6 7 6 7 8 9 10 11 12 13 12 13 14 15 16 17 18 19 20 21 22 23 24 25 24 25 26 26
output:
? 1 ? 499998 ? 499999 ? 749997 ? 749998 ? 874997 ? 749999 ? 812498 ? 750000 ? 781249 ? 781250 ? 796874 ? 781251 ? 789062 ? 789063 ? 792968 ? 792969 ? 794921 ? 794922 ? 795898 ? 794923 ? 795410 ? 795411 ? 795654 ? 795655 ? 795776 ? 795777 ? 795837 ? 795838 ? 795868 ? 795869 ? 795883 ? 795884 ? 795891...
result:
ok Correct position at 795889
Test #18:
score: 0
Accepted
time: 2ms
memory: 3468kb
input:
999994 1 0 1 0 1 2 3 2 3 4 5 4 5 6 7 8 9 10 11 10 11 12 13 14 15 16 17 18 19 20 21 22 23 22 23 24 24
output:
? 1 ? 499998 ? 2 ? 250000 ? 3 ? 125001 ? 125002 ? 187501 ? 125003 ? 156252 ? 156253 ? 171877 ? 156254 ? 164065 ? 164066 ? 167971 ? 167972 ? 169924 ? 169925 ? 170901 ? 169926 ? 170413 ? 170414 ? 170657 ? 170658 ? 170779 ? 170780 ? 170840 ? 170841 ? 170871 ? 170872 ? 170886 ? 170887 ? 170894 ? 170888 ...
result:
ok Correct position at 170892
Test #19:
score: 0
Accepted
time: 4ms
memory: 3468kb
input:
999993 1 2 3 2 3 4 5 4 5 6 7 6 7 8 9 10 11 12 13 12 13 14 15 16 17 18 19 20 21 22 23 24 25 24 25 26 26
output:
? 1 ? 499997 ? 499998 ? 749996 ? 499999 ? 624997 ? 624998 ? 687497 ? 624999 ? 656248 ? 656249 ? 671873 ? 656250 ? 664061 ? 664062 ? 667967 ? 667968 ? 669920 ? 669921 ? 670897 ? 669922 ? 670409 ? 670410 ? 670653 ? 670654 ? 670775 ? 670776 ? 670836 ? 670837 ? 670867 ? 670868 ? 670882 ? 670883 ? 670890...
result:
ok Correct position at 670888
Test #20:
score: 0
Accepted
time: 5ms
memory: 3468kb
input:
999992 1 0 1 2 3 4 5 4 5 6 7 6 7 8 9 10 11 12 13 12 13 14 15 16 17 18 19 20 21 22 23 24 25 24 25 26 26
output:
? 1 ? 499997 ? 2 ? 249999 ? 250000 ? 374998 ? 374999 ? 437498 ? 375000 ? 406249 ? 406250 ? 421874 ? 406251 ? 414062 ? 414063 ? 417968 ? 417969 ? 419921 ? 419922 ? 420898 ? 419923 ? 420410 ? 420411 ? 420654 ? 420655 ? 420776 ? 420777 ? 420837 ? 420838 ? 420868 ? 420869 ? 420883 ? 420884 ? 420891 ? 42...
result:
ok Correct position at 420889
Test #21:
score: 0
Accepted
time: 4ms
memory: 3400kb
input:
999991 1 2 3 4 5 6 7 6 7 8 9 8 9 10 11 12 13 14 15 14 15 16 17 18 19 20 21 22 23 24 25 26 27 26 27 28 28
output:
? 1 ? 499996 ? 499997 ? 749994 ? 749995 ? 874993 ? 874994 ? 937493 ? 874995 ? 906244 ? 906245 ? 921869 ? 906246 ? 914057 ? 914058 ? 917963 ? 917964 ? 919916 ? 919917 ? 920893 ? 919918 ? 920405 ? 920406 ? 920649 ? 920650 ? 920771 ? 920772 ? 920832 ? 920833 ? 920863 ? 920864 ? 920878 ? 920879 ? 920886...
result:
ok Correct position at 920884
Test #22:
score: 0
Accepted
time: 3ms
memory: 3468kb
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 6 7 7
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 ? 31 ? 37 ? 38 ? 41 ? 42 ? 43 ! 43
result:
ok Correct position at 43
Test #23:
score: 0
Accepted
time: 1ms
memory: 3368kb
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 3 2 3 2 3 4 5 5
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 ? 45 ? 59 ? 46 ? 52 ? 47 ? 49 ? 50 ? 51 ! 51
result:
ok Correct position at 51
Test #24:
score: 0
Accepted
time: 4ms
memory: 3428kb
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 3 2 3 2 3 4 5 5
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 ? 45 ? 59 ? 46 ? 52 ? 47 ? 49 ? 50 ? 51 ! 51
result:
ok Correct position at 51
Test #25:
score: 0
Accepted
time: 4ms
memory: 3432kb
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 3 2 3 2 3 4 5 5
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 ? 45 ? 59 ? 46 ? 52 ? 47 ? 49 ? 50 ? 51 ! 51
result:
ok Correct position at 51
Test #26:
score: 0
Accepted
time: 4ms
memory: 3436kb
input:
1000000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 24 25 24 25 24 25 26 27 26 27 28 29 29
output:
? 1 ? 500001 ? 500002 ? 750001 ? 750002 ? 875001 ? 875002 ? 937501 ? 937502 ? 968751 ? 968752 ? 984376 ? 984377 ? 992189 ? 992190 ? 996095 ? 996096 ? 998048 ? 998049 ? 999025 ? 999026 ? 999513 ? 999514 ? 999757 ? 999758 ? 999879 ? 999759 ? 999819 ? 999760 ? 999789 ? 999761 ? 999775 ? 999776 ? 999782...
result:
ok Correct position at 999781
Test #27:
score: 0
Accepted
time: 1ms
memory: 3404kb
input:
999999 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 30 31 32 33 32 32
output:
? 1 ? 500000 ? 500001 ? 750000 ? 750001 ? 875000 ? 875001 ? 937500 ? 937501 ? 968750 ? 968751 ? 984375 ? 984376 ? 992188 ? 992189 ? 996094 ? 996095 ? 998047 ? 998048 ? 999024 ? 999025 ? 999512 ? 999513 ? 999756 ? 999757 ? 999878 ? 999879 ? 999939 ? 999940 ? 999970 ? 999971 ? 999985 ? 999972 ? 999978...
result:
ok Correct position at 999980
Test #28:
score: 0
Accepted
time: 4ms
memory: 3432kb
input:
999998 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 30 31 32 33 32 32
output:
? 1 ? 500000 ? 500001 ? 750000 ? 750001 ? 875000 ? 875001 ? 937500 ? 937501 ? 968750 ? 968751 ? 984375 ? 984376 ? 992187 ? 992188 ? 996093 ? 996094 ? 998046 ? 998047 ? 999023 ? 999024 ? 999511 ? 999512 ? 999755 ? 999756 ? 999877 ? 999878 ? 999938 ? 999939 ? 999969 ? 999970 ? 999984 ? 999971 ? 999977...
result:
ok Correct position at 999979
Test #29:
score: 0
Accepted
time: 4ms
memory: 3368kb
input:
999997 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 30 31 32 33 32 32
output:
? 1 ? 499999 ? 500000 ? 749999 ? 750000 ? 874999 ? 875000 ? 937499 ? 937500 ? 968749 ? 968750 ? 984374 ? 984375 ? 992186 ? 992187 ? 996092 ? 996093 ? 998045 ? 998046 ? 999022 ? 999023 ? 999510 ? 999511 ? 999754 ? 999755 ? 999876 ? 999877 ? 999937 ? 999938 ? 999968 ? 999969 ? 999983 ? 999970 ? 999976...
result:
ok Correct position at 999978
Test #30:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
1000000 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 26 27 26 27 26 27 28 28
output:
? 1 ? 500001 ? 2 ? 250001 ? 250002 ? 375001 ? 375002 ? 437501 ? 437502 ? 468751 ? 468752 ? 484376 ? 484377 ? 492189 ? 492190 ? 496095 ? 496096 ? 498048 ? 498049 ? 499025 ? 499026 ? 499513 ? 499514 ? 499757 ? 499758 ? 499879 ? 499880 ? 499940 ? 499941 ? 499971 ? 499942 ? 499956 ? 499943 ? 499949 ? 49...
result:
ok Correct position at 499947
Test #31:
score: 0
Accepted
time: 0ms
memory: 3468kb
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 4 5 6 7 8 9 9
output:
? 1 ? 500000 ? 500001 ? 750000 ? 500002 ? 625001 ? 500003 ? 562502 ? 500004 ? 531253 ? 500005 ? 515629 ? 500006 ? 507817 ? 500007 ? 503912 ? 500008 ? 501960 ? 500009 ? 500984 ? 500010 ? 500497 ? 500011 ? 500254 ? 500012 ? 500133 ? 500013 ? 500073 ? 500014 ? 500043 ? 500044 ? 500058 ? 500059 ? 500066...
result:
ok Correct position at 500070
Test #32:
score: 0
Accepted
time: 1ms
memory: 3408kb
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 4 5 4 5 4 4
output:
? 1 ? 500000 ? 500001 ? 750000 ? 500002 ? 625001 ? 500003 ? 562502 ? 500004 ? 531253 ? 500005 ? 515629 ? 500006 ? 507817 ? 500007 ? 503912 ? 500008 ? 501960 ? 500009 ? 500984 ? 500010 ? 500497 ? 500011 ? 500254 ? 500012 ? 500133 ? 500013 ? 500073 ? 500074 ? 500103 ? 500075 ? 500089 ? 500076 ! 500076
result:
ok Correct position at 500076
Test #33:
score: 0
Accepted
time: 1ms
memory: 3376kb
input:
999997 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 26 27 28 29 30 31 30 31 31
output:
? 1 ? 499999 ? 2 ? 250000 ? 250001 ? 375000 ? 375001 ? 437500 ? 437501 ? 468750 ? 468751 ? 484375 ? 484376 ? 492187 ? 492188 ? 496093 ? 496094 ? 498046 ? 498047 ? 499023 ? 499024 ? 499511 ? 499512 ? 499755 ? 499756 ? 499877 ? 499878 ? 499938 ? 499939 ? 499969 ? 499940 ? 499954 ? 499955 ? 499962 ? 49...
result:
ok Correct position at 499965
Test #34:
score: 0
Accepted
time: 2ms
memory: 3376kb
input:
1000000 1 0 1 2 3 4 5 6 7 8 9 10 11 10 11 12 13 14 15 14 15 16 17 18 19 20 21 22 23 22 23 24 25 24 25 24 24
output:
? 1 ? 500001 ? 2 ? 250001 ? 250002 ? 375001 ? 375002 ? 437501 ? 437502 ? 468751 ? 468752 ? 484376 ? 484377 ? 492189 ? 484378 ? 488283 ? 488284 ? 490236 ? 490237 ? 491213 ? 490238 ? 490725 ? 490726 ? 490969 ? 490970 ? 491091 ? 491092 ? 491152 ? 491153 ? 491183 ? 491154 ? 491168 ? 491169 ? 491176 ? 49...
result:
ok Correct position at 491171
Test #35:
score: 0
Accepted
time: 4ms
memory: 3396kb
input:
999999 1 2 3 4 5 6 7 8 9 10 11 12 13 12 13 14 15 16 17 16 17 18 19 20 21 22 23 24 25 24 25 26 27 26 27 26 26
output:
? 1 ? 500000 ? 500001 ? 750000 ? 750001 ? 875000 ? 875001 ? 937500 ? 937501 ? 968750 ? 968751 ? 984375 ? 984376 ? 992188 ? 984377 ? 988282 ? 988283 ? 990235 ? 990236 ? 991212 ? 990237 ? 990724 ? 990725 ? 990968 ? 990969 ? 991090 ? 991091 ? 991151 ? 991152 ? 991182 ? 991153 ? 991167 ? 991168 ? 991175...
result:
ok Correct position at 991170
Test #36:
score: 0
Accepted
time: 5ms
memory: 3428kb
input:
999998 1 0 1 0 1 0 1 0 1 0 1 0 1 2 3 4 5 6 7 6 7 8 9 10 11 12 13 14 15 14 15 16 17 16 17 16 16
output:
? 1 ? 500000 ? 2 ? 250001 ? 3 ? 125002 ? 4 ? 62503 ? 5 ? 31254 ? 6 ? 15630 ? 7 ? 7818 ? 7819 ? 11724 ? 11725 ? 13677 ? 13678 ? 14654 ? 13679 ? 14166 ? 14167 ? 14410 ? 14411 ? 14532 ? 14533 ? 14593 ? 14594 ? 14624 ? 14595 ? 14609 ? 14610 ? 14617 ? 14611 ? 14614 ? 14612 ! 14612
result:
ok Correct position at 14612
Test #37:
score: 0
Accepted
time: 2ms
memory: 3432kb
input:
999997 1 2 3 2 3 2 3 2 3 2 3 2 3 4 5 6 7 8 9 8 9 10 11 12 13 14 15 16 17 16 17 18 19 18 19 18 18
output:
? 1 ? 499999 ? 500000 ? 749999 ? 500001 ? 625000 ? 500002 ? 562501 ? 500003 ? 531252 ? 500004 ? 515628 ? 500005 ? 507816 ? 507817 ? 511722 ? 511723 ? 513675 ? 513676 ? 514652 ? 513677 ? 514164 ? 514165 ? 514408 ? 514409 ? 514530 ? 514531 ? 514591 ? 514592 ? 514622 ? 514593 ? 514607 ? 514608 ? 514615...
result:
ok Correct position at 514610
Test #38:
score: 0
Accepted
time: 3ms
memory: 3392kb
input:
1000000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 37
output:
? 1 ? 500001 ? 500002 ? 750001 ? 750002 ? 875001 ? 875002 ? 937501 ? 937502 ? 968751 ? 968752 ? 984376 ? 984377 ? 992189 ? 992190 ? 996095 ? 996096 ? 998048 ? 998049 ? 999025 ? 999026 ? 999513 ? 999514 ? 999757 ? 999758 ? 999879 ? 999880 ? 999940 ? 999941 ? 999971 ? 999972 ? 999986 ? 999987 ? 999994...
result:
ok Correct position at 1000000
Test #39:
score: 0
Accepted
time: 5ms
memory: 3416kb
input:
999999 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 37
output:
? 1 ? 500000 ? 500001 ? 750000 ? 750001 ? 875000 ? 875001 ? 937500 ? 937501 ? 968750 ? 968751 ? 984375 ? 984376 ? 992188 ? 992189 ? 996094 ? 996095 ? 998047 ? 998048 ? 999024 ? 999025 ? 999512 ? 999513 ? 999756 ? 999757 ? 999878 ? 999879 ? 999939 ? 999940 ? 999970 ? 999971 ? 999985 ? 999986 ? 999993...
result:
ok Correct position at 999999
Test #40:
score: 0
Accepted
time: 2ms
memory: 3424kb
input:
999998 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 37
output:
? 1 ? 500000 ? 500001 ? 750000 ? 750001 ? 875000 ? 875001 ? 937500 ? 937501 ? 968750 ? 968751 ? 984375 ? 984376 ? 992187 ? 992188 ? 996093 ? 996094 ? 998046 ? 998047 ? 999023 ? 999024 ? 999511 ? 999512 ? 999755 ? 999756 ? 999877 ? 999878 ? 999938 ? 999939 ? 999969 ? 999970 ? 999984 ? 999985 ? 999992...
result:
ok Correct position at 999998
Test #41:
score: 0
Accepted
time: 5ms
memory: 3428kb
input:
999997 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 37
output:
? 1 ? 499999 ? 500000 ? 749999 ? 750000 ? 874999 ? 875000 ? 937499 ? 937500 ? 968749 ? 968750 ? 984374 ? 984375 ? 992186 ? 992187 ? 996092 ? 996093 ? 998045 ? 998046 ? 999022 ? 999023 ? 999510 ? 999511 ? 999754 ? 999755 ? 999876 ? 999877 ? 999937 ? 999938 ? 999968 ? 999969 ? 999983 ? 999984 ? 999991...
result:
ok Correct position at 999997
Test #42:
score: 0
Accepted
time: 4ms
memory: 3460kb
input:
1000000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 37
output:
? 1 ? 500001 ? 500002 ? 750001 ? 750002 ? 875001 ? 875002 ? 937501 ? 937502 ? 968751 ? 968752 ? 984376 ? 984377 ? 992189 ? 992190 ? 996095 ? 996096 ? 998048 ? 998049 ? 999025 ? 999026 ? 999513 ? 999514 ? 999757 ? 999758 ? 999879 ? 999880 ? 999940 ? 999941 ? 999971 ? 999972 ? 999986 ? 999987 ? 999994...
result:
ok Correct position at 1000000
Test #43:
score: 0
Accepted
time: 1ms
memory: 3372kb
input:
1000000 0
output:
? 1 ! 1
result:
ok Correct position at 1