QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#882720 | #9734. Identify Chord | rbtree | WA | 71ms | 3712kb | C++26 | 6.1kb | 2025-02-05 10:56:03 | 2025-02-05 10:56:12 |
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);
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: 3456kb
input:
2 6 3 2 2 2 1 1 4 1 1
output:
? 6 3 ? 1 4 ? 1 3 ? 1 5 ? 2 4 ! 2 4 ? 3 1 ! 3 1
result:
ok ok (2 test cases)
Test #2:
score: 0
Accepted
time: 17ms
memory: 3456kb
input:
1000 15 7 5 6 4 6 6 1 1 19 6 5 4 4 5 4 1 17 8 3 2 4 3 3 1 15 7 7 7 6 5 2 2 1 1 14 5 4 3 3 4 1 1 15 7 3 2 3 3 3 1 17 5 6 5 3 4 1 1 20 6 5 3 4 3 2 1 1 13 3 4 2 2 1 1 18 3 4 4 1 2 1 13 6 4 5 3 3 2 3 1 14 4 5 3 4 3 1 1 17 4 3 2 2 1 1 12 6 5 4 3 3 2 1 10 5 3 4 2 2 1 1 14 6 6 3 5 6 1 1 19 9 8 8 3 3 4 5 1 ...
output:
? 14 6 ? 1 8 ? 1 7 ? 1 12 ? 1 10 ? 1 9 ? 5 8 ! 5 8 ? 15 5 ? 15 4 ? 15 19 ? 15 3 ? 15 2 ? 18 3 ! 12 3 ? 15 6 ? 4 12 ? 4 11 ? 4 8 ? 4 10 ? 5 11 ! 3 11 ? 6 13 ? 7 14 ? 2 9 ? 15 7 ? 15 6 ? 15 3 ? 15 2 ? 1 3 ! 1 3 ? 14 7 ? 14 6 ? 14 3 ? 14 5 ? 14 4 ? 2 5 ! 2 5 ? 13 5 ? 3 10 ? 3 9 ? 3 6 ? 3 8 ? 4 9 ! 2 9 ...
result:
ok ok (1000 test cases)
Test #3:
score: 0
Accepted
time: 12ms
memory: 3456kb
input:
1000 21 6 7 5 4 3 4 1 1 22 8 7 5 7 6 4 1 20 9 9 4 2 3 3 1 1 22 4 3 5 5 4 1 1 21 5 4 2 3 2 1 1 21 10 7 8 6 9 8 1 1 24 11 11 5 3 4 4 1 1 22 10 9 4 1 1 21 5 6 6 3 4 1 1 23 9 10 6 9 8 9 1 1 21 4 5 6 6 5 1 1 24 11 10 5 3 4 3 2 1 20 10 9 9 5 7 7 6 1 24 11 10 6 9 10 1 1 23 9 10 3 3 2 3 3 1 23 6 7 6 5 5 4 1...
output:
? 8 18 ? 8 17 ? 8 2 ? 8 20 ? 8 21 ? 8 1 ? 10 21 ! 10 21 ? 8 19 ? 8 18 ? 8 13 ? 8 16 ? 8 17 ? 13 17 ! 3 17 ? 9 19 ? 9 18 ? 9 4 ? 9 7 ? 9 5 ? 9 6 ? 11 5 ! 11 5 ? 5 16 ? 5 15 ? 5 10 ? 5 13 ? 5 14 ? 7 15 ! 7 15 ? 7 17 ? 7 16 ? 7 12 ? 7 15 ? 7 14 ? 7 13 ! 7 13 ? 7 17 ? 9 19 ? 9 18 ? 9 3 ? 9 21 ? 9 20 ? 1...
result:
ok ok (1000 test cases)
Test #4:
score: 0
Accepted
time: 10ms
memory: 3712kb
input:
1000 25 12 9 10 3 4 4 5 1 25 4 3 6 5 4 1 1 25 6 7 7 9 7 7 1 25 7 6 3 4 3 2 3 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 12 11 6 9 8 8 1 1 25 12 8 7 4 5 4 3 1 1 27 9 8 2 3 1 2 1 27 13 11 12 7 8 6 7 11 1 27 12 12 7 9 7 6 1 1 26 13 13 5 6 4 2 2 1 1 25 10 11 4 3 3 2 3 1 27 12 12 7 9 9...
output:
? 4 16 ? 8 20 ? 8 19 ? 8 1 ? 8 4 ? 8 2 ? 10 1 ! 6 1 ? 23 10 ? 23 9 ? 23 4 ? 23 7 ? 23 8 ? 25 9 ! 25 9 ? 11 23 ? 11 22 ? 11 4 ? 11 1 ? 11 24 ? 16 23 ! 6 23 ? 4 16 ? 4 15 ? 4 10 ? 4 13 ? 4 12 ? 4 11 ? 5 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...
result:
ok ok (1000 test cases)
Test #5:
score: 0
Accepted
time: 10ms
memory: 3584kb
input:
1000 29 14 7 8 8 8 6 7 1 1 28 5 4 6 2 4 3 3 1 30 7 6 7 5 5 4 7 1 29 4 3 7 5 4 1 1 28 10 11 3 3 5 4 1 1 29 2 3 8 5 3 3 1 29 10 9 3 3 3 2 3 1 28 11 10 4 2 2 1 1 30 12 11 6 8 6 5 4 1 30 14 13 7 10 9 10 2 1 28 13 13 6 3 4 3 1 1 29 13 12 6 3 4 3 1 1 29 11 10 4 3 4 3 1 1 29 6 5 7 5 4 1 1 29 14 13 12 7 10 ...
output:
? 13 27 ? 17 2 ? 17 1 ? 17 9 ? 17 5 ? 17 3 ? 17 4 ? 22 3 ! 22 3 ? 25 11 ? 25 10 ? 25 4 ? 25 8 ? 25 6 ? 25 7 ? 26 8 ! 24 8 ? 5 20 ? 5 19 ? 5 12 ? 5 16 ? 5 18 ? 5 17 ? 8 17 ! 2 17 ? 29 14 ? 29 13 ? 29 7 ? 29 11 ? 29 12 ? 2 13 ! 2 13 ? 21 7 ? 21 6 ? 21 14 ? 21 18 ? 21 16 ? 21 15 ? 23 14 ! 23 14 ? 4 18 ...
result:
ok ok (1000 test cases)
Test #6:
score: 0
Accepted
time: 12ms
memory: 3584kb
input:
1000 32 13 14 8 11 11 10 10 1 30 14 14 6 3 4 4 7 1 32 10 9 8 6 6 5 7 1 31 5 4 7 3 3 2 1 1 32 9 10 7 5 5 4 1 1 32 16 14 13 6 4 6 5 3 1 31 9 8 7 7 7 6 1 1 31 14 13 7 10 9 10 2 1 32 12 11 8 8 6 7 1 1 30 14 14 6 2 2 3 1 31 8 9 4 4 2 3 1 1 31 10 11 6 6 4 5 7 1 33 8 9 9 6 6 5 9 1 32 9 8 8 5 7 6 8 1 32 14 ...
output:
? 18 2 ? 18 1 ? 18 10 ? 18 6 ? 18 4 ? 18 5 ? 27 5 ! 9 5 ? 1 16 ? 1 15 ? 1 24 ? 1 28 ? 1 26 ? 1 27 ? 4 26 ! 28 26 ? 30 14 ? 30 13 ? 30 6 ? 30 10 ? 30 8 ? 30 9 ? 2 9 ! 26 9 ? 3 18 ? 3 17 ? 3 10 ? 3 14 ? 3 16 ? 3 15 ? 4 15 ! 4 15 ? 32 16 ? 32 15 ? 32 24 ? 32 20 ? 32 22 ? 32 21 ? 3 21 ! 3 21 ? 12 28 ? 2...
result:
ok ok (1000 test cases)
Test #7:
score: 0
Accepted
time: 18ms
memory: 3584kb
input:
1000 34 10 11 8 6 6 5 9 1 33 15 15 7 5 5 4 1 1 33 12 13 9 13 12 11 1 1 34 7 8 6 3 3 2 1 1 34 9 8 4 5 3 2 3 1 1 35 14 13 8 13 14 1 1 34 14 13 8 10 10 9 4 1 34 16 15 8 12 11 11 2 1 34 16 15 8 13 14 14 1 1 33 10 9 2 4 4 3 3 1 33 15 14 7 4 6 6 1 1 34 16 16 8 13 14 14 6 1 33 9 10 9 5 7 6 9 1 34 12 11 8 1...
output:
? 9 26 ? 9 25 ? 9 1 ? 9 30 ? 9 32 ? 9 31 ? 13 31 ! 5 31 ? 12 28 ? 12 27 ? 12 3 ? 12 7 ? 12 5 ? 12 6 ? 15 6 ! 15 6 ? 14 30 ? 14 29 ? 14 5 ? 14 1 ? 14 32 ? 14 31 ? 24 31 ! 24 31 ? 10 27 ? 10 26 ? 10 2 ? 10 31 ? 10 33 ? 10 32 ? 11 32 ! 11 32 ? 26 9 ? 26 8 ? 26 34 ? 26 5 ? 26 3 ? 26 2 ? 26 1 ? 27 2 ! 27...
result:
ok ok (1000 test cases)
Test #8:
score: 0
Accepted
time: 11ms
memory: 3584kb
input:
1000 36 17 17 9 14 16 17 2 1 36 3 4 8 3 1 2 1 36 13 14 8 9 7 6 7 11 1 36 17 17 8 4 7 7 1 1 36 9 8 9 7 7 6 1 1 36 8 9 3 4 2 1 2 1 35 15 16 6 2 3 3 1 1 36 9 10 4 5 3 2 3 3 1 36 12 11 9 8 10 9 7 1 36 16 15 7 4 7 6 1 1 36 13 12 9 9 7 8 6 1 36 16 15 9 12 10 9 8 3 1 36 17 17 8 4 6 6 11 1 36 7 6 9 9 7 1 1 ...
output:
? 36 18 ? 36 17 ? 36 27 ? 36 22 ? 36 20 ? 36 19 ? 16 18 ! 20 18 ? 35 17 ? 35 16 ? 35 26 ? 35 21 ? 35 19 ? 35 20 ! 35 19 ? 15 33 ? 15 32 ? 15 6 ? 15 1 ? 15 3 ? 15 4 ? 15 5 ? 20 4 ! 10 4 ? 11 29 ? 11 28 ? 11 2 ? 11 7 ? 11 4 ? 11 3 ? 17 3 ! 17 3 ? 27 9 ? 27 8 ? 27 36 ? 27 5 ? 27 7 ? 27 6 ? 32 6 ! 32 6 ...
result:
ok ok (1000 test cases)
Test #9:
score: 0
Accepted
time: 17ms
memory: 3456kb
input:
1000 37 16 17 10 12 12 11 1 1 36 17 17 9 14 16 17 2 1 38 17 16 9 14 15 14 13 3 1 37 12 13 10 14 12 11 9 1 37 12 13 10 10 10 9 13 1 36 10 11 9 12 10 9 1 1 37 12 13 5 8 6 5 4 1 1 37 4 5 10 6 4 3 1 1 37 16 15 9 14 16 1 1 37 12 13 10 8 10 9 1 1 37 11 10 2 4 4 3 3 1 37 17 16 8 4 6 6 1 1 36 13 14 9 9 9 8 ...
output:
? 4 22 ? 4 21 ? 4 31 ? 4 26 ? 4 28 ? 4 27 ? 14 27 ! 14 27 ? 8 26 ? 8 25 ? 8 35 ? 8 30 ? 8 28 ? 8 27 ? 24 26 ! 28 26 ? 30 11 ? 30 10 ? 30 1 ? 30 6 ? 30 9 ? 30 8 ? 30 7 ? 4 7 ! 18 7 ? 31 12 ? 31 11 ? 31 21 ? 31 16 ? 31 14 ? 31 13 ? 4 13 ! 21 13 ? 35 16 ? 35 15 ? 35 25 ? 35 20 ? 35 18 ? 35 19 ? 6 19 ! ...
result:
ok ok (1000 test cases)
Test #10:
score: 0
Accepted
time: 23ms
memory: 3456kb
input:
1000 39 8 7 9 5 6 5 4 1 1 38 8 9 9 7 6 5 6 9 1 38 9 8 5 4 2 3 1 1 39 18 18 10 15 16 15 16 1 1 38 15 14 9 14 13 12 13 1 1 39 17 18 10 12 10 11 1 1 39 15 16 10 14 13 12 13 11 1 38 18 17 8 4 6 6 1 1 39 13 12 3 4 3 2 1 1 39 12 13 10 9 10 9 8 15 1 39 12 13 10 9 10 9 8 1 1 38 18 18 9 13 12 13 12 1 39 14 1...
output:
? 10 29 ? 10 28 ? 10 19 ? 10 24 ? 10 27 ? 10 26 ? 10 25 ? 13 25 ! 13 25 ? 37 18 ? 37 17 ? 37 28 ? 37 23 ? 37 20 ? 37 21 ? 37 22 ? 3 21 ! 33 21 ? 14 33 ? 14 32 ? 14 23 ? 14 28 ? 14 26 ? 14 25 ? 15 26 ! 15 26 ? 27 7 ? 27 6 ? 27 17 ? 27 12 ? 27 9 ? 27 10 ? 27 11 ? 2 10 ! 2 10 ? 10 29 ? 10 28 ? 10 19 ? ...
result:
ok ok (1000 test cases)
Test #11:
score: 0
Accepted
time: 10ms
memory: 3584kb
input:
1000 40 20 8 7 10 7 6 5 6 9 1 40 18 17 10 13 13 12 3 1 40 19 19 10 15 17 16 15 1 1 40 14 13 4 5 6 5 7 1 40 16 17 10 11 9 8 9 15 1 40 15 14 9 10 8 7 8 6 1 41 20 20 14 15 11 9 11 10 17 1 40 15 14 10 12 13 12 11 6 1 40 18 19 8 3 2 4 5 1 40 20 16 17 6 5 8 7 1 1 40 16 15 10 11 11 10 5 1 41 20 16 15 10 11...
output:
? 37 17 ? 30 10 ? 30 9 ? 30 40 ? 30 5 ? 30 8 ? 30 7 ? 30 6 ? 34 7 ! 26 7 ? 38 18 ? 38 17 ? 38 8 ? 38 13 ? 38 11 ? 38 12 ? 9 12 ! 27 12 ? 19 39 ? 19 38 ? 19 9 ? 19 4 ? 19 1 ? 19 2 ? 19 3 ? 33 3 ! 33 3 ? 4 24 ? 4 23 ? 4 14 ? 4 9 ? 4 12 ? 4 13 ? 7 14 ! 1 14 ? 35 15 ? 35 14 ? 35 25 ? 35 20 ? 35 22 ? 35 ...
result:
ok ok (1000 test cases)
Test #12:
score: 0
Accepted
time: 13ms
memory: 3584kb
input:
1000 42 17 18 6 5 4 5 1 1 41 16 15 6 5 6 5 1 1 41 20 5 6 7 2 3 2 1 1 41 3 4 11 6 3 2 1 1 41 9 10 3 4 2 1 2 1 41 8 7 6 3 3 2 1 1 41 19 19 11 16 17 16 17 1 1 41 19 18 10 14 12 11 10 2 1 41 9 8 10 10 7 8 1 1 41 17 18 7 2 3 3 1 1 41 5 4 10 6 3 4 5 1 42 20 19 10 16 19 1 1 41 18 19 8 6 6 7 1 1 41 16 17 11...
output:
? 14 35 ? 14 34 ? 14 4 ? 14 9 ? 14 6 ? 14 7 ? 17 6 ! 17 6 ? 29 8 ? 29 7 ? 29 39 ? 29 34 ? 29 37 ? 29 38 ? 33 38 ! 33 38 ? 7 27 ? 16 36 ? 16 35 ? 16 5 ? 16 41 ? 16 38 ? 16 39 ? 16 40 ! 16 40 ? 15 35 ? 15 34 ? 15 4 ? 15 40 ? 15 37 ? 15 36 ? 16 36 ! 16 36 ? 23 2 ? 23 1 ? 23 12 ? 23 7 ? 23 9 ? 23 10 ? 2...
result:
ok ok (1000 test cases)
Test #13:
score: 0
Accepted
time: 18ms
memory: 3584kb
input:
1000 43 9 10 8 4 5 3 4 1 1 42 18 17 7 2 2 1 2 1 43 6 5 9 3 4 3 2 1 1 43 8 9 11 5 6 5 4 1 1 43 14 13 10 16 14 1 1 43 18 17 10 13 13 14 4 1 43 18 17 9 13 10 9 8 1 1 43 21 20 19 9 4 2 3 2 1 1 42 21 19 20 10 16 17 16 17 1 1 42 20 20 9 4 2 3 2 3 1 42 9 10 10 6 7 6 5 1 1 43 17 16 8 12 9 8 7 5 1 42 15 14 1...
output:
? 19 40 ? 19 39 ? 19 8 ? 19 2 ? 19 5 ? 19 3 ? 19 4 ? 21 3 ! 21 3 ? 16 37 ? 16 36 ? 16 26 ? 16 21 ? 16 18 ? 16 20 ? 16 19 ! 16 20 ? 4 25 ? 4 24 ? 4 14 ? 4 20 ? 4 23 ? 4 22 ? 4 21 ? 5 21 ! 5 21 ? 32 10 ? 32 9 ? 32 21 ? 32 15 ? 32 12 ? 32 13 ? 32 14 ? 35 14 ! 35 14 ? 28 6 ? 28 5 ? 28 38 ? 28 1 ? 28 4 ?...
result:
ok ok (1000 test cases)
Test #14:
score: 0
Accepted
time: 11ms
memory: 3584kb
input:
1000 44 14 15 11 15 12 13 13 1 44 15 16 10 10 7 8 1 1 43 12 11 3 7 4 3 2 3 1 43 13 14 11 8 11 9 15 1 44 17 18 11 12 9 10 17 1 44 16 15 11 17 16 1 1 44 21 21 10 5 7 6 5 1 1 44 18 17 11 13 14 12 13 5 1 43 9 10 6 4 3 3 2 3 1 43 14 15 9 9 6 7 1 1 44 15 16 4 5 7 5 1 1 44 20 19 9 5 6 7 1 1 44 17 16 11 12 ...
output:
? 17 39 ? 17 38 ? 17 6 ? 17 44 ? 17 41 ? 17 42 ? 28 41 ! 6 41 ? 43 21 ? 43 20 ? 43 32 ? 43 26 ? 43 29 ? 43 30 ? 5 29 ! 5 29 ? 25 3 ? 25 2 ? 25 35 ? 25 41 ? 25 38 ? 25 37 ? 25 36 ? 26 36 ! 24 36 ? 35 13 ? 35 12 ? 35 24 ? 35 18 ? 35 21 ? 35 19 ? 42 18 ! 28 18 ? 10 32 ? 10 31 ? 10 43 ? 10 37 ? 10 40 ? ...
result:
ok ok (1000 test cases)
Test #15:
score: 0
Accepted
time: 17ms
memory: 3456kb
input:
1000 45 19 20 12 18 17 18 8 1 45 15 16 4 6 7 5 1 1 45 11 12 4 6 3 2 3 3 1 45 6 5 9 3 4 3 2 3 1 45 11 12 12 16 13 12 1 1 45 4 5 11 5 2 3 1 1 45 18 19 12 18 20 19 1 1 45 7 8 10 4 5 4 3 1 1 44 21 20 10 4 2 3 2 2 1 45 20 21 9 6 6 5 6 1 1 44 20 21 9 5 8 8 9 15 1 45 15 14 11 12 13 12 11 1 1 44 16 15 11 13...
output:
? 21 43 ? 21 42 ? 21 9 ? 21 3 ? 21 45 ? 21 1 ? 37 45 ! 5 45 ? 9 31 ? 9 30 ? 9 42 ? 9 3 ? 9 45 ? 9 43 ? 12 42 ! 12 42 ? 19 41 ? 19 40 ? 19 7 ? 19 1 ? 19 4 ? 19 5 ? 19 6 ? 20 5 ! 18 5 ? 33 10 ? 33 9 ? 33 44 ? 33 5 ? 33 8 ? 33 7 ? 33 6 ? 34 6 ! 32 6 ? 37 14 ? 37 13 ? 37 25 ? 37 19 ? 37 16 ? 37 15 ? 2 1...
result:
ok ok (1000 test cases)
Test #16:
score: 0
Accepted
time: 21ms
memory: 3456kb
input:
1000 46 22 21 10 5 8 10 2 1 46 15 16 11 9 12 10 1 1 46 12 13 11 16 13 11 12 1 1 46 19 20 11 15 16 15 14 15 1 46 11 10 11 11 8 9 13 1 46 13 12 7 7 4 5 7 1 46 8 9 11 12 9 7 8 1 1 46 8 9 6 2 3 1 2 1 46 22 22 11 17 20 21 21 4 1 46 3 4 11 5 2 2 1 1 45 22 21 20 11 17 20 2 1 46 8 7 8 2 5 3 3 1 46 20 19 8 2...
output:
? 20 43 ? 20 42 ? 20 31 ? 20 25 ? 20 28 ? 20 30 ? 29 31 ! 11 31 ? 21 44 ? 21 43 ? 21 10 ? 21 4 ? 21 7 ? 21 5 ? 29 4 ! 29 4 ? 29 6 ? 29 5 ? 29 18 ? 29 12 ? 29 9 ? 29 7 ? 29 8 ? 39 7 ! 39 7 ? 24 1 ? 24 46 ? 24 13 ? 24 7 ? 24 4 ? 24 5 ? 24 6 ? 37 6 ! 11 6 ? 27 4 ? 27 3 ? 27 38 ? 27 44 ? 27 1 ? 27 46 ? ...
result:
ok ok (1000 test cases)
Test #17:
score: 0
Accepted
time: 68ms
memory: 3456kb
input:
1000 1000000000 499999999 499999998 249999999 125000000 187499999 156250000 171875000 179687499 175781249 173828124 172851562 172363282 172607422 172485353 172546387 172515870 172500611 172492982 172489167 172487260 172486306 172485830 172486068 172485949 172485889 172485859 172485844 172485838 1724...
output:
? 699561538 199561538 ? 699561538 199561537 ? 699561538 949561538 ? 699561538 824561538 ? 699561538 887061538 ? 699561538 855811538 ? 699561538 871436538 ? 699561538 879249038 ? 699561538 875342788 ? 699561538 873389663 ? 699561538 872413101 ? 699561538 871924820 ? 699561538 872168961 ? 699561538 87...
result:
ok ok (1000 test cases)
Test #18:
score: 0
Accepted
time: 55ms
memory: 3584kb
input:
1000 1000000000 499999969 499999968 250000000 374999969 312499969 281250000 296875000 304687469 300781219 298828125 299804688 300292938 300048798 299926728 299865693 299835206 299850465 299858064 299854280 299856188 299857111 299856634 299856427 299856515 299856487 299856517 299856529 299856522 2998...
output:
? 103394359 603394359 ? 103394359 603394358 ? 103394359 353394359 ? 103394359 478394359 ? 103394359 415894359 ? 103394359 384644359 ? 103394359 400269359 ? 103394359 408081859 ? 103394359 404175609 ? 103394359 402222484 ? 103394359 403199047 ? 103394359 403687328 ? 103394359 403443188 ? 103394359 40...
result:
ok ok (1000 test cases)
Test #19:
score: 0
Accepted
time: 71ms
memory: 3456kb
input:
1000 1000000000 343272799 343272798 250000000 218272799 187500001 187022799 171875001 179210299 175304049 173350924 172374362 171886081 171641940 171752930 171691895 171661377 171646118 171638489 171638126 171636581 171637173 171636696 171636458 171636461 171636401 171636429 171636414 171636407 1716...
output:
? 408710495 908710495 ? 408710495 908710494 ? 408710495 658710495 ? 408710495 783710495 ? 408710495 721210495 ? 408710495 752460495 ? 408710495 736835495 ? 408710495 744647995 ? 408710495 740741745 ? 408710495 738788620 ? 408710495 737812058 ? 408710495 737323777 ? 408710495 737079636 ? 408710495 73...
result:
ok ok (1000 test cases)
Test #20:
score: 0
Accepted
time: 71ms
memory: 3584kb
input:
1000 1000000000 357404264 357404265 250000000 232404264 187500072 201154264 185529264 179687572 181623014 179669889 178711009 179181608 178937468 178815398 178754363 178723845 178708586 178703379 178704772 178702865 178702425 178702388 178702186 178702269 178702210 178702180 178702171 178702173 1787...
output:
? 206055179 706055179 ? 206055179 706055178 ? 206055179 956055179 ? 206055179 831055179 ? 206055179 893555179 ? 206055179 862305179 ? 206055179 877930179 ? 206055179 885742679 ? 206055179 881836429 ? 206055179 883789554 ? 206055179 884766116 ? 206055179 884277835 ? 206055179 884521975 ? 206055179 88...
result:
ok ok (1000 test cases)
Test #21:
score: 0
Accepted
time: 58ms
memory: 3456kb
input:
1000 1000000000 288090905 288090904 250000000 183449539 225590905 194340905 178715905 175637039 174809655 173683914 173833093 173344812 173439773 173317702 173283777 173287184 173271925 173276148 173272334 173270427 173270971 173270494 173270255 173270308 173270249 173270225 173270234 173270227 1732...
output:
? 572948634 72948634 ? 572948634 72948633 ? 572948634 822948634 ? 572948634 947948634 ? 572948634 10448634 ? 572948634 979198634 ? 572948634 963573634 ? 572948634 955761134 ? 572948634 959667384 ? 572948634 957714259 ? 572948634 958690822 ? 572948634 958202541 ? 572948634 957958400 ? 572948634 95808...
result:
ok ok (1000 test cases)
Test #22:
score: -100
Wrong Answer
time: 13ms
memory: 3456kb
input:
1000 999999999 499999999 499999999 499999998 499999997 249999998 124999999 187499998 156249999 171874998 164062499 167968749 169921874 170898437 171386718 171630858 171508788 171447754 171478272 171493531 171501159 171497345 171495439 171496392 171495916 171496154 171496035 171495975 171495945 17149...
output:
? 385018619 885018618 ? 446459416 946459415 ? 47122622 547122621 ? 47122622 547122620 ? 47122622 297122621 ? 47122622 172122621 ? 47122622 234622621 ? 47122622 203372621 ? 47122622 218997621 ? 47122622 211185121 ? 47122622 215091371 ? 47122622 217044496 ? 47122622 218021059 ? 47122622 218509340 ? 47...
result:
wrong answer Too many queries: 41 (test case 235)