QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#882713 | #9734. Identify Chord | rbtree | WA | 72ms | 3584kb | C++26 | 6.1kb | 2025-02-05 10:52:57 | 2025-02-05 10:53:06 |
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) <= 100000 || abs(y - i) <= 100000) {
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[]) {
}
// :\ */
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3456kb
input:
2 6 3 2 1 1 4 1 1
output:
? 6 3 ? 2 5 ? 2 4 ! 2 4 ? 3 1 ! 3 1
result:
ok ok (2 test cases)
Test #2:
score: 0
Accepted
time: 15ms
memory: 3456kb
input:
1000 15 5 4 3 5 1 1 19 1 2 5 3 2 1 17 7 7 5 5 4 1 1 15 6 5 3 4 3 1 1 14 5 6 3 3 4 5 1 15 7 3 4 4 3 2 1 1 17 4 5 4 2 3 1 1 20 10 8 7 3 2 2 3 3 1 13 4 5 4 3 4 1 1 18 9 3 2 4 3 1 1 13 5 5 4 4 5 1 1 14 6 6 3 4 3 1 1 17 5 6 3 3 2 3 1 12 3 2 3 3 3 1 10 5 3 4 2 2 1 1 14 7 6 6 2 2 3 1 19 7 8 5 8 8 1 1 19 6 ...
output:
? 2 9 ? 2 8 ? 2 5 ? 2 7 ? 5 8 ! 5 8 ? 3 12 ? 3 11 ? 3 17 ? 3 14 ? 3 13 ! 3 12 ? 17 8 ? 17 7 ? 17 12 ? 17 10 ? 17 11 ? 3 11 ! 3 11 ? 14 6 ? 14 5 ? 14 2 ? 14 4 ? 14 3 ? 1 3 ! 1 3 ? 7 14 ? 7 13 ? 7 4 ? 7 2 ? 7 3 ? 9 2 ! 5 2 ? 6 13 ? 1 8 ? 1 7 ? 1 12 ? 1 10 ? 1 9 ? 2 9 ! 2 9 ? 4 12 ? 4 11 ? 4 16 ? 4 14 ...
result:
ok ok (1000 test cases)
Test #3:
score: 0
Accepted
time: 13ms
memory: 3584kb
input:
1000 21 6 7 5 4 3 4 1 1 22 10 9 5 7 7 2 1 20 7 6 5 7 4 1 22 4 5 5 7 5 1 1 21 5 4 5 3 4 1 1 21 9 9 6 9 8 1 1 24 11 10 6 8 8 2 1 22 10 10 4 2 3 3 5 1 21 5 6 6 3 4 1 1 23 7 8 6 9 8 1 1 21 6 7 6 6 5 1 1 24 7 8 6 9 8 6 1 20 9 9 5 7 6 6 8 1 24 11 11 5 3 4 3 5 1 23 11 9 10 6 8 8 7 7 1 23 9 10 5 6 5 4 1 1 2...
output:
? 8 18 ? 8 17 ? 8 2 ? 8 20 ? 8 21 ? 8 1 ? 10 21 ! 10 21 ? 9 20 ? 9 19 ? 9 14 ? 9 17 ? 9 16 ? 15 17 ! 3 17 ? 16 6 ? 16 5 ? 16 1 ? 16 4 ? 1 5 ! 11 5 ? 4 15 ? 4 14 ? 4 21 ? 4 18 ? 4 16 ? 7 15 ! 7 15 ? 5 15 ? 5 14 ? 5 10 ? 5 13 ? 5 12 ? 7 13 ! 7 13 ? 8 18 ? 8 17 ? 8 2 ? 8 20 ? 8 19 ? 15 19 ! 15 19 ? 1 1...
result:
ok ok (1000 test cases)
Test #4:
score: 0
Accepted
time: 17ms
memory: 3456kb
input:
1000 25 12 8 7 4 5 4 3 1 1 25 11 11 5 4 4 5 1 1 25 5 4 5 2 3 1 1 25 9 8 3 3 4 4 1 26 12 11 5 3 4 4 1 1 26 11 12 6 10 10 9 1 1 26 11 12 6 8 6 5 9 1 27 13 13 13 12 11 6 9 8 8 1 1 25 8 7 6 9 8 1 1 27 11 10 4 3 3 2 3 1 27 11 12 7 11 12 3 1 27 3 2 6 4 3 3 1 26 13 5 6 4 2 2 1 1 25 10 11 7 7 8 9 1 27 12 11...
output:
? 4 16 ? 24 11 ? 24 10 ? 24 5 ? 24 8 ? 24 7 ? 24 6 ? 1 6 ! 1 6 ? 6 18 ? 6 17 ? 6 24 ? 6 2 ? 6 25 ? 6 1 ? 9 25 ! 9 25 ? 22 9 ? 22 8 ? 22 3 ? 22 6 ? 22 5 ? 23 6 ! 23 6 ? 5 17 ? 5 16 ? 5 11 ? 5 8 ? 5 10 ? 7 11 ! 3 11 ? 15 2 ? 15 1 ? 15 21 ? 15 18 ? 15 20 ? 15 19 ? 18 20 ! 18 20 ? 17 4 ? 17 3 ? 17 11 ? ...
result:
ok ok (1000 test cases)
Test #5:
score: 0
Accepted
time: 16ms
memory: 3584kb
input:
1000 29 13 13 8 10 10 9 1 1 28 7 6 6 4 4 3 5 1 30 3 2 7 5 3 3 1 29 5 6 4 2 2 1 1 28 14 6 7 3 3 1 2 1 29 12 13 7 9 7 6 1 1 29 12 11 5 3 3 4 3 1 28 11 10 7 11 11 1 1 30 6 7 7 8 6 5 1 1 30 6 5 7 6 4 5 1 1 28 9 8 2 3 2 1 1 29 13 12 6 2 1 1 29 11 10 6 8 6 5 1 1 29 14 6 5 7 3 5 4 1 1 29 13 12 6 3 5 6 1 1 ...
output:
? 14 28 ? 14 27 ? 14 6 ? 14 2 ? 14 4 ? 14 3 ? 22 3 ! 22 3 ? 26 12 ? 26 11 ? 26 5 ? 26 9 ? 26 7 ? 26 8 ? 28 8 ! 24 8 ? 18 3 ? 18 2 ? 18 25 ? 18 29 ? 18 1 ? 19 2 ! 17 2 ? 13 27 ? 13 26 ? 13 5 ? 13 1 ? 13 3 ? 13 2 ! 13 2 ? 19 5 ? 23 9 ? 23 8 ? 23 16 ? 23 12 ? 23 14 ? 23 15 ! 23 14 ? 27 12 ? 27 11 ? 27 ...
result:
ok ok (1000 test cases)
Test #6:
score: 0
Accepted
time: 14ms
memory: 3584kb
input:
1000 32 13 14 7 9 7 6 11 1 30 14 13 7 10 8 8 1 1 32 6 7 8 4 4 3 1 1 31 5 6 8 9 7 6 1 1 32 11 10 7 7 5 6 6 1 32 6 7 8 4 4 3 5 1 31 9 8 7 5 7 6 1 1 31 7 6 5 3 3 2 3 1 32 12 13 4 4 2 3 3 1 30 14 13 6 2 2 1 1 31 5 4 7 7 5 1 1 31 10 11 8 12 10 9 8 1 33 14 15 6 5 4 5 1 1 32 1 2 8 5 3 2 1 32 6 5 8 4 4 3 5 ...
output:
? 14 30 ? 14 29 ? 14 6 ? 14 2 ? 14 4 ? 14 5 ? 19 5 ! 9 5 ? 19 4 ? 19 3 ? 19 26 ? 19 30 ? 19 28 ? 19 27 ? 26 28 ! 26 28 ? 7 23 ? 7 22 ? 7 31 ? 7 27 ? 7 25 ? 7 26 ? 9 26 ! 9 26 ? 31 15 ? 31 14 ? 31 23 ? 31 19 ? 31 17 ? 31 16 ? 4 15 ! 4 15 ? 25 9 ? 25 8 ? 25 1 ? 25 5 ? 25 3 ? 25 2 ? 29 3 ! 21 3 ? 4 20 ...
result:
ok ok (1000 test cases)
Test #7:
score: 0
Accepted
time: 13ms
memory: 3584kb
input:
1000 34 10 9 8 8 8 7 1 1 33 9 10 9 7 7 6 11 1 33 10 9 2 4 2 1 1 34 15 14 8 11 11 10 3 1 34 11 10 2 4 4 3 3 1 35 14 13 8 10 8 9 1 1 34 12 11 7 8 6 5 6 6 1 34 14 15 8 10 11 11 1 1 34 16 15 7 3 2 3 1 1 33 9 10 9 5 7 6 9 1 33 16 15 14 7 4 5 4 1 1 34 17 16 16 8 12 11 11 12 1 33 15 15 7 5 5 4 1 1 34 17 14...
output:
? 25 8 ? 25 7 ? 25 33 ? 25 4 ? 25 6 ? 25 5 ? 31 5 ! 31 5 ? 20 3 ? 20 2 ? 20 11 ? 20 7 ? 20 5 ? 20 6 ? 25 6 ! 15 6 ? 24 7 ? 24 6 ? 24 32 ? 24 28 ? 24 30 ? 24 31 ! 24 31 ? 20 3 ? 20 2 ? 20 28 ? 20 33 ? 20 31 ? 20 32 ? 29 32 ! 11 32 ? 28 11 ? 28 10 ? 28 2 ? 28 32 ? 28 34 ? 28 1 ? 29 2 ! 27 2 ? 29 11 ? ...
result:
ok ok (1000 test cases)
Test #8:
score: 0
Accepted
time: 13ms
memory: 3584kb
input:
1000 36 17 16 9 13 11 10 10 1 1 36 11 10 9 7 9 8 8 1 36 13 12 8 9 7 6 7 1 1 36 11 12 9 9 9 8 1 1 36 9 10 2 5 3 2 1 1 36 8 9 7 4 4 3 5 1 35 12 11 8 8 10 9 1 1 36 9 8 6 5 3 4 1 1 36 18 16 17 9 12 10 11 1 1 36 16 17 9 12 10 9 10 17 1 36 11 12 9 7 7 6 1 1 36 10 9 9 6 6 5 9 1 36 17 17 9 13 12 13 10 1 36 ...
output:
? 9 27 ? 9 26 ? 9 18 ? 9 23 ? 9 21 ? 9 20 ? 9 19 ? 18 20 ! 18 20 ? 5 23 ? 5 22 ? 5 14 ? 5 19 ? 5 17 ? 5 18 ? 11 19 ! 35 19 ? 35 17 ? 35 16 ? 35 8 ? 35 13 ? 35 11 ? 35 10 ? 35 9 ? 4 10 ! 4 10 ? 32 14 ? 32 13 ? 32 23 ? 32 18 ? 32 16 ? 32 17 ? 3 17 ! 3 17 ? 6 24 ? 6 23 ? 6 33 ? 6 28 ? 6 30 ? 6 31 ? 6 3...
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 8 4 6 5 4 1 1 38 9 8 9 12 9 1 1 37 11 10 8 7 5 6 1 1 37 11 10 9 9 9 8 1 1 36 8 9 9 6 6 5 9 1 37 6 7 9 4 4 3 5 1 37 9 8 9 7 7 6 10 1 37 16 15 9 14 14 13 1 1 37 4 3 9 4 2 3 1 1 37 13 14 10 13 11 12 1 1 37 17 16 9 13 11 10 10 1 1 36 7 6 8 3 5 4 5 1 37 14 13 9 14 14 ...
output:
? 35 16 ? 35 15 ? 35 7 ? 35 12 ? 35 14 ? 35 13 ? 6 14 ! 27 14 ? 23 5 ? 23 4 ? 23 32 ? 23 27 ? 23 30 ? 23 29 ? 23 28 ? 26 28 ! 26 28 ? 38 19 ? 38 18 ? 38 9 ? 38 14 ? 38 17 ? 7 18 ! 7 18 ? 9 27 ? 9 26 ? 9 18 ? 9 23 ? 9 21 ? 9 20 ? 13 21 ! 13 21 ? 12 30 ? 12 29 ? 12 21 ? 12 26 ? 12 28 ? 12 27 ? 19 27 !...
result:
ok ok (1000 test cases)
Test #10:
score: 0
Accepted
time: 17ms
memory: 3584kb
input:
1000 39 17 18 7 5 5 6 1 1 38 14 13 9 13 12 11 12 6 1 38 11 12 9 14 11 10 1 1 39 12 11 9 7 9 8 1 1 38 19 15 16 5 4 7 6 9 1 39 4 5 8 3 2 1 2 1 39 16 17 10 15 16 15 1 1 38 18 17 8 3 2 2 1 1 39 13 14 10 15 15 14 1 1 39 12 13 8 7 5 6 9 1 39 6 7 10 9 6 5 1 1 38 18 17 8 3 2 2 1 1 39 12 11 2 4 4 3 3 1 38 12...
output:
? 21 1 ? 21 39 ? 21 11 ? 21 16 ? 21 13 ? 21 14 ? 25 13 ! 25 13 ? 5 24 ? 5 23 ? 5 14 ? 5 19 ? 5 22 ? 5 21 ? 5 20 ? 15 21 ! 33 21 ? 6 25 ? 6 24 ? 6 35 ? 6 30 ? 6 27 ? 6 26 ? 15 26 ! 15 26 ? 35 15 ? 35 14 ? 35 5 ? 35 10 ? 35 8 ? 35 9 ? 2 10 ! 2 10 ? 24 5 ? 30 11 ? 30 10 ? 30 21 ? 30 26 ? 30 23 ? 30 22 ...
result:
ok ok (1000 test cases)
Test #11:
score: 0
Accepted
time: 12ms
memory: 3584kb
input:
1000 40 16 17 10 11 9 10 1 1 40 6 5 10 9 6 1 1 40 11 10 10 6 8 7 1 1 40 8 7 10 9 6 7 1 1 40 20 16 17 10 11 13 12 15 1 40 3 4 9 4 1 2 1 41 19 18 9 4 2 4 2 1 40 15 14 5 5 7 6 6 1 40 18 19 10 13 13 12 15 1 40 6 7 6 1 3 2 1 40 14 15 8 9 7 6 7 1 1 41 7 8 11 10 7 6 1 1 40 3 2 9 4 1 2 1 40 4 5 10 9 6 5 7 1...
output:
? 39 19 ? 39 18 ? 39 29 ? 39 24 ? 39 26 ? 39 27 ? 7 26 ! 7 26 ? 8 28 ? 8 27 ? 8 18 ? 8 23 ? 8 26 ? 12 27 ! 12 27 ? 28 8 ? 28 7 ? 28 38 ? 28 3 ? 28 1 ? 28 2 ? 33 3 ! 33 3 ? 36 16 ? 36 15 ? 36 6 ? 36 11 ? 36 14 ? 36 13 ? 1 14 ! 1 14 ? 26 6 ? 38 18 ? 38 17 ? 38 28 ? 38 23 ? 38 25 ? 38 24 ? 8 23 ! 28 23...
result:
ok ok (1000 test cases)
Test #12:
score: 0
Accepted
time: 14ms
memory: 3584kb
input:
1000 42 21 21 11 10 10 14 11 1 1 41 16 15 10 15 16 1 1 41 18 17 8 5 8 9 3 1 41 11 12 11 6 8 7 1 1 41 8 7 10 9 6 7 1 1 41 13 12 10 14 11 12 8 1 41 17 18 11 16 15 16 1 1 41 20 20 7 6 10 6 5 4 5 7 1 41 9 8 10 10 7 8 1 1 41 14 13 10 9 9 8 1 1 41 20 6 7 10 5 4 3 4 1 1 42 20 20 10 15 13 15 12 1 41 9 10 11...
output:
? 33 12 ? 11 32 ? 39 18 ? 39 17 ? 39 7 ? 39 13 ? 39 16 ? 6 17 ! 6 17 ? 19 39 ? 19 38 ? 19 29 ? 19 34 ? 19 37 ? 33 38 ! 33 38 ? 6 26 ? 6 25 ? 6 16 ? 6 11 ? 6 14 ? 6 15 ? 13 16 ! 40 16 ? 11 31 ? 11 30 ? 11 41 ? 11 36 ? 11 38 ? 11 37 ? 16 36 ! 16 36 ? 5 25 ? 5 24 ? 5 15 ? 5 20 ? 5 23 ? 5 22 ? 10 23 ! 1...
result:
ok ok (1000 test cases)
Test #13:
score: 0
Accepted
time: 9ms
memory: 3456kb
input:
1000 43 17 16 10 12 13 11 12 5 1 42 18 19 10 16 16 17 8 1 43 18 19 11 13 14 12 13 1 1 43 10 11 11 5 8 6 1 1 43 17 18 6 3 4 3 2 1 1 43 9 10 11 12 9 8 1 1 43 18 17 9 13 10 9 8 1 1 43 21 21 21 21 21 20 19 9 5 8 9 1 1 42 13 12 10 8 11 9 1 1 42 20 19 10 15 13 14 13 1 1 42 3 2 10 6 3 3 1 43 10 11 7 5 4 4 ...
output:
? 31 9 ? 31 8 ? 31 41 ? 31 4 ? 31 1 ? 31 3 ? 31 2 ? 41 3 ! 21 3 ? 35 14 ? 35 13 ? 35 25 ? 35 19 ? 35 16 ? 35 17 ? 8 16 ! 20 16 ? 37 15 ? 37 14 ? 37 26 ? 37 20 ? 37 23 ? 37 21 ? 37 22 ? 5 21 ! 5 21 ? 31 9 ? 31 8 ? 31 20 ? 31 14 ? 31 17 ? 31 15 ? 35 14 ! 35 14 ? 4 25 ? 4 24 ? 4 36 ? 4 41 ? 4 38 ? 4 39...
result:
ok ok (1000 test cases)
Test #14:
score: 0
Accepted
time: 15ms
memory: 3456kb
input:
1000 44 22 14 13 5 9 6 5 4 1 1 44 17 16 10 12 9 8 9 6 1 43 21 10 9 9 5 6 4 5 1 1 43 12 11 10 11 10 9 10 1 1 44 17 16 6 2 3 2 1 1 44 16 15 11 17 16 1 1 44 19 20 11 17 17 16 17 1 1 44 22 6 7 11 9 6 5 9 1 43 16 15 5 5 7 6 6 1 43 8 9 9 3 6 4 1 1 44 15 16 4 5 7 5 1 1 44 20 21 11 15 14 16 13 1 44 3 2 11 6...
output:
? 24 2 ? 38 16 ? 38 15 ? 38 5 ? 38 11 ? 38 8 ? 38 7 ? 38 6 ? 41 6 ! 41 6 ? 36 14 ? 36 13 ? 36 3 ? 36 9 ? 36 6 ? 36 5 ? 36 4 ? 43 5 ! 29 5 ? 30 8 ? 21 42 ? 21 41 ? 21 31 ? 21 37 ? 21 34 ? 21 36 ? 21 35 ? 24 36 ! 24 36 ? 10 31 ? 10 30 ? 10 20 ? 10 26 ? 10 29 ? 10 28 ? 10 27 ? 18 28 ! 18 28 ? 40 18 ? 4...
result:
ok ok (1000 test cases)
Test #15:
score: 0
Accepted
time: 18ms
memory: 3584kb
input:
1000 45 22 18 17 7 3 4 3 2 1 1 45 12 13 12 13 10 11 1 1 45 11 12 2 6 3 2 1 1 45 14 13 9 9 6 7 9 1 45 16 15 11 17 14 15 7 1 45 9 8 11 6 7 6 5 9 1 45 18 19 12 18 20 19 1 1 45 22 17 16 11 12 11 11 10 6 1 44 19 20 8 4 5 4 3 5 1 45 19 20 12 16 17 16 15 1 1 44 20 21 11 17 18 17 18 9 1 45 16 17 5 6 6 4 5 7...
output:
? 3 25 ? 44 21 ? 44 20 ? 44 10 ? 44 4 ? 44 7 ? 44 6 ? 44 5 ? 45 5 ! 45 5 ? 33 10 ? 33 9 ? 33 21 ? 33 15 ? 33 12 ? 33 13 ? 42 12 ! 42 12 ? 18 40 ? 18 39 ? 18 6 ? 18 45 ? 18 3 ? 18 4 ? 18 5 ! 18 5 ? 37 14 ? 37 13 ? 37 3 ? 37 9 ? 37 6 ? 37 5 ? 42 6 ! 32 6 ? 27 4 ? 27 3 ? 27 38 ? 27 44 ? 27 2 ? 27 1 ? 4...
result:
ok ok (1000 test cases)
Test #16:
score: 0
Accepted
time: 8ms
memory: 3456kb
input:
1000 46 16 17 10 10 7 8 1 1 46 11 10 11 5 8 6 9 1 46 10 11 11 6 7 6 5 9 1 46 19 20 11 13 10 11 19 1 46 15 14 11 11 12 11 10 9 1 46 13 14 7 7 4 5 1 1 46 10 11 11 12 9 9 8 1 1 46 16 15 11 14 13 12 13 8 1 46 22 22 10 5 8 9 9 17 1 46 23 13 12 11 9 10 9 8 11 1 45 18 17 7 5 8 6 7 1 1 46 16 15 8 10 7 6 7 8...
output:
? 25 2 ? 25 1 ? 25 14 ? 25 8 ? 25 11 ? 25 12 ? 31 11 ! 31 11 ? 33 10 ? 33 9 ? 33 44 ? 33 4 ? 33 1 ? 33 3 ? 37 4 ! 29 4 ? 11 34 ? 11 33 ? 11 46 ? 11 40 ? 11 37 ? 11 38 ? 11 39 ? 15 39 ! 7 39 ? 20 43 ? 20 42 ? 20 9 ? 20 3 ? 20 6 ? 20 7 ? 29 6 ! 11 6 ? 29 6 ? 29 5 ? 29 40 ? 29 46 ? 29 3 ? 29 2 ? 29 1 ?...
result:
ok ok (1000 test cases)
Test #17:
score: 0
Accepted
time: 72ms
memory: 3584kb
input:
1000 1000000000 499999999 499999998 249999999 125000000 187499999 156250000 171874999 164062499 160156249 158203124 157226562 156738281 156494140 156372071 156433105 156402589 156417847 156410218 156406403 156404497 156405450 156404974 156405212 156405093 156405034 156405063 156405049 156405056 1564...
output:
? 715642331 215642331 ? 715642331 215642330 ? 715642331 965642331 ? 715642331 840642331 ? 715642331 903142331 ? 715642331 871892331 ? 715642331 887517331 ? 715642331 879704831 ? 715642331 875798581 ? 715642331 873845456 ? 715642331 872868894 ? 715642331 872380613 ? 715642331 872136472 ? 715642331 87...
result:
ok ok (1000 test cases)
Test #18:
score: 0
Accepted
time: 66ms
memory: 3584kb
input:
1000 1000000000 499999969 499999968 250000000 374999969 312500000 343750000 359374969 351562500 355468719 353515625 354492188 354980469 355224610 355346680 355407684 355377167 355361908 355354310 355358125 355360001 355359079 355359525 355359318 355359437 355359466 355359436 355359437 355359429 3553...
output:
? 47891445 547891445 ? 47891445 547891444 ? 47891445 297891445 ? 47891445 422891445 ? 47891445 360391445 ? 47891445 391641445 ? 47891445 407266445 ? 47891445 399453945 ? 47891445 403360195 ? 47891445 401407070 ? 47891445 402383633 ? 47891445 402871914 ? 47891445 403116055 ? 47891445 403238125 ? 4789...
result:
ok ok (1000 test cases)
Test #19:
score: 0
Accepted
time: 61ms
memory: 3584kb
input:
1000 1000000000 24916167 24916168 250000000 125000001 62500001 31250001 15625001 17103667 13197417 13671876 12695313 12709136 12464996 12573242 12512207 12481689 12466430 12458801 12461182 12459275 12458321 12458324 12458085 12458202 12458143 12458113 12458098 12458091 12458087 12458085 12458084 1 1...
output:
? 224616013 724616013 ? 224616013 724616012 ? 224616013 974616013 ? 224616013 849616013 ? 224616013 787116013 ? 224616013 755866013 ? 224616013 740241013 ? 224616013 732428513 ? 224616013 736334763 ? 224616013 738287888 ? 224616013 737311325 ? 224616013 736823044 ? 224616013 737067184 ? 224616013 73...
result:
ok ok (1000 test cases)
Test #20:
score: 0
Accepted
time: 60ms
memory: 3584kb
input:
1000 1000000000 297326072 297326071 249999930 172326072 187499930 156249930 156701072 148888572 152343680 150390555 149413992 148925711 148681570 148766502 148705467 148674950 148666311 148667321 148663506 148664403 148663449 148663030 148663210 148663091 148663031 148663001 148663016 148663008 1486...
output:
? 533420346 33420346 ? 533420346 33420345 ? 533420346 783420346 ? 533420346 908420346 ? 533420346 845920346 ? 533420346 877170346 ? 533420346 892795346 ? 533420346 884982846 ? 533420346 881076596 ? 533420346 883029721 ? 533420346 884006284 ? 533420346 884494565 ? 533420346 884738706 ? 533420346 8848...
result:
ok ok (1000 test cases)
Test #21:
score: 0
Accepted
time: 69ms
memory: 3584kb
input:
1000 1000000000 288090905 288090906 250000000 280727267 225590905 249477267 233852267 226039767 222133517 223637780 222661218 222172937 221928796 222011446 221950411 221919893 221913538 221912263 221909724 221910355 221909401 221909248 221909162 221909129 221909102 221909100 221909087 221909093 2219...
output:
? 180037036 680037036 ? 180037036 680037035 ? 180037036 930037036 ? 180037036 805037036 ? 180037036 742537036 ? 180037036 773787036 ? 180037036 758162036 ? 180037036 750349536 ? 180037036 746443286 ? 180037036 744490161 ? 180037036 745466723 ? 180037036 745955004 ? 180037036 746199145 ? 180037036 74...
result:
ok ok (1000 test cases)
Test #22:
score: -100
Wrong Answer
time: 38ms
memory: 3456kb
input:
1000 999999999 499999999 499999999 499999999 499999999 499999998 499999997 249999999 374999998 312499999 343749998 328124999 335937499 339843748 337890624 338867187 339355467 339111328 339233398 339294433 339324951 339340209 339332580 339328766 339330673 339329720 339330196 339329959 339330078 33933...
output:
? 397606859 897606858 ? 382174731 882174730 ? 620589469 120589469 ? 276205765 776205764 ? 879288401 379288401 ? 879288401 379288400 ? 879288401 129288401 ? 879288401 254288401 ? 879288401 191788401 ? 879288401 223038401 ? 879288401 207413401 ? 879288401 215225901 ? 879288401 219132151 ? 879288401 21...
result:
wrong answer Too many queries: 41 (test case 601)