# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
123414 |
2019-07-01T12:17:53 Z |
TuGSGeReL |
Aliens (IOI07_aliens) |
C++17 |
|
1000 ms |
408 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define mp make_pair
#define pub push_back
#define pob pop_back()
#define ss second
#define ff first
#define mt make_tuple
#define pof pop_front()
#define fbo find_by_order
#define ook order_of_key
#define lb lower_bound
#define ub upper_bound
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
using pll = pair <ll, ll>;
using pii = pair <int, int>;
int n, x, y, k = 1, rib, leb, upb, m;
bool examine(int a, int b)
{
if ( !a || !b || a > n || b > n )
return 0;
string bo;
cout << "examine " << a << " " << b << "\n";
cin >> bo;
if ( bo == "true" )
return 1;
return 0;
}
int main ()
{
ios_base::sync_with_stdio(false);
// cin.tie(0);
// cout.tie(0);
cin >> n >> x >> y;
while (examine(x, k + y))
{
k = k * 2;
if ( k + y > n )
{
k = n - y + 1;
break;
}
}
int l = y, r = y + k;
while (l + 1 < r)
{
int mid = (l + r) / 2;
if ( examine(x, mid) )
l = mid;
else
r = mid;
}
if ( examine(x, r) )
rib = r;
else
rib = l;
k = 1;
while (examine(x, y - k))
{
k = k * 2;
if ( x - k <= 0 )
{
k = y;
break;
}
}
l = y - k, r = y;
while (l + 1 < r)
{
int mid = (l + r) / 2;
if ( examine(x, mid) )
r = mid;
else
l = mid;
}
if ( examine(x, l) )
leb = l;
else
leb = r;
m = rib - leb + 1;
k = 1;
while (examine(x - k, y))
{
k = k * 2;
if ( x - k <= 0 )
{
k = x;
break;
}
}
l = x - k, r = x;
while (l + 1 < r)
{
int mid = (l + r) / 2;
if ( examine(mid, y) )
r = mid;
else
l = mid;
}
if ( examine(l, y) )
upb = l;
else
upb = r;
y = leb + m / 2;
x = upb + m / 2;
while ( x + 2 * m <= n && examine(x + m * 2, y) )
x += m * 2;
while ( y + 2 * m <= n && examine(x, y + m * 2) )
y += m * 2;
cout << "solution " << x - 2 * m << " " << y - 2 * m << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
380 KB |
Incorrect |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
252 KB |
Incorrect |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
260 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
248 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Output is correct |
2 |
Incorrect |
2 ms |
408 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
248 KB |
Output is correct |
2 |
Execution timed out |
3040 ms |
376 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Execution timed out |
3047 ms |
376 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |