QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#882712 | #9734. Identify Chord | rbtree | WA | 72ms | 3712kb | C++26 | 6.1kb | 2025-02-05 10:52:39 | 2025-02-05 10:52:51 |
Judging History
answer
#include "bits/stdc++.h"
constexpr int __FREAD__ = 0;
constexpr char __FIN__[] = "";
constexpr char __FOUT__[] = "";
constexpr bool MTS = true;
constexpr bool SPC_MTS = false;
#define _LOAD_4(a, b, c, d, ...) d
#define _ALL_0(arg) begin(arg), end(arg)
#define _ALL_1(arg, l) (begin(arg) + (l)), end(arg)
#define _ALL_2(arg, l, r) (begin(arg) + (l)), (begin(arg) + (r) + 1)
#define ALL(...) _LOAD_4(__VA_ARGS__, _ALL_2, _ALL_1, _ALL_0)(__VA_ARGS__)
// :/
using namespace std;
using tp = long long int;
[[maybe_unused]] constexpr tp ZERO = 0, ONE = 1, INF = -1ull >> 2;
int WITHERING(int);
void MIST(int, char*[]);
template <typename _Ty> class _Lambda_t { _Ty lexp;public:template<typename __Ty
>_Lambda_t(__Ty&&lexp):lexp(static_cast<__Ty&&>(lexp)){}template<typename...__Ty
>decltype(auto)operator()(__Ty&&...args){return lexp(std::ref(*this),static_cast
<__Ty&&>(args)...); } }; template <typename _Ty> decltype (auto) lexp(_Ty&&l_exp
) {return _Lambda_t<typename std::decay<_Ty>::type>(static_cast<_Ty&&>(l_exp));}
struct SPLITMIX { static uint64_t splitmix(uint64_t x){x+=0x9e3779b97f4a7c15;x=(
x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x>>27))*0x94d049bb133111eb;return
x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t o =
chrono::steady_clock::now().time_since_epoch().count(); return splitmix(x+o);}};
template <typename _Ty> auto vcc(_Ty init, size_t s) { return std::vector<_Ty>(s
, init); } template <typename _Ty, typename... __Ty> auto vcc(_Ty init, size_t s
, __Ty... o) {auto ret=vcc(init,o...);return std::vector<decltype(ret)>(s,ret);}
template <typename _Ty1, typename _Ty2> bool ckmax(_Ty1& a, const _Ty2& b) { if(
a < b) { a = b; return true; } return false; } template <typename _Ty1, typename
_Ty2> bool ckmin(_Ty1& a, const _Ty2& b){if(b<a){a=b;return true;}return false;}
void RAW(char&x){if(__FREAD__!=0){static char buf[__FREAD__];static char*s=buf,*
e=buf;if(s==e){s=buf;e=buf+fread(buf,1,__FREAD__,stdin);if(s==e){x=EOF;return;}}
x = *s++; } else x = getchar(); } void bin(char& c){for(RAW(c);c==' '||c == '\n'
|| c == '\r'; RAW(c)); } void bin(std::string& x) { char c; for(RAW(c);c==' '||c
== '\n' || c == '\r'; RAW(c)); x = c; for (RAW(c); c!=' '&&c!='\n'&&c!='\r';RAW(
c)) x.push_back(c); } template <typename Ty> void bin(Ty& x) { bool sign = false
;char c; for (RAW(c); c < '0' || c > '9'; RAW(c)) if (c == '-') sign = true; for
(x = 0; '0' <= c && c <= '9'; RAW(c)) x = x * 10 + (c & 15); if (sign) x = -x; }
template <typename...> using bin_void_t =void;template<typename T,typename=void>
struct bin_it :std::false_type{};template<typename T>struct bin_it<T,bin_void_t<
typename std::iterator_traits<T>::iterator_category>>:std::true_type{};template<
typename T>struct bin_it<T*,void>:std::true_type{};template<typename T,typename=
typename std::enable_if<bin_it<T>::value>::type>void bin(T s,T e){while(s!=e)bin
(*s++);}template<typename...>struct bin_or:std::false_type{};template<typename T
, typename... O> struct bin_or<T,O...>:std::conditional<T::value,std::true_type,
bin_or<O...>>::type {}; template <typename... T>typename std::enable_if<!bin_or<
bin_it<typename std::decay<T>::type>...>::value, void>::type bin(T& ...x) {void(
(int[]) { 0, (bin(&x, &x + 1), 0) ... }); } tp bin() { tp x; cin>>x; return x; }
int main(int argc, char* argv[]) { int t = 0, _t = 1; if(MTS&&!SPC_MTS) bin(_t);
MIST(argc, argv); while(t<_t||SPC_MTS){if(WITHERING(++t)!=0)return 0;}return 0;}
#ifdef XCODE
#define bg(...){cout<<"["<<__LINE__<<'@'<<++_LT[__LINE__]<<':';BG(__VA_ARGS__);}
size_t _LT[21777]; template<typename _Type>void BG(const _Type&_cur){cout<<' '<<
_cur << ']' <<" <<:"<<std::endl;}template<typename _Type,typename... _Other>void
BG(const _Type& _cur, const _Other& ..._other) {cout<< ' '<<_cur;BG(_other...);}
#else
#define bg(...)
#endif
// :/
namespace lib { // LIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIBLIB
class Random{mt19937_64 rd;public:Random(unsigned long long seed) {rd=mt19937_64
(seed); } long long operator()(long long l, long long r) { return l + rd() % (r-
l + 1); } } rng(reinterpret_cast<unsigned long long>(new char) * time(nullptr));
} // LIB::RANDOM LIB::RANDOM LIB::RANDOM LIB::RANDOM LIB::RANDOM LIB::RANDOM LI
// :/
struct STRUGGLE {
STRUGGLE() {
if (strlen(__FIN__)) freopen(__FIN__, "r", stdin);
if (strlen(__FOUT__)) freopen(__FOUT__, "w", stdout);
}
~STRUGGLE() {
}
} STRUGGLE;
int WITHERING([[maybe_unused]] int TEST_NUMBER) {
int n; cin >> n;
map<pair<int, int>, int> mem;
auto ask = [&](int x, int y) {
if ((x + 1) % n == y || (y + 1) % n == x) return 1;
if (mem.count(minmax(x, y))) return mem[minmax(x, y)];
cout << "? " << x + 1 << ' ' << y + 1 << endl;
int t;
cin >> t;
return mem[minmax(x, y)] = t;
};
int x, y;
int d;
set<int> fd;
while (true) {
x = lib::rng(0, n - 1);
y = (x + n / 2) % n;
bool flag = false;
if (n >= 1000000) {
for (auto i : fd) {
if (abs(x - i) <= 50000 || abs(y - i) <= 50000) {
if (lib::rng(0, 500) != 0) {
flag = true;
break;
}
}
}
}
if (flag) continue;
fd.insert(x);
fd.insert(y);
d = ask(x, y);
if (d != n / 2) break;
}
if (ask(x, (y + n - 1) % n) == d - 1) {
int l = 1, r = n / 2;
while (l <= r) {
int mid = (l + r) >> 1;
if (ask(x, (y + n - mid) % n) == d - mid) l = mid + 1;
else r = mid - 1;
}
y = (y + n - r) % n;
} else {
int l = 1, r = n / 2;
while (l <= r) {
int mid = (l + r) >> 1;
if (ask(x, (y + mid) % n) == d - mid) l = mid + 1;
else r = mid - 1;
}
y = (y + r) % n;
}
d = ask(x, y);
if (ask((x + d - 1) % n, y) == 1) x = (x + d - 1) % n;
else x = (x + n - d + 1) % n;
cout << "! " << x + 1 << ' ' << y + 1 << endl;
cin >> x;
return 0;
}
void MIST([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) {
}
// :\ */
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
2 6 2 2 2 1 1 4 2 1 1
output:
? 1 4 ? 1 3 ? 1 5 ? 2 4 ! 2 4 ? 4 2 ? 1 3 ! 1 3
result:
ok ok (2 test cases)
Test #2:
score: 0
Accepted
time: 13ms
memory: 3584kb
input:
1000 15 6 6 2 2 1 1 19 1 2 5 3 2 1 17 7 6 4 5 4 2 1 15 6 6 4 6 7 1 1 14 5 6 3 3 2 3 1 15 3 4 4 3 2 1 1 17 6 5 4 4 5 3 1 20 6 7 5 4 5 7 1 13 6 3 4 4 4 4 1 18 3 4 4 5 4 1 1 13 6 3 2 2 1 1 14 4 3 3 4 4 1 17 7 7 3 3 2 1 1 12 5 5 3 4 3 1 1 10 5 3 2 2 3 1 1 14 6 6 3 5 5 4 1 19 9 8 8 3 1 2 1 19 9 8 7 4 6 6...
output:
? 8 15 ? 8 14 ? 8 4 ? 8 6 ? 8 5 ! 8 5 ? 3 12 ? 3 11 ? 3 17 ? 3 14 ? 3 13 ! 3 12 ? 6 14 ? 6 13 ? 6 10 ? 6 12 ? 6 11 ? 9 11 ! 3 11 ? 11 3 ? 11 2 ? 11 7 ? 11 5 ? 11 4 ? 1 3 ! 1 3 ? 6 13 ? 6 12 ? 6 3 ? 6 1 ? 6 2 ? 7 2 ! 5 2 ? 1 8 ? 1 7 ? 1 12 ? 1 10 ? 1 9 ? 2 9 ! 2 9 ? 8 16 ? 8 15 ? 8 12 ? 8 14 ? 8 13 ?...
result:
ok ok (1000 test cases)
Test #3:
score: 0
Accepted
time: 8ms
memory: 3584kb
input:
1000 21 2 3 5 2 1 1 22 4 3 5 3 2 1 1 20 5 6 5 7 6 6 1 22 4 5 5 3 3 2 3 1 21 5 6 6 7 6 1 1 21 8 9 6 6 5 6 9 1 24 5 4 6 6 5 1 1 22 10 10 5 8 10 2 1 21 7 6 5 5 4 5 4 1 23 8 9 6 5 4 5 7 1 21 5 6 2 3 2 1 1 24 7 8 6 4 5 7 1 20 9 9 5 8 9 2 1 24 11 11 6 8 7 6 11 1 23 9 10 3 2 2 1 1 23 3 4 6 4 2 3 3 1 23 10 ...
output:
? 10 20 ? 10 19 ? 10 4 ? 10 1 ? 10 21 ! 10 21 ? 16 5 ? 16 4 ? 16 21 ? 16 2 ? 16 3 ? 17 3 ! 17 3 ? 15 5 ? 15 4 ? 15 10 ? 15 7 ? 15 6 ? 19 5 ! 11 5 ? 16 5 ? 16 4 ? 16 11 ? 16 8 ? 16 6 ? 16 7 ? 17 7 ! 15 7 ? 3 13 ? 3 12 ? 3 18 ? 3 15 ? 3 14 ? 7 13 ! 7 13 ? 2 12 ? 2 11 ? 2 17 ? 2 14 ? 2 15 ? 2 16 ? 6 15...
result:
ok ok (1000 test cases)
Test #4:
score: 0
Accepted
time: 14ms
memory: 3712kb
input:
1000 25 8 7 6 9 8 1 1 25 11 10 6 8 8 2 1 25 5 4 3 2 1 2 1 25 5 4 6 4 3 1 1 26 12 12 6 10 12 1 1 26 7 6 6 4 6 5 1 1 26 11 12 4 1 2 1 27 13 12 11 5 3 5 1 1 25 9 10 7 6 7 10 1 27 10 11 7 11 9 10 6 1 27 10 9 5 7 5 4 1 1 27 5 6 7 4 4 3 1 1 26 13 11 10 6 8 8 9 3 1 25 10 11 4 4 3 4 5 1 27 7 8 7 10 8 7 1 25...
output:
? 20 7 ? 20 6 ? 20 1 ? 20 4 ? 20 5 ? 1 6 ! 1 6 ? 16 3 ? 16 2 ? 16 22 ? 16 25 ? 16 24 ? 23 25 ! 9 25 ? 23 10 ? 23 9 ? 23 4 ? 23 7 ? 23 6 ? 23 5 ! 23 6 ? 1 13 ? 1 12 ? 1 7 ? 1 10 ? 1 11 ? 3 11 ! 3 11 ? 7 20 ? 7 19 ? 7 1 ? 7 23 ? 7 21 ? 18 20 ! 18 20 ? 22 9 ? 22 8 ? 22 2 ? 22 6 ? 22 4 ? 22 5 ? 25 6 ! 2...
result:
ok ok (1000 test cases)
Test #5:
score: 0
Accepted
time: 12ms
memory: 3584kb
input:
1000 29 10 11 3 4 5 4 1 1 28 14 3 2 6 2 1 1 30 9 8 7 5 7 6 7 1 29 5 6 8 4 4 3 5 1 28 14 6 7 3 3 1 2 1 29 5 4 7 4 3 5 1 29 13 13 6 4 4 3 1 1 28 11 12 7 8 8 7 12 1 30 10 11 7 8 8 7 1 1 30 6 7 7 10 8 7 10 1 28 9 10 7 6 8 7 11 1 29 13 12 6 3 5 6 1 1 29 13 13 8 12 12 13 1 1 29 11 12 4 4 4 3 1 1 29 14 14 ...
output:
? 1 15 ? 1 14 ? 1 22 ? 1 26 ? 1 24 ? 1 23 ? 3 22 ! 3 22 ? 16 2 ? 24 10 ? 24 9 ? 24 3 ? 24 7 ? 24 8 ! 24 8 ? 21 6 ? 21 5 ? 21 28 ? 21 2 ? 21 30 ? 21 1 ? 25 2 ! 17 2 ? 15 29 ? 15 28 ? 15 7 ? 15 3 ? 15 1 ? 15 2 ? 17 2 ! 13 2 ? 4 18 ? 23 9 ? 23 8 ? 23 16 ? 23 12 ? 23 14 ? 23 15 ! 23 14 ? 20 5 ? 20 4 ? 2...
result:
ok ok (1000 test cases)
Test #6:
score: 0
Accepted
time: 11ms
memory: 3456kb
input:
1000 32 13 14 7 9 7 6 11 1 30 14 14 6 3 4 3 5 1 32 12 13 8 8 8 7 1 1 31 15 15 10 9 7 10 8 9 6 1 32 9 10 7 5 5 4 1 1 32 14 13 8 10 10 11 3 1 31 15 10 11 4 6 4 3 5 1 31 6 7 4 2 2 1 1 32 14 13 6 2 2 3 3 1 30 14 14 6 3 5 6 11 1 31 8 9 4 4 2 3 1 1 31 9 8 7 7 7 6 1 1 33 16 8 9 4 4 2 3 3 1 32 9 8 8 5 7 6 8...
output:
? 14 30 ? 14 29 ? 14 6 ? 14 2 ? 14 4 ? 14 5 ? 19 5 ! 9 5 ? 30 15 ? 30 14 ? 30 23 ? 30 27 ? 30 25 ? 30 26 ? 2 26 ! 28 26 ? 20 4 ? 20 3 ? 20 12 ? 20 8 ? 20 10 ? 20 9 ? 26 9 ! 26 9 ? 25 9 ? 26 10 ? 22 6 ? 22 5 ? 22 29 ? 22 2 ? 22 4 ? 22 3 ? 29 4 ! 15 4 ? 32 16 ? 32 15 ? 32 24 ? 32 20 ? 32 22 ? 32 21 ? ...
result:
ok ok (1000 test cases)
Test #7:
score: 0
Accepted
time: 17ms
memory: 3584kb
input:
1000 34 10 11 8 10 8 9 12 1 33 14 15 9 12 12 11 1 1 33 11 12 9 13 11 10 8 1 34 11 10 8 9 9 8 7 1 34 9 10 8 5 5 4 7 1 35 15 16 9 14 13 14 7 1 34 8 7 8 8 6 7 10 1 34 17 6 7 8 6 4 5 7 1 34 16 15 7 4 5 5 1 1 33 15 14 8 12 13 12 2 1 33 16 16 15 14 7 4 6 7 1 1 34 16 15 7 3 2 3 1 1 33 14 15 9 12 12 11 1 1 ...
output:
? 12 29 ? 12 28 ? 12 4 ? 12 33 ? 12 31 ? 12 32 ? 19 31 ! 5 31 ? 29 12 ? 29 11 ? 29 20 ? 29 16 ? 29 14 ? 29 15 ? 6 15 ! 6 15 ? 7 23 ? 7 22 ? 7 31 ? 7 27 ? 7 25 ? 7 24 ? 16 24 ! 31 24 ? 18 1 ? 18 34 ? 18 26 ? 18 31 ? 18 33 ? 18 32 ? 25 32 ! 11 32 ? 5 22 ? 5 21 ? 5 31 ? 5 26 ? 5 28 ? 5 27 ? 8 27 ! 2 27...
result:
ok ok (1000 test cases)
Test #8:
score: 0
Accepted
time: 13ms
memory: 3456kb
input:
1000 36 17 16 9 13 11 11 1 1 36 18 15 14 9 11 9 10 4 1 36 13 14 4 4 4 3 5 1 36 11 12 9 9 9 8 1 1 36 15 14 9 13 13 12 4 1 36 16 17 7 4 5 6 1 1 35 13 14 9 9 11 10 13 1 36 9 8 2 5 3 2 1 1 36 14 13 9 10 10 9 5 1 36 16 17 7 4 5 4 3 5 1 36 5 4 9 5 3 4 5 1 36 10 9 9 6 8 7 9 1 36 18 17 17 9 14 16 16 4 1 36 ...
output:
? 8 26 ? 8 25 ? 8 17 ? 8 22 ? 8 20 ? 8 19 ? 18 20 ! 18 20 ? 27 9 ? 7 25 ? 7 24 ? 7 16 ? 7 21 ? 7 19 ? 7 18 ? 15 19 ! 35 19 ? 12 30 ? 12 29 ? 12 3 ? 12 8 ? 12 5 ? 12 4 ? 14 4 ! 10 4 ? 32 14 ? 32 13 ? 32 23 ? 32 18 ? 32 16 ? 32 17 ? 3 17 ! 3 17 ? 17 35 ? 17 34 ? 17 26 ? 17 31 ? 17 33 ? 17 32 ? 28 32 !...
result:
ok ok (1000 test cases)
Test #9:
score: 0
Accepted
time: 13ms
memory: 3584kb
input:
1000 37 11 10 9 11 9 10 8 1 36 17 16 9 14 15 14 1 1 38 15 14 5 4 5 4 5 1 37 14 13 9 14 14 5 1 37 13 14 10 15 13 12 1 1 36 16 17 9 12 12 13 1 1 37 15 16 10 11 11 10 1 1 37 3 4 8 3 1 2 1 37 18 17 17 10 13 11 10 9 17 1 37 6 7 10 8 6 5 1 1 37 9 8 9 11 9 1 1 37 17 16 8 4 6 5 5 1 1 36 9 10 9 7 7 6 1 1 37 ...
output:
? 35 16 ? 35 15 ? 35 7 ? 35 12 ? 35 14 ? 35 13 ? 6 14 ! 27 14 ? 13 31 ? 13 30 ? 13 22 ? 13 27 ? 13 29 ? 13 28 ? 26 28 ! 26 28 ? 10 29 ? 10 28 ? 10 19 ? 10 14 ? 10 17 ? 10 18 ? 13 18 ! 7 18 ? 33 14 ? 33 13 ? 33 5 ? 33 10 ? 33 12 ? 8 13 ! 21 13 ? 8 26 ? 8 25 ? 8 35 ? 8 30 ? 8 28 ? 8 27 ? 19 27 ! 19 27...
result:
ok ok (1000 test cases)
Test #10:
score: 0
Accepted
time: 13ms
memory: 3456kb
input:
1000 39 11 12 3 6 4 3 2 1 1 38 12 11 9 13 10 11 8 1 38 13 14 9 14 11 12 1 1 39 19 12 11 2 4 2 1 1 38 15 16 5 4 3 2 3 3 1 39 3 4 10 8 5 4 1 1 39 15 16 10 14 13 12 13 11 1 38 18 18 9 14 16 15 15 8 1 39 14 15 4 5 6 5 7 1 39 19 12 13 10 7 7 6 11 1 39 18 18 10 13 11 12 1 1 38 18 17 9 14 16 15 14 1 1 39 1...
output:
? 24 4 ? 24 3 ? 24 14 ? 24 9 ? 24 11 ? 24 12 ? 24 13 ? 25 13 ! 25 13 ? 4 23 ? 4 22 ? 4 13 ? 4 18 ? 4 21 ? 4 20 ? 13 21 ! 33 21 ? 5 24 ? 5 23 ? 5 34 ? 5 29 ? 5 26 ? 5 27 ? 15 26 ! 15 26 ? 25 5 ? 2 21 ? 2 20 ? 2 11 ? 2 6 ? 2 9 ? 2 10 ! 2 10 ? 27 8 ? 27 7 ? 27 18 ? 27 23 ? 27 20 ? 27 21 ? 27 22 ? 28 21...
result:
ok ok (1000 test cases)
Test #11:
score: 0
Accepted
time: 15ms
memory: 3584kb
input:
1000 40 12 11 10 7 9 8 9 1 40 8 7 10 11 8 13 1 40 11 10 10 6 8 7 1 1 40 20 8 9 10 9 6 7 11 1 40 16 17 6 5 4 3 4 5 1 40 5 6 10 8 5 4 1 1 41 14 15 11 9 11 10 17 1 40 11 12 10 12 9 10 1 1 40 18 17 8 5 6 7 1 1 40 18 17 8 5 8 7 3 1 40 14 15 10 9 11 10 1 1 41 6 7 6 1 3 2 1 40 5 4 9 4 3 2 3 3 1 40 4 5 8 3 ...
output:
? 32 12 ? 32 11 ? 32 2 ? 32 7 ? 32 5 ? 32 6 ? 38 7 ! 26 7 ? 33 13 ? 33 12 ? 33 3 ? 33 8 ? 33 11 ? 39 12 ! 27 12 ? 28 8 ? 28 7 ? 28 38 ? 28 3 ? 28 1 ? 28 2 ? 33 3 ! 33 3 ? 8 28 ? 19 39 ? 19 38 ? 19 9 ? 19 4 ? 19 1 ? 19 2 ? 24 1 ! 14 1 ? 30 10 ? 30 9 ? 30 20 ? 30 25 ? 30 22 ? 30 23 ? 30 24 ? 32 23 ! 2...
result:
ok ok (1000 test cases)
Test #12:
score: 0
Accepted
time: 14ms
memory: 3584kb
input:
1000 42 11 12 8 6 5 5 4 7 1 41 16 15 8 11 9 8 7 1 1 41 6 5 8 3 4 3 2 3 1 41 15 16 11 10 8 9 1 1 41 8 7 6 3 3 2 1 1 41 9 10 11 8 7 6 7 11 1 41 14 15 6 9 7 6 5 9 1 41 7 6 10 6 5 4 5 7 1 41 9 8 10 6 7 6 5 1 1 41 14 13 4 5 6 5 1 1 41 4 5 10 5 2 3 1 1 42 20 19 9 4 2 3 3 1 1 41 17 18 11 12 14 13 1 1 41 7 ...
output:
? 20 41 ? 20 40 ? 20 10 ? 20 4 ? 20 7 ? 20 5 ? 20 6 ? 23 6 ! 17 6 ? 27 6 ? 27 5 ? 27 37 ? 27 1 ? 27 40 ? 27 39 ? 27 38 ? 33 38 ! 33 38 ? 41 20 ? 41 19 ? 41 10 ? 41 15 ? 41 18 ? 41 17 ? 41 16 ? 1 16 ! 40 16 ? 9 29 ? 9 28 ? 9 39 ? 9 34 ? 9 36 ? 9 37 ? 16 36 ! 16 36 ? 9 29 ? 9 28 ? 9 19 ? 9 24 ? 9 22 ?...
result:
ok ok (1000 test cases)
Test #13:
score: 0
Accepted
time: 14ms
memory: 3456kb
input:
1000 43 8 9 11 9 6 7 1 1 42 18 19 10 13 10 11 19 1 43 14 13 7 9 6 5 6 8 1 43 21 14 13 10 9 10 8 9 8 1 43 15 16 8 10 7 6 7 11 1 43 20 19 10 15 13 14 14 2 1 43 18 17 10 13 13 12 13 1 1 43 21 20 19 9 5 8 8 1 1 42 13 12 10 12 11 10 11 1 1 42 20 19 9 4 2 3 3 1 1 42 11 10 10 6 9 7 11 1 43 10 11 7 5 4 4 3 ...
output:
? 41 19 ? 41 18 ? 41 30 ? 41 24 ? 41 21 ? 41 22 ? 3 21 ! 3 21 ? 29 8 ? 29 7 ? 29 19 ? 29 13 ? 29 16 ? 29 17 ? 38 16 ! 20 16 ? 9 30 ? 9 29 ? 9 19 ? 9 25 ? 9 22 ? 9 21 ? 9 20 ? 13 21 ! 5 21 ? 24 2 ? 42 20 ? 42 19 ? 42 9 ? 42 15 ? 42 12 ? 42 14 ? 42 13 ? 6 14 ! 35 14 ? 10 31 ? 10 30 ? 10 42 ? 10 36 ? 1...
result:
ok ok (1000 test cases)
Test #14:
score: 0
Accepted
time: 19ms
memory: 3584kb
input:
1000 44 22 22 16 15 5 5 2 3 3 1 44 15 16 11 10 11 9 10 1 1 43 12 11 3 7 4 3 2 3 1 43 12 11 10 7 8 6 7 1 1 44 22 17 18 10 12 9 8 9 15 1 44 16 15 11 11 14 12 1 1 44 13 14 11 14 11 12 14 1 44 22 10 11 11 11 8 9 1 1 43 9 10 11 14 11 10 13 1 43 4 5 11 5 2 3 3 1 44 9 8 4 4 1 2 1 44 20 19 9 3 2 4 1 1 44 13...
output:
? 2 24 ? 23 1 ? 42 20 ? 42 19 ? 42 9 ? 42 3 ? 42 6 ? 42 5 ? 43 6 ! 41 6 ? 21 43 ? 21 42 ? 21 10 ? 21 4 ? 21 7 ? 21 5 ? 21 6 ? 29 5 ! 29 5 ? 25 3 ? 25 2 ? 25 35 ? 25 41 ? 25 38 ? 25 37 ? 25 36 ? 26 36 ! 24 36 ? 13 34 ? 13 33 ? 13 23 ? 13 29 ? 13 26 ? 13 28 ? 13 27 ? 18 28 ! 18 28 ? 43 21 ? 9 31 ? 9 3...
result:
ok ok (1000 test cases)
Test #15:
score: 0
Accepted
time: 16ms
memory: 3456kb
input:
1000 45 19 20 12 14 11 12 20 1 45 8 7 9 3 6 4 1 1 45 22 14 15 12 15 12 13 1 1 45 4 3 11 7 4 1 1 45 11 10 11 8 9 8 7 1 1 45 2 3 11 5 2 1 1 45 19 20 12 18 17 16 17 10 1 45 17 18 10 12 9 8 9 1 1 44 19 20 8 5 5 6 9 1 45 12 13 12 9 10 9 8 15 1 44 20 21 9 5 6 7 11 1 45 15 14 8 10 7 6 7 1 1 44 16 17 11 17 ...
output:
? 15 37 ? 15 36 ? 15 3 ? 15 42 ? 15 45 ? 15 1 ? 25 45 ! 5 45 ? 40 17 ? 40 16 ? 40 6 ? 40 12 ? 40 9 ? 40 11 ? 42 12 ! 42 12 ? 12 34 ? 39 16 ? 39 15 ? 39 27 ? 39 21 ? 39 18 ? 39 19 ? 5 18 ! 5 18 ? 30 7 ? 30 6 ? 30 41 ? 30 2 ? 30 5 ? 32 6 ! 32 6 ? 41 18 ? 41 17 ? 41 7 ? 41 13 ? 41 16 ? 41 15 ? 41 14 ? ...
result:
ok ok (1000 test cases)
Test #16:
score: 0
Accepted
time: 10ms
memory: 3584kb
input:
1000 46 8 9 10 4 5 4 3 1 1 46 23 19 18 11 13 12 12 11 5 1 46 22 21 10 5 7 7 2 1 46 19 20 7 5 8 8 13 1 46 5 6 11 5 2 3 3 1 46 19 20 11 13 14 14 1 1 46 16 15 11 12 13 12 11 8 1 46 18 19 11 14 15 14 13 1 1 46 23 22 22 10 5 7 6 5 9 1 46 11 10 11 9 8 7 8 13 1 45 19 20 12 18 21 20 4 1 46 10 11 8 4 5 3 4 1...
output:
? 29 6 ? 29 5 ? 29 18 ? 29 12 ? 29 9 ? 29 10 ? 29 11 ? 31 11 ! 31 11 ? 40 17 ? 14 37 ? 14 36 ? 14 25 ? 14 31 ? 14 28 ? 14 30 ? 14 29 ? 24 29 ! 4 29 ? 45 22 ? 45 21 ? 45 10 ? 45 4 ? 45 7 ? 45 6 ? 5 7 ! 39 7 ? 17 40 ? 17 39 ? 17 6 ? 17 12 ? 17 9 ? 17 7 ? 23 6 ! 11 6 ? 21 44 ? 21 43 ? 21 10 ? 21 4 ? 21...
result:
ok ok (1000 test cases)
Test #17:
score: 0
Accepted
time: 64ms
memory: 3584kb
input:
1000 1000000000 499999999 499999999 250000000 375000000 437499999 406249999 390624999 382812500 386718749 384765624 383789062 383300782 383544923 383666993 383728028 383758546 383773804 383766175 383762360 383760454 383761407 383760930 383760693 383760811 383760753 383760783 383760797 383760791 3837...
output:
? 255808178 755808178 ? 255808178 755808177 ? 255808178 5808178 ? 255808178 880808178 ? 255808178 818308178 ? 255808178 849558178 ? 255808178 865183178 ? 255808178 872995678 ? 255808178 869089428 ? 255808178 871042553 ? 255808178 872019115 ? 255808178 872507396 ? 255808178 872263255 ? 255808178 8721...
result:
ok ok (1000 test cases)
Test #18:
score: 0
Accepted
time: 55ms
memory: 3456kb
input:
1000 1000000000 499999969 499999968 249999969 125000000 187500000 218749969 203125000 210937500 214843750 216796875 217773407 217285157 217529267 217407228 217468232 217437746 217453005 217460634 217464449 217466325 217465372 217464895 217464657 217464569 217464629 217464656 217464643 217464648 2174...
output:
? 185786232 685786232 ? 185786232 685786231 ? 185786232 435786232 ? 185786232 310786232 ? 185786232 373286232 ? 185786232 404536232 ? 185786232 388911232 ? 185786232 396723732 ? 185786232 400629982 ? 185786232 402583107 ? 185786232 403559670 ? 185786232 403071389 ? 185786232 403315530 ? 185786232 40...
result:
ok ok (1000 test cases)
Test #19:
score: 0
Accepted
time: 72ms
memory: 3584kb
input:
1000 1000000000 73409579 73409580 250000000 125000001 62500001 42159579 46875001 39062501 38253329 37109376 37276767 36788486 36865235 36743164 36727451 36712646 36712193 36705016 36708379 36706472 36705518 36705041 36704803 36704896 36704836 36704806 36704791 36704796 36704793 36704791 36704790 1 1...
output:
? 200369307 700369307 ? 200369307 700369306 ? 200369307 950369307 ? 200369307 825369307 ? 200369307 762869307 ? 200369307 731619307 ? 200369307 747244307 ? 200369307 739431807 ? 200369307 735525557 ? 200369307 737478682 ? 200369307 736502119 ? 200369307 736990400 ? 200369307 737234541 ? 200369307 73...
result:
ok ok (1000 test cases)
Test #20:
score: 0
Accepted
time: 52ms
memory: 3584kb
input:
1000 1000000000 115175318 115175319 249999930 124999930 62499930 83925318 68300318 60487818 58593680 58534693 57617117 58046412 57802272 57680202 57619167 57588649 57601858 57594228 57590413 57588506 57587696 57588029 57587790 57587671 57587637 57587641 57587626 57587630 57587626 57587624 57587625 1...
output:
? 827169652 327169652 ? 827169652 327169651 ? 827169652 577169652 ? 827169652 452169652 ? 827169652 389669652 ? 827169652 358419652 ? 827169652 374044652 ? 827169652 381857152 ? 827169652 385763402 ? 827169652 383810277 ? 827169652 384786839 ? 827169652 384298558 ? 827169652 384542698 ? 827169652 38...
result:
ok ok (1000 test cases)
Test #21:
score: 0
Accepted
time: 63ms
memory: 3584kb
input:
1000 1000000000 288090905 288090904 50127725 163090905 100590905 69340905 53715905 45903405 46221475 44268350 44926843 44438562 44194421 44146279 44133386 44115761 44118128 44110499 44111946 44110038 44109546 44109561 44109322 44109427 44109368 44109338 44109323 44109316 44109318 44109316 44109315 1...
output:
? 702109541 202109541 ? 702109541 202109540 ? 702109541 952109541 ? 702109541 77109541 ? 702109541 14609541 ? 702109541 983359541 ? 702109541 967734541 ? 702109541 959922041 ? 702109541 956015791 ? 702109541 957968916 ? 702109541 958945479 ? 702109541 958457198 ? 702109541 958213057 ? 702109541 9580...
result:
ok ok (1000 test cases)
Test #22:
score: -100
Wrong Answer
time: 52ms
memory: 3584kb
input:
1000 999999999 499999998 499999997 249999999 374999999 437499999 468749999 484374999 492187498 488281249 490234374 491210936 490722656 490966796 490844727 490905761 490875245 490890503 490882875 490886689 490884782 490883828 490883352 490883590 490883472 490883532 490883561 490883547 490883555 49088...
output:
? 727734989 227734989 ? 727734989 227734988 ? 727734989 977734988 ? 727734989 102734989 ? 727734989 165234989 ? 727734989 196484989 ? 727734989 212109989 ? 727734989 219922489 ? 727734989 216016239 ? 727734989 217969364 ? 727734989 218945927 ? 727734989 218457646 ? 727734989 218701787 ? 727734989 21...
result:
wrong answer Too many queries: 41 (test case 844)