QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#882683 | #9734. Identify Chord | rbtree | WA | 70ms | 3584kb | C++26 | 5.7kb | 2025-02-05 10:41:59 | 2025-02-05 10:41:59 |
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;
while (true) {
x = lib::rng(0, n - 1);
y = (x + n / 2) % n;
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 1 1 4 1 1
output:
? 2 5 ? 2 4 ! 2 4 ? 3 1 ! 3 1
result:
ok ok (2 test cases)
Test #2:
score: 0
Accepted
time: 21ms
memory: 3456kb
input:
1000 15 6 6 4 4 5 6 1 19 9 4 5 5 2 3 1 1 17 8 8 3 2 4 3 3 1 15 7 7 7 7 7 6 6 4 6 1 1 14 5 6 3 5 6 3 1 15 7 1 2 4 3 2 1 17 4 5 4 2 3 1 1 20 6 7 5 4 3 4 5 1 13 3 4 4 2 3 3 1 18 3 4 4 3 2 3 1 13 4 5 4 5 3 1 14 4 5 3 4 3 1 1 17 5 6 3 3 2 3 1 12 3 4 3 2 3 1 1 10 5 5 3 4 2 2 1 1 14 7 6 6 3 4 4 6 1 19 7 6 ...
output:
? 11 3 ? 11 2 ? 11 7 ? 11 5 ? 11 6 ? 14 5 ! 8 5 ? 8 17 ? 11 1 ? 11 19 ? 11 6 ? 11 3 ? 11 4 ? 12 3 ! 12 3 ? 7 15 ? 15 6 ? 4 12 ? 4 11 ? 4 8 ? 4 10 ? 5 11 ! 3 11 ? 4 11 ? 5 12 ? 2 9 ? 8 15 ? 9 1 ? 11 3 ? 11 2 ? 11 7 ? 11 5 ? 1 3 ! 1 3 ? 9 2 ? 9 1 ? 9 6 ? 9 4 ? 9 3 ? 13 2 ! 5 2 ? 14 6 ? 2 9 ? 2 8 ? 2 1...
result:
ok ok (1000 test cases)
Test #3:
score: 0
Accepted
time: 8ms
memory: 3584kb
input:
1000 21 3 4 6 3 2 1 1 22 6 5 4 3 2 3 3 1 20 10 9 9 5 7 7 1 1 22 6 7 5 7 5 6 1 1 21 10 6 7 3 4 3 2 3 1 21 7 6 4 5 4 3 1 1 24 5 6 6 8 6 8 1 22 10 9 5 8 8 1 1 21 6 7 5 4 3 4 1 1 23 7 6 5 8 7 1 1 21 5 6 6 3 4 5 1 24 11 10 6 9 9 2 1 20 9 9 5 7 7 6 1 24 11 10 5 2 1 1 23 11 8 9 6 9 9 1 1 23 6 5 5 3 4 5 1 2...
output:
? 20 9 ? 20 8 ? 20 14 ? 20 11 ? 20 10 ? 21 10 ! 21 10 ? 18 7 ? 18 6 ? 18 1 ? 18 4 ? 18 3 ? 18 2 ? 19 3 ! 17 3 ? 18 8 ? 19 9 ? 19 8 ? 19 14 ? 19 11 ? 19 12 ? 5 11 ! 5 11 ? 3 14 ? 3 13 ? 3 20 ? 3 17 ? 3 15 ? 3 16 ? 7 15 ! 7 15 ? 11 21 ? 14 3 ? 14 2 ? 14 8 ? 14 5 ? 14 6 ? 14 7 ? 15 7 ! 13 7 ? 13 2 ? 13...
result:
ok ok (1000 test cases)
Test #4:
score: 0
Accepted
time: 12ms
memory: 3584kb
input:
1000 25 10 11 7 10 9 10 1 1 25 5 6 5 2 3 3 1 25 8 7 6 9 8 5 1 25 6 7 6 3 4 5 1 26 12 12 6 9 8 8 10 1 26 9 8 6 10 9 5 1 26 13 13 11 12 6 10 10 11 5 1 27 12 11 5 2 1 1 25 12 8 9 7 10 9 1 1 27 9 8 4 6 4 3 1 1 27 10 9 3 3 4 1 1 27 11 12 7 8 6 7 1 1 26 5 6 6 4 4 3 5 1 25 9 8 3 3 4 1 1 27 7 8 4 4 2 3 3 1 ...
output:
? 18 5 ? 18 4 ? 18 11 ? 18 8 ? 18 6 ? 18 7 ? 1 6 ! 1 6 ? 10 22 ? 10 21 ? 10 3 ? 10 25 ? 10 1 ? 11 25 ! 9 25 ? 12 24 ? 12 23 ? 12 18 ? 12 21 ? 12 22 ? 18 23 ! 6 23 ? 13 25 ? 13 24 ? 13 6 ? 13 3 ? 13 4 ? 15 3 ! 11 3 ? 1 14 ? 1 13 ? 1 21 ? 1 17 ? 1 19 ? 1 18 ? 8 18 ! 20 18 ? 13 26 ? 13 25 ? 13 19 ? 13 ...
result:
ok ok (1000 test cases)
Test #5:
score: 0
Accepted
time: 8ms
memory: 3456kb
input:
1000 29 5 6 8 8 6 1 1 28 3 4 7 4 2 3 3 1 30 3 2 7 5 3 3 1 29 5 6 8 4 4 3 5 1 28 10 11 3 3 5 4 1 1 29 9 10 8 6 6 5 1 1 29 14 11 10 7 11 11 4 1 28 11 10 6 8 6 5 1 1 30 8 9 6 4 4 3 1 1 30 15 6 7 7 10 8 7 10 1 28 11 10 4 3 2 3 3 1 29 14 14 14 13 12 7 11 11 1 1 29 12 13 5 4 5 4 7 1 29 13 13 6 4 4 5 1 1 2...
output:
? 18 3 ? 18 2 ? 18 10 ? 18 6 ? 18 4 ? 22 3 ! 22 3 ? 9 23 ? 9 22 ? 9 2 ? 9 26 ? 9 24 ? 9 25 ? 10 24 ! 8 24 ? 18 3 ? 18 2 ? 18 25 ? 18 29 ? 18 1 ? 19 2 ! 17 2 ? 15 29 ? 15 28 ? 15 7 ? 15 3 ? 15 1 ? 15 2 ? 17 2 ! 13 2 ? 21 7 ? 21 6 ? 21 14 ? 21 18 ? 21 16 ? 21 15 ? 23 14 ! 23 14 ? 14 28 ? 14 27 ? 14 6 ...
result:
ok ok (1000 test cases)
Test #6:
score: 0
Accepted
time: 18ms
memory: 3584kb
input:
1000 32 15 14 8 12 14 2 1 30 14 14 7 11 13 13 4 1 32 14 15 8 10 8 9 1 1 31 5 4 7 5 3 4 1 1 32 3 4 8 5 3 2 3 1 32 6 5 8 6 4 5 1 1 31 10 11 8 6 6 5 9 1 31 5 4 7 7 5 1 1 32 16 12 11 8 8 8 7 1 1 30 14 14 6 2 1 1 31 9 10 8 9 7 8 1 1 31 10 11 8 12 12 11 6 1 33 11 12 9 11 9 10 1 1 32 11 10 8 7 7 6 6 1 32 1...
output:
? 22 6 ? 22 5 ? 22 30 ? 22 2 ? 22 4 ? 3 5 ! 9 5 ? 10 25 ? 10 24 ? 10 3 ? 10 29 ? 10 27 ? 10 26 ? 22 26 ! 28 26 ? 19 3 ? 19 2 ? 19 11 ? 19 7 ? 19 9 ? 19 10 ? 26 9 ! 26 9 ? 2 17 ? 2 16 ? 2 9 ? 2 13 ? 2 15 ? 2 14 ? 4 15 ! 4 15 ? 4 20 ? 4 19 ? 4 28 ? 4 24 ? 4 22 ? 4 21 ? 5 21 ! 3 21 ? 20 4 ? 20 3 ? 20 2...
result:
ok ok (1000 test cases)
Test #7:
score: 0
Accepted
time: 12ms
memory: 3584kb
input:
1000 34 16 15 8 13 14 13 2 1 33 12 11 4 4 4 3 5 1 33 15 15 7 3 3 4 1 1 34 13 12 6 9 7 6 5 5 1 34 15 14 8 13 13 12 3 1 35 14 13 8 10 10 9 1 1 34 16 15 7 4 6 7 2 1 34 6 5 8 4 4 3 1 1 34 16 16 7 4 6 7 13 1 33 16 9 10 3 5 3 2 3 1 33 15 14 7 3 2 3 1 1 34 16 16 8 13 15 15 4 1 33 16 8 7 6 4 4 3 1 1 34 12 1...
output:
? 17 34 ? 17 33 ? 17 25 ? 17 30 ? 17 32 ? 17 31 ? 29 31 ! 5 31 ? 8 24 ? 8 23 ? 8 16 ? 8 12 ? 8 14 ? 8 15 ? 10 15 ! 6 15 ? 29 12 ? 29 11 ? 29 20 ? 29 24 ? 29 26 ? 29 25 ? 31 24 ! 31 24 ? 2 19 ? 2 18 ? 2 10 ? 2 15 ? 2 13 ? 2 12 ? 2 11 ? 6 11 ! 32 11 ? 13 30 ? 13 29 ? 13 21 ? 13 26 ? 13 28 ? 13 27 ? 24...
result:
ok ok (1000 test cases)
Test #8:
score: 0
Accepted
time: 12ms
memory: 3584kb
input:
1000 36 17 16 9 13 11 10 9 1 1 36 17 17 9 13 11 10 10 1 1 36 18 13 14 6 9 7 6 5 9 1 36 13 14 6 9 7 6 5 1 1 36 9 10 9 13 11 10 1 1 36 16 15 7 4 5 6 3 1 35 17 16 16 9 14 14 15 1 1 36 9 10 9 13 11 10 10 1 36 4 5 9 6 4 3 5 1 36 18 16 15 9 14 16 1 1 36 3 4 9 5 3 2 1 1 36 12 11 9 8 6 7 7 1 36 17 16 8 4 7 ...
output:
? 10 28 ? 10 27 ? 10 19 ? 10 24 ? 10 22 ? 10 21 ? 10 20 ? 18 20 ! 18 20 ? 10 28 ? 10 27 ? 10 1 ? 10 32 ? 10 34 ? 10 35 ? 10 36 ? 19 35 ! 19 35 ? 7 25 ? 14 32 ? 14 31 ? 14 5 ? 14 36 ? 14 2 ? 14 3 ? 14 4 ? 18 4 ! 10 4 ? 13 31 ? 13 30 ? 13 4 ? 13 35 ? 13 1 ? 13 2 ? 13 3 ? 17 3 ! 17 3 ? 24 6 ? 24 5 ? 24...
result:
ok ok (1000 test cases)
Test #9:
score: 0
Accepted
time: 12ms
memory: 3584kb
input:
1000 37 11 12 4 7 5 4 3 1 1 36 17 17 9 13 11 10 10 16 1 38 9 10 9 6 7 6 5 9 1 37 18 11 10 2 4 2 1 1 37 12 13 10 8 8 7 13 1 36 8 7 9 10 8 1 1 37 5 6 10 9 7 6 1 1 37 4 3 9 4 2 3 3 1 37 17 17 8 5 6 5 6 9 1 37 10 9 7 6 4 5 7 1 37 9 8 9 5 7 6 1 1 37 18 18 17 16 9 13 12 12 1 1 36 11 12 9 7 9 8 1 1 37 14 1...
output:
? 25 6 ? 25 5 ? 25 15 ? 25 10 ? 25 12 ? 25 13 ? 25 14 ? 27 14 ! 27 14 ? 1 19 ? 1 18 ? 1 28 ? 1 23 ? 1 25 ? 1 26 ? 1 27 ? 10 26 ! 28 26 ? 22 3 ? 22 2 ? 22 13 ? 22 8 ? 22 5 ? 22 6 ? 22 7 ? 26 7 ! 18 7 ? 17 35 ? 13 31 ? 13 30 ? 13 22 ? 13 17 ? 13 20 ? 13 21 ! 13 21 ? 33 14 ? 33 13 ? 33 23 ? 33 18 ? 33 ...
result:
ok ok (1000 test cases)
Test #10:
score: 0
Accepted
time: 8ms
memory: 3584kb
input:
1000 39 8 7 6 3 3 2 1 1 38 8 7 8 3 5 4 1 1 38 9 8 9 12 9 1 1 39 13 14 10 8 10 9 15 1 38 15 14 9 14 15 1 1 39 15 16 10 10 10 9 1 1 39 16 15 6 3 4 3 2 3 1 38 18 17 9 13 12 12 1 1 39 13 14 10 15 15 14 1 1 39 12 13 2 5 2 1 1 39 4 3 9 5 2 3 1 1 38 18 17 9 13 11 10 10 1 1 39 17 16 9 14 15 14 15 3 1 38 12 ...
output:
? 12 31 ? 12 30 ? 12 21 ? 12 26 ? 12 24 ? 12 25 ? 13 25 ! 13 25 ? 19 38 ? 19 37 ? 19 28 ? 19 33 ? 19 31 ? 19 32 ? 21 33 ! 21 33 ? 8 27 ? 8 26 ? 8 17 ? 8 22 ? 8 25 ? 15 26 ! 15 26 ? 17 36 ? 17 35 ? 17 7 ? 17 2 ? 17 4 ? 17 3 ? 24 2 ! 10 2 ? 8 27 ? 8 26 ? 8 17 ? 8 22 ? 8 25 ? 21 26 ! 21 26 ? 15 34 ? 15...
result:
ok ok (1000 test cases)
Test #11:
score: 0
Accepted
time: 16ms
memory: 3584kb
input:
1000 40 2 1 10 5 2 1 40 6 7 10 9 6 5 9 1 40 11 10 1 5 3 2 1 40 8 7 10 7 6 5 6 1 1 40 16 15 10 11 11 10 1 1 40 11 12 10 8 9 8 7 1 1 41 18 19 8 3 3 4 1 1 40 7 6 7 2 4 3 1 1 40 18 17 8 5 6 5 6 1 1 40 6 5 10 5 4 3 4 1 1 40 14 15 8 9 7 6 7 1 1 41 5 4 10 8 5 1 1 40 9 8 9 4 6 5 7 1 40 14 13 10 9 11 10 7 1 ...
output:
? 7 27 ? 7 26 ? 7 17 ? 7 22 ? 7 25 ! 7 26 ? 31 11 ? 31 10 ? 31 21 ? 31 16 ? 31 13 ? 31 12 ? 35 12 ! 27 12 ? 33 13 ? 33 12 ? 33 3 ? 33 38 ? 33 1 ? 33 2 ! 33 3 ? 37 17 ? 37 16 ? 37 7 ? 37 12 ? 37 15 ? 37 14 ? 37 13 ? 1 14 ! 1 14 ? 14 34 ? 14 33 ? 14 24 ? 14 29 ? 14 27 ? 14 28 ? 23 28 ! 23 28 ? 9 29 ? ...
result:
ok ok (1000 test cases)
Test #12:
score: 0
Accepted
time: 11ms
memory: 3584kb
input:
1000 42 11 12 6 6 3 4 5 1 41 17 18 11 12 10 11 18 1 41 17 16 10 12 12 11 4 1 41 7 6 10 6 5 4 5 7 1 41 20 8 7 8 3 5 4 1 1 41 9 10 11 10 7 8 13 1 41 17 18 11 16 15 16 1 1 41 4 3 10 7 4 5 1 41 10 11 6 5 3 4 5 1 41 15 16 7 10 8 7 6 11 1 41 17 18 11 12 10 9 10 1 1 42 20 19 10 15 13 14 13 1 1 41 12 13 4 7...
output:
? 19 40 ? 19 39 ? 19 9 ? 19 3 ? 19 6 ? 19 7 ? 21 6 ! 17 6 ? 6 26 ? 6 25 ? 6 36 ? 6 31 ? 6 33 ? 6 34 ? 15 33 ! 38 33 ? 26 5 ? 26 4 ? 26 36 ? 26 41 ? 26 39 ? 26 40 ? 36 40 ! 16 40 ? 19 39 ? 19 38 ? 19 29 ? 19 34 ? 19 37 ? 19 36 ? 19 35 ? 22 36 ! 16 36 ? 38 17 ? 8 28 ? 8 27 ? 8 18 ? 8 23 ? 8 21 ? 8 22 ...
result:
ok ok (1000 test cases)
Test #13:
score: 0
Accepted
time: 16ms
memory: 3456kb
input:
1000 43 20 19 9 5 8 9 2 1 42 18 19 7 5 5 4 5 7 1 43 7 8 6 2 3 1 2 1 43 8 9 11 5 6 5 4 1 1 43 14 13 10 15 12 13 1 1 43 7 6 6 2 3 1 2 1 43 19 20 8 6 9 9 15 1 43 21 20 19 10 16 18 17 17 1 1 42 17 16 6 5 4 3 4 5 1 42 20 19 10 16 19 1 1 42 13 12 10 8 9 7 8 9 1 43 16 15 10 11 13 12 6 1 42 15 16 10 16 13 1...
output:
? 11 32 ? 11 31 ? 11 21 ? 11 16 ? 11 19 ? 11 20 ? 19 21 ! 3 21 ? 23 2 ? 23 1 ? 23 13 ? 23 18 ? 23 15 ? 23 16 ? 23 17 ? 26 16 ! 20 16 ? 21 42 ? 21 41 ? 21 10 ? 21 4 ? 21 7 ? 21 5 ? 21 6 ! 21 5 ? 32 10 ? 32 9 ? 32 21 ? 32 15 ? 32 12 ? 32 13 ? 32 14 ? 35 14 ! 35 14 ? 29 7 ? 29 6 ? 29 39 ? 29 2 ? 29 5 ?...
result:
ok ok (1000 test cases)
Test #14:
score: 0
Accepted
time: 11ms
memory: 3584kb
input:
1000 44 14 15 11 17 14 13 11 1 44 13 12 10 8 7 7 6 10 1 43 10 11 11 15 12 11 1 1 43 16 17 11 17 14 15 1 1 44 17 16 11 12 11 11 10 1 1 44 16 15 11 17 14 15 1 1 44 13 14 8 8 5 6 9 1 44 8 7 11 11 8 13 1 43 8 7 9 3 6 4 1 1 43 4 5 9 3 2 1 2 1 44 15 16 11 14 13 12 13 1 1 44 20 21 11 15 12 11 10 19 1 44 3 ...
output:
? 18 40 ? 18 39 ? 18 7 ? 18 1 ? 18 42 ? 18 41 ? 30 41 ! 6 41 ? 34 12 ? 34 11 ? 34 1 ? 34 7 ? 34 4 ? 34 6 ? 34 5 ? 39 5 ! 29 5 ? 15 36 ? 15 35 ? 15 4 ? 15 41 ? 15 38 ? 15 37 ? 24 36 ! 24 36 ? 5 26 ? 5 25 ? 5 37 ? 5 31 ? 5 28 ? 5 29 ? 18 28 ! 18 28 ? 31 9 ? 31 8 ? 31 42 ? 31 4 ? 31 1 ? 31 3 ? 31 2 ? 4...
result:
ok ok (1000 test cases)
Test #15:
score: 0
Accepted
time: 12ms
memory: 3584kb
input:
1000 45 19 20 10 14 11 10 9 17 1 45 22 12 11 5 7 4 3 4 5 1 45 22 10 9 11 9 8 7 8 1 1 45 19 20 8 6 9 9 1 1 45 12 13 5 7 4 3 4 5 1 45 20 19 11 15 12 11 12 3 1 45 19 20 8 6 5 6 9 1 45 12 11 11 7 8 6 7 11 1 44 19 18 11 14 14 13 14 1 1 45 17 18 12 16 15 14 15 1 1 44 20 19 11 15 14 14 15 1 1 45 22 15 14 4...
output:
? 13 35 ? 13 34 ? 13 1 ? 13 40 ? 13 43 ? 13 44 ? 13 45 ? 21 45 ! 5 45 ? 27 4 ? 44 21 ? 44 20 ? 44 10 ? 44 16 ? 44 13 ? 44 12 ? 44 11 ? 1 12 ! 42 12 ? 12 34 ? 44 21 ? 44 20 ? 44 10 ? 44 16 ? 44 19 ? 44 18 ? 44 17 ? 5 18 ! 5 18 ? 44 21 ? 44 20 ? 44 32 ? 44 38 ? 44 35 ? 44 33 ? 6 32 ! 6 32 ? 16 38 ? 16...
result:
ok ok (1000 test cases)
Test #16:
score: 0
Accepted
time: 17ms
memory: 3584kb
input:
1000 46 14 15 11 10 11 10 9 1 1 46 3 2 11 7 4 3 1 1 46 16 17 4 5 7 5 1 1 46 19 20 11 17 20 20 5 1 46 5 6 11 11 8 6 9 1 46 7 6 11 11 8 7 1 1 46 12 13 11 12 9 10 1 1 46 8 7 11 12 9 8 1 1 46 22 21 10 4 2 3 3 1 1 46 23 19 20 11 13 12 12 11 1 1 45 19 20 12 16 17 16 15 12 1 46 22 21 10 5 8 9 9 2 1 46 18 1...
output:
? 3 26 ? 3 25 ? 3 38 ? 3 32 ? 3 29 ? 3 30 ? 3 31 ? 11 31 ! 11 31 ? 28 5 ? 28 4 ? 28 39 ? 28 45 ? 28 2 ? 28 3 ? 29 4 ! 29 4 ? 4 27 ? 4 26 ? 4 39 ? 4 45 ? 4 42 ? 4 40 ? 7 39 ! 7 39 ? 29 6 ? 29 5 ? 29 18 ? 29 12 ? 29 9 ? 29 7 ? 1 6 ! 11 6 ? 24 1 ? 24 46 ? 24 13 ? 24 7 ? 24 4 ? 24 2 ? 28 1 ! 20 1 ? 9 32...
result:
ok ok (1000 test cases)
Test #17:
score: 0
Accepted
time: 62ms
memory: 3584kb
input:
1000 1000000000 499999999 499999998 249999999 124999999 62500000 93749999 78125000 85937499 82031249 80078124 79101562 78613282 78857422 78735353 78796388 78826906 78842165 78849793 78845979 78844073 78845027 78845503 78845265 78845146 78845087 78845116 78845101 78845095 78845098 78845097 78845098 1...
output:
? 793202283 293202283 ? 793202283 293202282 ? 793202283 43202283 ? 793202283 918202283 ? 793202283 855702283 ? 793202283 886952283 ? 793202283 871327283 ? 793202283 879139783 ? 793202283 875233533 ? 793202283 873280408 ? 793202283 872303846 ? 793202283 871815565 ? 793202283 872059706 ? 793202283 871...
result:
ok ok (1000 test cases)
Test #18:
score: 0
Accepted
time: 70ms
memory: 3584kb
input:
1000 1000000000 499999969 499999970 249999969 125000000 187500000 218749969 203125000 210937469 207031250 208984344 208007813 208496094 208740235 208862274 208801270 208831788 208847016 208839387 208835603 208837480 208836557 208837003 208836796 208836884 208836856 208836886 208836892 208836885 2088...
output:
? 612087785 112087785 ? 612087785 112087784 ? 612087785 362087785 ? 612087785 487087785 ? 612087785 424587785 ? 612087785 393337785 ? 612087785 408962785 ? 612087785 401150285 ? 612087785 405056535 ? 612087785 403103410 ? 612087785 404079972 ? 612087785 403591691 ? 612087785 403347550 ? 612087785 40...
result:
ok ok (1000 test cases)
Test #19:
score: 0
Accepted
time: 59ms
memory: 3584kb
input:
1000 1000000000 403955923 403955924 250000000 278955923 216455923 218750001 203125001 208643423 204737173 202784048 202148438 202295767 202051627 202026367 201990592 201995849 201980590 201982963 201979149 201978682 201978196 201978205 201977966 201978077 201978018 201977988 201977973 201977966 2019...
output:
? 535096135 35096135 ? 535096135 35096134 ? 535096135 285096135 ? 535096135 160096135 ? 535096135 222596135 ? 535096135 253846135 ? 535096135 238221135 ? 535096135 230408635 ? 535096135 234314885 ? 535096135 236268010 ? 535096135 237244572 ? 535096135 236756291 ? 535096135 237000431 ? 535096135 2371...
result:
ok ok (1000 test cases)
Test #20:
score: 0
Accepted
time: 62ms
memory: 3584kb
input:
1000 1000000000 305065948 305065949 250000000 180065948 187500072 156250072 164440948 156628448 152722198 154296947 153320384 152832103 152587962 152600128 152539093 152557444 152542185 152534556 152535279 152533372 152533602 152533125 152533134 152533015 152533065 152533035 152533020 152533012 1525...
output:
? 232224337 732224337 ? 232224337 732224336 ? 232224337 982224337 ? 232224337 857224337 ? 232224337 919724337 ? 232224337 888474337 ? 232224337 872849337 ? 232224337 880661837 ? 232224337 884568087 ? 232224337 886521212 ? 232224337 885544649 ? 232224337 885056368 ? 232224337 884812227 ? 232224337 88...
result:
ok ok (1000 test cases)
Test #21:
score: 0
Accepted
time: 58ms
memory: 3584kb
input:
1000 1000000000 416165561 416165562 250000000 375000000 353665561 381840905 366215905 358403405 354497155 352544030 352688999 352200718 352299889 352177818 352139683 352147300 352132041 352132054 352128240 352130133 352129179 352128702 352128464 352128345 352128285 352128255 352128240 352128233 3521...
output:
? 394090623 894090623 ? 394090623 894090622 ? 394090623 144090623 ? 394090623 19090623 ? 394090623 956590623 ? 394090623 987840623 ? 394090623 972215623 ? 394090623 964403123 ? 394090623 960496873 ? 394090623 958543748 ? 394090623 957567185 ? 394090623 958055466 ? 394090623 958299607 ? 394090623 958...
result:
ok ok (1000 test cases)
Test #22:
score: -100
Wrong Answer
time: 7ms
memory: 3584kb
input:
1000 999999999 499999998 499999997 249999999 374999998 312499999 343749999 359374999 367187498 363281248 361328124 362304686 361816406 362060547 362182617 362243652 362274170 362289429 362297057 362293244 362295150 362294198 362294674 362294436 362294317 362294258 362294287 362294273 362294280 36229...
output:
? 856324270 356324270 ? 856324270 356324269 ? 856324270 106324270 ? 856324270 231324270 ? 856324270 168824270 ? 856324270 200074270 ? 856324270 215699270 ? 856324270 223511770 ? 856324270 219605520 ? 856324270 217652395 ? 856324270 218628958 ? 856324270 218140677 ? 856324270 218384818 ? 856324270 21...
result:
wrong answer Too many queries: 41 (test case 143)