# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
407095 |
2021-05-18T13:09:23 Z |
Falcon |
Aliens (IOI07_aliens) |
C++17 |
|
2 ms |
200 KB |
#include <bits/stdc++.h>
#ifdef DEBUG
#include "debug.hpp"
#endif
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define traverse(c, it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define rep(i, N) for(int i = 0; i < (N); ++i)
#define rrep(i, N) for(int i = (N) - 1; i >= 0; --i)
#define rep1(i, N) for(int i = 1; i <= (N); ++i)
#define rep2(i, s, e) for(int i = (s); i <= (e); ++i)
#ifdef DEBUG
#define debug(x...) { \
++dbg::depth; \
string dbg_vals = dbg::to_string(x); \
--dbg::depth; \
dbg::fprint(__func__, __LINE__, #x, dbg_vals); \
}
#define light_debug(x) { \
dbg::light = true; \
dbg::dout << __func__ << ":" << __LINE__; \
dbg::dout << " " << #x << " = " << x << endl; \
dbg::light = false; \
}
#else
#define debug(x...) 42
#define light_debug(x) 42
#endif
using ll = long long;
template<typename T>
inline T& ckmin(T& a, T b) { return a = a > b ? b : a; }
template<typename T>
inline T& ckmax(T& a, T b) { return a = a < b ? b : a; }
using point = complex<long long>;
namespace interact {
long long n;
bool in_range(point p) {
return 1 <= p.real() && 1 <= p.imag() && p.real() <= n && p.imag() <= n;
}
bool query(point p) {
if(!in_range(p)) return false;
cout << "examine " << p.real() << ' ' << p.imag() << endl;
string s; cin >> s;
return s == "true";
}
void answer(point p) {
cout << "solution " << p.real() << ' ' << p.imag() << endl;
}
} // namespace interact
point find_edge_in_dir(point p, point d) {
for(long long k = 1LL << 30; k > 0; k >>= 1)
if(interact::query(p + k * d))
p += k * d;
return p;
}
point find_last_in_dir(point p, point d, long long m) {
while(interact::query(p + 2 * m * d)) p += 2 * m * d;
return find_edge_in_dir(p, d);
}
long long find_m(point start) {
point l = find_edge_in_dir(start, -1);
point r = find_edge_in_dir(start, 1);
long long d = (r - l + 1LL).real(); // d = m or 3m or 5m
if(d % 3 != 0 && d % 5 != 0)
return d;
point p = (l + r) / 2LL;
if(d % 3 == 0 && !interact::query(p))
return d / 3;
if(d % 5 != 0)
return d;
p = (p + l + (d / 5 - 1) / 2) / 2LL;
if(interact::query(p))
return d;
else
return d / 5;
}
point find_center(point start, long long m) {
point i(0, 1);
point tr_corner = find_last_in_dir(find_last_in_dir(start, 1, m), i, m);
if(interact::query(tr_corner + 1LL + i))
tr_corner = tr_corner + m * (1LL + i);
return tr_corner - (5 * m - 1) / 2 * (1LL + i);
}
int main() {
long long x, y;
cin >> interact::n >> x >> y;
point start(x, y);
long long m = find_m(start);
interact::answer(find_center(start, m));
#ifdef DEBUG
dbg::dout << "\nExecution time: "
<< clock() * 1000 / CLOCKS_PER_SEC
<< "ms" << endl;
#endif
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
3 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
3 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Output is correct |
2 |
Correct |
2 ms |
200 KB |
Output is correct |
3 |
Correct |
2 ms |
200 KB |
Output is correct |