QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#875964 | #9734. Identify Chord | Max_s_xaM | RE | 72ms | 3712kb | C++17 | 4.5kb | 2025-01-30 15:02:18 | 2025-01-30 15:02:20 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <random>
#include <ctime>
#include <chrono>
#include <numeric>
#include <iomanip>
#include <cassert>
typedef long long ll;
typedef double lf;
typedef unsigned long long ull;
#define DEBUG 1
struct IO
{
#define MAXSIZE (1 << 20)
#define isdigit(x) (x >= '0' && x <= '9')
char buf[MAXSIZE], *p1, *p2;
char pbuf[MAXSIZE], *pp;
#if DEBUG
#else
IO() : p1(buf), p2(buf), pp(pbuf) {}
~IO() {fwrite(pbuf, 1, pp - pbuf, stdout);}
#endif
#define gc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin), p1 == p2) ? ' ' : *p1++)
#define blank(x) (x == ' ' || x == '\n' || x == '\r' || x == '\t')
template <typename T>
void Read(T &x)
{
#if DEBUG
std::cin >> x;
#else
bool sign = 0; char ch = gc(); x = 0;
for (; !isdigit(ch); ch = gc())
if (ch == '-') sign = 1;
for (; isdigit(ch); ch = gc()) x = x * 10 + (ch ^ 48);
if (sign) x = -x;
#endif
}
void Read(char *s)
{
#if DEBUG
std::cin >> s;
#else
char ch = gc();
for (; blank(ch); ch = gc());
for (; !blank(ch); ch = gc()) *s++ = ch;
*s = 0;
#endif
}
void Read(char &c) {for (c = gc(); blank(c); c = gc());}
void Push(const char &c)
{
#if DEBUG
putchar(c);
#else
if (pp - pbuf == MAXSIZE) fwrite(pbuf, 1, MAXSIZE, stdout), pp = pbuf;
*pp++ = c;
#endif
}
template <typename T>
void Write(T x)
{
if (x < 0) x = -x, Push('-');
static T sta[35];
int top = 0;
do sta[top++] = x % 10, x /= 10; while (x);
while (top) Push(sta[--top] ^ 48);
}
template <typename T>
void Write(T x, char lst) {Write(x), Push(lst);}
} IO;
#define Read(x) IO.Read(x)
#define Write(x, y) IO.Write(x, y)
#define Put(x) IO.Push(x)
using namespace std;
int n;
map <pair <int, int>, int> mp;
inline int Dist(int x, int y) { x = (x + n) % n, y = (y + n) % n; return min(abs(x - y), n - abs(x - y)); }
inline int Ask(int x, int y)
{
x = (x + n) % n + 1, y = (y + n) % n + 1;
if (x == y) return 0;
if (x > y) swap(x, y);
if (mp.find(make_pair(x, y)) != mp.end()) return mp[{x, y}];
cout << "? " << x << ' ' << y << endl;
int ans; cin >> ans;
return mp[{x, y}] = ans;
}
inline void Answer(int x, int y)
{
x = (x + n) % n + 1, y = (y + n) % n + 1;
cout << "! " << x << ' ' << y << endl;
int ans; cin >> ans;
if (ans == -1) exit(0);
}
inline bool Guess(int x, int d)
{
if (d <= 1 || d >= n - 1) return 0;
x = (x + n) % n;
if (Ask(x, x - d) == 1) return Answer(x, x - d), 1;
if (Ask(x, x + d) == 1) return Answer(x, x + d), 1;
return 0;
}
mt19937 Rand(chrono::steady_clock::now().time_since_epoch().count());
int main()
{
#ifndef DEBUG
ios::sync_with_stdio(0), cin.tie(0);
#endif
int T;
cin >> T;
while (T--)
{
cin >> n;
mp.clear();
int x = 0, y = n / 2;
while (Ask(x, y) == Dist(x, y))
{
if (y - x == n / 2) y++;
else x++;
if (~n & 1) x++;
}
int d1 = Ask(x - 1, y), d2 = Ask(x + 1, y);
if (d1 >= Ask(x, y) && d2 >= Ask(x, y)) { assert(Guess(x, Dist(x, y) - Ask(x, y) + 1) || Guess(x, n - Dist(x, y) - Ask(x, y) + 1)); continue; }
else if (d1 < Ask(x, y))
{
int l = y + 1 - n, r = x - 1, mid, res = x;
while (l <= r)
{
mid = (l + r) / 2;
if (Ask(mid, y) + Dist(x, mid) == Ask(x, y)) res = mid, r = mid - 1;
else l = mid + 1;
}
assert(Guess(res, Dist(res, y) - Ask(res, y) + 1) || Guess(res, n - Dist(res, y) - Ask(res, y) + 1));
}
else
{
int l = x + 1, r = y - 1, mid, res = x;
while (l <= r)
{
mid = l + r >> 1;
if (Ask(mid, y) + Dist(x, mid) == Ask(x, y)) res = mid, l = mid + 1;
else r = mid - 1;
}
assert(Guess(res, Dist(res, y) - Ask(res, y) + 1) || Guess(res, n - Dist(res, y) - Ask(res, y) + 1));
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3584kb
input:
2 6 2 2 1 1 2 1 4 1 1 1 1
output:
? 1 4 ? 4 6 ? 2 4 ? 3 4 ? 2 6 ! 2 4 ? 1 3 ? 3 4 ? 2 3 ! 1 3
result:
ok ok (2 test cases)
Test #2:
score: 0
Accepted
time: 23ms
memory: 3584kb
input:
1000 15 5 6 4 2 2 1 3 1 19 5 6 4 5 3 4 5 5 1 1 17 5 6 4 4 3 4 4 4 1 1 15 6 7 6 2 1 1 14 5 6 4 4 5 3 1 1 15 3 4 2 4 3 4 3 1 1 17 8 8 8 7 7 6 5 5 4 3 3 1 1 20 6 7 7 5 1 1 13 5 4 5 2 2 3 3 3 4 1 1 18 3 2 4 5 3 1 1 13 4 3 5 4 4 1 1 14 2 1 3 3 2 1 17 8 7 7 6 3 3 2 3 3 1 1 12 5 5 4 3 3 2 2 1 1 10 5 5 3 4 ...
output:
? 1 8 ? 8 15 ? 2 8 ? 4 8 ? 6 8 ? 5 8 ? 2 5 ! 5 8 ? 1 10 ? 10 19 ? 2 10 ? 5 10 ? 3 10 ? 4 10 ? 3 17 ? 3 8 ? 3 12 ! 3 12 ? 1 9 ? 9 17 ? 2 9 ? 5 9 ? 3 9 ? 4 9 ? 3 16 ? 3 7 ? 3 11 ! 3 11 ? 1 8 ? 8 15 ? 2 8 ? 1 14 ? 1 3 ! 1 3 ? 1 8 ? 8 14 ? 2 8 ? 4 8 ? 3 8 ? 2 13 ? 2 5 ! 2 5 ? 1 8 ? 8 15 ? 2 8 ? 4 8 ? 3 ...
result:
ok ok (1000 test cases)
Test #3:
score: 0
Accepted
time: 14ms
memory: 3584kb
input:
1000 21 3 2 4 6 3 3 2 1 1 22 8 9 7 6 6 7 4 4 1 1 20 5 6 4 2 3 2 1 6 1 22 10 10 9 5 3 4 4 2 2 1 1 21 9 10 8 4 3 3 2 2 1 1 21 8 7 9 6 6 5 6 1 1 24 11 10 11 5 3 4 4 2 2 8 1 1 22 10 9 10 5 2 2 1 1 21 4 5 3 5 4 4 5 1 1 23 8 7 9 6 9 8 1 1 21 10 10 10 9 9 8 4 3 3 4 3 3 1 1 24 9 10 8 3 3 2 3 4 3 1 1 20 9 8 ...
output:
? 1 11 ? 11 21 ? 2 11 ? 11 17 ? 11 20 ? 12 21 ? 9 21 ? 10 21 ! 21 10 ? 1 12 ? 12 22 ? 2 12 ? 6 12 ? 3 12 ? 4 12 ? 3 21 ? 3 7 ? 3 17 ! 3 17 ? 1 11 ? 11 20 ? 2 11 ? 6 11 ? 3 11 ? 4 11 ? 5 11 ? 5 19 ! 5 11 ? 1 12 ? 12 22 ? 2 12 ? 6 12 ? 9 12 ? 7 12 ? 8 12 ? 5 7 ? 7 9 ? 7 15 ! 7 15 ? 1 11 ? 11 21 ? 2 11...
result:
ok ok (1000 test cases)
Test #4:
score: 0
Accepted
time: 8ms
memory: 3584kb
input:
1000 25 8 9 9 5 1 1 25 6 5 7 7 7 6 8 2 8 1 1 25 11 10 11 7 8 9 3 3 8 1 1 25 5 6 4 6 4 3 8 1 1 26 12 11 12 6 4 5 5 1 1 26 11 10 12 7 10 9 3 3 7 1 1 26 13 13 11 12 12 1 1 27 12 13 11 6 4 5 5 2 1 1 25 9 8 10 3 2 2 1 1 27 9 10 8 7 6 7 5 1 1 27 11 10 12 4 4 5 1 1 27 13 13 13 13 12 11 7 9 8 7 2 2 1 1 26 5...
output:
? 1 13 ? 13 25 ? 2 13 ? 1 21 ? 1 6 ! 1 6 ? 1 13 ? 13 25 ? 2 13 ? 13 20 ? 13 23 ? 13 24 ? 17 25 ? 8 25 ? 16 25 ? 9 25 ! 25 9 ? 1 13 ? 13 25 ? 2 13 ? 13 20 ? 13 23 ? 13 22 ? 20 23 ? 1 23 ? 15 23 ? 6 23 ! 23 6 ? 1 13 ? 13 25 ? 2 13 ? 7 13 ? 4 13 ? 3 13 ? 3 20 ? 3 11 ! 3 11 ? 1 14 ? 14 26 ? 2 14 ? 14 21...
result:
ok ok (1000 test cases)
Test #5:
score: 0
Accepted
time: 11ms
memory: 3456kb
input:
1000 29 10 11 9 7 9 8 5 5 1 1 28 13 12 13 7 10 8 8 2 2 5 1 1 30 3 4 2 8 4 3 3 3 1 1 29 4 5 3 7 5 4 8 1 1 28 8 7 9 3 5 3 2 3 7 9 1 1 29 6 7 5 7 5 4 6 7 1 1 29 9 8 10 8 6 8 7 1 1 28 11 12 10 4 4 5 4 1 1 30 4 3 5 5 1 3 2 1 30 8 7 9 3 5 3 2 3 8 10 1 1 28 11 12 10 4 3 3 2 4 3 1 1 29 14 13 12 14 6 4 5 5 1...
output:
? 1 15 ? 15 29 ? 2 15 ? 8 15 ? 4 15 ? 3 15 ? 3 27 ? 3 8 ? 3 22 ! 3 22 ? 1 15 ? 15 28 ? 2 15 ? 15 22 ? 15 26 ? 15 24 ? 15 23 ? 22 24 ? 24 26 ? 12 24 ? 8 24 ! 24 8 ? 1 16 ? 16 30 ? 2 16 ? 8 16 ? 4 16 ? 3 16 ? 2 19 ? 2 15 ? 2 17 ! 2 17 ? 1 15 ? 15 29 ? 2 15 ? 8 15 ? 4 15 ? 3 15 ? 2 20 ? 2 13 ! 2 13 ? 1...
result:
ok ok (1000 test cases)
Test #6:
score: 0
Accepted
time: 14ms
memory: 3584kb
input:
1000 32 13 14 12 8 9 10 10 4 1 1 30 14 13 14 8 11 10 11 1 1 32 16 16 14 15 13 8 10 8 9 3 3 1 1 31 5 6 4 6 2 4 3 10 1 1 32 7 8 6 8 7 5 6 5 9 1 1 32 8 9 7 8 10 8 3 9 1 1 31 15 14 14 13 6 4 4 3 3 3 1 1 31 6 5 7 8 8 6 1 1 32 12 13 11 4 4 4 3 5 1 1 30 14 13 14 8 11 9 9 1 1 31 11 10 12 8 9 9 8 6 6 10 1 1 ...
output:
? 1 17 ? 17 32 ? 2 17 ? 9 17 ? 5 17 ? 7 17 ? 6 17 ? 1 5 ? 5 9 ! 5 9 ? 1 16 ? 16 30 ? 2 16 ? 16 24 ? 16 28 ? 16 26 ? 16 27 ? 26 28 ! 28 26 ? 1 17 ? 2 18 ? 3 19 ? 2 19 ? 4 19 ? 11 19 ? 7 19 ? 9 19 ? 10 19 ? 6 9 ? 9 12 ? 9 26 ! 9 26 ? 1 16 ? 16 31 ? 2 16 ? 8 16 ? 4 16 ? 6 16 ? 5 16 ? 4 24 ? 4 15 ! 4 15...
result:
ok ok (1000 test cases)
Test #7:
score: 0
Accepted
time: 15ms
memory: 3584kb
input:
1000 34 17 16 16 15 9 13 14 13 2 2 1 1 33 8 9 7 6 4 4 3 9 1 1 33 11 10 12 9 9 9 8 1 1 34 11 10 12 9 9 9 8 7 7 9 1 1 34 11 12 10 9 13 11 3 7 1 1 35 14 15 15 4 1 1 34 8 7 9 9 8 6 7 10 5 7 1 1 34 14 15 13 9 10 11 11 4 4 1 1 34 16 16 15 9 13 14 13 2 1 1 33 9 8 10 7 5 5 4 1 1 33 16 16 16 16 15 14 7 3 1 1...
output:
? 1 18 ? 2 19 ? 1 19 ? 3 19 ? 10 19 ? 6 19 ? 4 19 ? 5 19 ? 3 5 ? 5 7 ? 5 31 ! 5 31 ? 1 17 ? 17 33 ? 2 17 ? 9 17 ? 5 17 ? 7 17 ? 6 17 ? 6 30 ? 6 15 ! 6 15 ? 1 17 ? 17 33 ? 2 17 ? 17 26 ? 17 30 ? 17 32 ? 17 31 ? 24 31 ! 31 24 ? 1 18 ? 18 34 ? 2 18 ? 18 27 ? 18 31 ? 18 33 ? 18 32 ? 25 32 ? 5 32 ? 19 32...
result:
ok ok (1000 test cases)
Test #8:
score: 0
Accepted
time: 23ms
memory: 3584kb
input:
1000 36 18 17 17 16 8 4 2 1 1 2 1 36 3 2 4 8 3 1 2 1 36 13 14 12 9 11 11 10 6 1 1 36 5 6 4 9 5 3 4 9 1 1 36 18 17 17 16 9 13 12 13 2 2 1 1 36 12 13 11 3 5 5 4 7 5 1 1 35 13 12 14 6 9 7 6 5 1 1 36 13 14 12 4 5 4 3 6 5 1 1 36 14 15 13 9 10 10 9 5 5 1 1 36 16 17 15 9 12 10 9 8 3 1 1 36 9 10 8 9 5 7 6 9...
output:
? 1 19 ? 2 20 ? 1 20 ? 3 20 ? 11 20 ? 15 20 ? 17 20 ? 18 20 ? 19 20 ? 16 18 ! 18 20 ? 1 19 ? 19 36 ? 2 19 ? 19 28 ? 19 33 ? 19 35 ? 19 34 ! 35 19 ? 1 19 ? 19 36 ? 2 19 ? 10 19 ? 5 19 ? 3 19 ? 4 19 ? 4 34 ? 4 10 ! 4 10 ? 1 19 ? 19 36 ? 2 19 ? 10 19 ? 5 19 ? 3 19 ? 4 19 ? 3 25 ? 3 17 ! 3 17 ? 1 19 ? 2...
result:
ok ok (1000 test cases)
Test #9:
score: 0
Accepted
time: 14ms
memory: 3584kb
input:
1000 37 17 16 17 8 5 6 7 3 3 12 1 1 36 17 16 17 8 5 7 8 1 1 38 9 10 8 6 5 3 4 11 1 1 37 15 16 14 6 4 4 3 4 4 1 1 37 12 11 13 3 4 1 2 1 36 8 7 9 9 6 6 5 1 1 37 6 5 7 10 6 4 5 1 1 37 18 18 18 18 17 16 9 13 11 10 10 2 2 1 1 37 17 16 17 8 3 1 2 1 37 8 9 7 7 4 4 3 11 5 1 1 37 10 9 11 10 10 8 9 1 1 37 18 ...
output:
? 1 19 ? 19 37 ? 2 19 ? 19 29 ? 19 24 ? 19 27 ? 19 26 ? 24 27 ? 27 30 ? 3 27 ? 14 27 ! 27 14 ? 1 19 ? 19 36 ? 2 19 ? 19 28 ? 19 24 ? 19 26 ? 19 27 ? 26 28 ! 28 26 ? 1 20 ? 20 38 ? 2 20 ? 10 20 ? 5 20 ? 7 20 ? 8 20 ? 7 34 ? 7 18 ! 7 18 ? 1 19 ? 19 37 ? 2 19 ? 10 19 ? 14 19 ? 12 19 ? 13 19 ? 9 13 ? 13...
result:
ok ok (1000 test cases)
Test #10:
score: 0
Accepted
time: 17ms
memory: 3712kb
input:
1000 39 18 19 17 9 5 7 6 6 2 2 1 1 38 8 7 9 5 4 2 3 1 1 38 19 19 17 18 16 8 5 6 5 6 3 3 1 1 39 12 13 11 10 14 12 8 1 1 38 15 14 16 6 3 4 3 2 1 1 39 4 5 5 2 7 1 1 39 18 17 18 10 15 16 17 3 3 6 1 1 38 18 18 17 9 4 2 1 1 2 1 39 14 15 15 2 6 1 1 39 11 12 10 6 7 5 4 5 9 1 1 39 9 10 8 10 9 7 8 6 11 1 1 38...
output:
? 1 20 ? 20 39 ? 2 20 ? 10 20 ? 15 20 ? 12 20 ? 13 20 ? 14 20 ? 11 13 ? 13 15 ? 13 25 ! 13 25 ? 1 20 ? 20 38 ? 2 20 ? 20 30 ? 20 35 ? 20 33 ? 20 32 ? 21 33 ! 33 21 ? 1 20 ? 2 21 ? 3 22 ? 2 22 ? 4 22 ? 12 22 ? 17 22 ? 14 22 ? 15 22 ? 16 22 ? 12 15 ? 15 18 ? 15 26 ! 15 26 ? 1 20 ? 20 39 ? 2 20 ? 10 20...
result:
ok ok (1000 test cases)
Test #11:
score: 0
Accepted
time: 15ms
memory: 3456kb
input:
1000 40 12 13 11 10 7 7 6 9 9 1 1 40 18 19 17 8 5 8 7 3 3 1 1 40 15 16 14 10 15 13 14 5 6 1 1 40 8 9 9 13 1 1 40 16 15 17 6 5 4 3 4 1 1 40 15 14 16 9 10 8 7 8 6 6 5 1 1 41 13 14 14 8 1 1 40 7 6 8 10 6 5 4 5 1 1 40 18 17 19 8 3 3 4 1 1 40 6 7 5 10 5 4 3 4 11 1 1 40 4 5 3 10 7 4 7 1 1 41 12 13 11 10 1...
output:
? 1 21 ? 21 40 ? 2 21 ? 11 21 ? 6 21 ? 8 21 ? 7 21 ? 7 38 ? 7 16 ? 7 26 ! 7 26 ? 1 21 ? 21 40 ? 2 21 ? 11 21 ? 16 21 ? 13 21 ? 12 21 ? 9 12 ? 12 15 ? 12 27 ! 12 27 ? 1 21 ? 21 40 ? 2 21 ? 11 21 ? 6 21 ? 3 21 ? 4 21 ? 3 37 ? 3 9 ? 3 33 ! 3 33 ? 1 21 ? 21 40 ? 2 21 ? 1 28 ? 1 14 ! 1 14 ? 1 21 ? 21 40 ...
result:
ok ok (1000 test cases)
Test #12:
score: 0
Accepted
time: 23ms
memory: 3584kb
input:
1000 42 11 12 10 11 6 8 7 11 1 1 41 17 16 18 11 14 15 14 13 1 1 41 8 7 9 11 9 6 7 11 4 8 1 1 41 12 11 13 10 7 7 6 10 10 2 1 1 41 12 13 11 4 7 5 4 3 9 5 1 1 41 18 17 19 11 13 14 14 4 4 13 1 1 41 14 13 15 11 16 14 1 1 41 20 20 19 18 10 14 12 11 10 2 2 1 1 41 17 16 18 11 14 15 14 13 5 5 12 1 1 41 15 14...
output:
? 1 22 ? 22 42 ? 2 22 ? 11 22 ? 6 22 ? 8 22 ? 7 22 ? 6 37 ? 6 17 ! 6 17 ? 1 21 ? 21 41 ? 2 21 ? 21 32 ? 21 37 ? 21 40 ? 21 39 ? 21 38 ? 33 38 ! 38 33 ? 1 21 ? 21 41 ? 2 21 ? 21 32 ? 21 37 ? 21 40 ? 21 39 ? 26 40 ? 13 40 ? 23 40 ? 16 40 ! 40 16 ? 1 21 ? 21 41 ? 2 21 ? 21 32 ? 21 37 ? 21 35 ? 21 36 ? ...
result:
ok ok (1000 test cases)
Test #13:
score: 0
Accepted
time: 12ms
memory: 3584kb
input:
1000 43 4 5 3 10 5 2 3 8 1 1 42 18 19 17 8 3 3 4 4 1 1 43 6 7 5 8 3 4 3 2 12 1 1 43 18 17 19 11 13 10 9 10 5 5 2 1 1 43 21 21 21 20 20 19 11 17 18 17 18 3 3 1 1 43 17 16 18 11 12 14 13 6 6 14 1 1 43 18 19 17 11 16 16 17 4 1 1 43 21 21 21 20 20 21 1 1 42 13 12 14 11 8 8 7 1 1 42 20 19 20 10 6 9 10 1 ...
output:
? 1 22 ? 22 43 ? 2 22 ? 11 22 ? 6 22 ? 3 22 ? 4 22 ? 3 28 ? 3 21 ! 3 21 ? 1 22 ? 22 42 ? 2 22 ? 11 22 ? 16 22 ? 19 22 ? 17 22 ? 12 16 ? 16 20 ! 16 20 ? 1 22 ? 22 43 ? 2 22 ? 11 22 ? 6 22 ? 3 22 ? 4 22 ? 5 22 ? 5 32 ? 5 21 ! 5 21 ? 1 22 ? 22 43 ? 2 22 ? 22 33 ? 22 39 ? 22 36 ? 22 35 ? 22 34 ? 30 35 ?...
result:
ok ok (1000 test cases)
Test #14:
score: 0
Accepted
time: 15ms
memory: 3584kb
input:
1000 44 22 22 20 21 19 11 17 18 17 18 3 3 1 1 44 11 12 10 11 8 9 8 7 9 12 1 1 43 11 10 12 6 6 3 4 1 1 43 21 21 21 21 20 19 10 5 3 5 2 2 1 1 44 19 20 18 11 17 19 3 4 1 1 44 16 17 15 11 13 14 13 12 7 1 1 44 17 16 18 6 5 4 3 4 5 6 10 1 1 44 10 11 9 7 5 4 4 3 13 5 1 1 43 13 12 14 4 8 5 4 3 5 10 14 1 1 4...
output:
? 1 23 ? 2 24 ? 3 25 ? 2 25 ? 4 25 ? 14 25 ? 8 25 ? 5 25 ? 6 25 ? 7 25 ? 3 6 ? 6 9 ? 6 41 ! 6 41 ? 1 23 ? 23 44 ? 2 23 ? 12 23 ? 6 23 ? 3 23 ? 4 23 ? 5 23 ? 5 37 ? 5 17 ? 5 29 ! 5 29 ? 1 22 ? 22 43 ? 2 22 ? 22 33 ? 22 39 ? 22 36 ? 22 35 ? 24 36 ! 36 24 ? 1 22 ? 1 23 ? 2 23 ? 2 24 ? 3 24 ? 4 24 ? 13 ...
result:
ok ok (1000 test cases)
Test #15:
score: 0
Accepted
time: 21ms
memory: 3584kb
input:
1000 45 20 19 21 12 18 20 4 2 5 1 1 45 16 15 17 12 13 14 13 12 8 8 15 1 1 45 10 11 9 11 7 8 7 6 13 1 1 45 15 16 14 11 10 13 11 8 8 1 1 45 11 12 10 11 14 11 12 1 1 45 16 15 17 11 11 8 9 8 8 2 1 1 45 19 18 20 8 6 5 4 5 1 1 45 5 4 6 10 4 3 2 3 3 6 4 1 1 44 19 18 20 11 14 13 13 12 1 1 45 12 13 13 2 11 1...
output:
? 1 23 ? 23 45 ? 2 23 ? 23 35 ? 23 41 ? 23 44 ? 41 45 ? 4 45 ? 40 45 ? 5 45 ! 45 5 ? 1 23 ? 23 45 ? 2 23 ? 23 35 ? 23 41 ? 23 44 ? 23 43 ? 23 42 ? 34 42 ? 5 42 ? 27 42 ? 12 42 ! 42 12 ? 1 23 ? 23 45 ? 2 23 ? 12 23 ? 6 23 ? 3 23 ? 4 23 ? 5 23 ? 5 37 ? 5 18 ! 5 18 ? 1 23 ? 23 45 ? 2 23 ? 12 23 ? 6 23 ...
result:
ok ok (1000 test cases)
Test #16:
score: 0
Accepted
time: 17ms
memory: 3456kb
input:
1000 46 18 19 17 9 13 10 9 8 6 6 1 1 46 9 10 8 12 8 7 6 7 7 11 1 1 46 22 22 21 12 17 15 16 16 2 2 1 1 46 19 20 18 12 14 15 15 5 1 1 46 5 6 6 9 1 1 46 21 22 20 10 6 9 9 8 3 3 1 1 46 18 19 17 7 6 9 8 6 6 1 1 46 16 17 15 5 6 8 6 8 8 1 1 46 22 21 22 11 5 2 2 1 1 46 5 6 4 12 8 5 3 7 1 1 45 19 18 20 12 14...
output:
? 1 24 ? 24 46 ? 2 24 ? 12 24 ? 6 24 ? 9 24 ? 10 24 ? 11 24 ? 5 11 ? 11 17 ? 11 31 ! 11 31 ? 1 24 ? 24 46 ? 2 24 ? 12 24 ? 6 24 ? 3 24 ? 4 24 ? 5 24 ? 4 35 ? 4 19 ? 4 29 ! 4 29 ? 1 24 ? 24 46 ? 2 24 ? 12 24 ? 6 24 ? 9 24 ? 7 24 ? 8 24 ? 5 7 ? 7 9 ? 7 39 ! 7 39 ? 1 24 ? 24 46 ? 2 24 ? 12 24 ? 6 24 ? ...
result:
ok ok (1000 test cases)
Test #17:
score: 0
Accepted
time: 58ms
memory: 3584kb
input:
1000 1000000000 499999999 499999998 499999999 250000000 374999999 312500000 343750000 359375000 367187500 371093750 373046874 372070312 371582032 371826173 371948243 372009278 372039796 372055054 372047425 372043611 372045519 372046473 372046950 372047188 372047307 372047367 372047396 372047381 3720...
output:
? 1 500000001 ? 500000001 1000000000 ? 2 500000001 ? 500000001 750000001 ? 500000001 875000001 ? 500000001 812500001 ? 500000001 843750001 ? 500000001 859375001 ? 500000001 867187501 ? 500000001 871093751 ? 500000001 873046876 ? 500000001 872070314 ? 500000001 871582033 ? 500000001 871826174 ? 50000...
result:
ok ok (1000 test cases)
Test #18:
score: 0
Accepted
time: 72ms
memory: 3456kb
input:
1000 1000000000 499999969 499999970 499999968 249999969 124999969 62500000 93750000 109374969 101562469 97656219 95703125 96679688 97167938 96923798 96801728 96740724 96771211 96755952 96748354 96752138 96750231 96749277 96748831 96749070 96749158 96749099 96749100 96749110 96749102 96749098 9674909...
output:
? 1 500000001 ? 500000001 1000000000 ? 2 500000001 ? 250000001 500000001 ? 375000001 500000001 ? 437500001 500000001 ? 406250001 500000001 ? 390625001 500000001 ? 398437501 500000001 ? 402343751 500000001 ? 404296876 500000001 ? 403320313 500000001 ? 402832032 500000001 ? 403076172 500000001 ? 40319...
result:
ok ok (1000 test cases)
Test #19:
score: -100
Runtime Error
input:
1000 1000000000 474148191 474148192 474148190 250000000 349148191 286648191 255398191 239773191 242187501 238281251 237820066 237304688 237331785 237087645 237182617 237121582 237091064 237075805 237080016 237076202 237074295 237074851 237074374 237074135 237074176 237074117 237074105 237074102 2370...
output:
? 1 500000001 ? 500000001 1000000000 ? 2 500000001 ? 250000001 500000001 ? 125000001 500000001 ? 187500001 500000001 ? 218750001 500000001 ? 234375001 500000001 ? 242187501 500000001 ? 238281251 500000001 ? 236328126 500000001 ? 237304688 500000001 ? 236816407 500000001 ? 237060547 500000001 ? 23718...