QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#396868 | #6749. Target | VictorYuan# | WA | 6ms | 9112kb | C++14 | 977b | 2024-04-23 11:44:34 | 2024-04-23 11:44:35 |
Judging History
answer
#include <bits/stdc++.h>
int main() {
const int base = 1000000;
double A, B;
std::cin >> A >> B;
int x = A * base, y = B * base;
std::vector<int> pre(base + 1, -1);
pre[x] = 0;
std::queue<int> Q;
for (Q.push(x); !Q.empty(); Q.pop()) {
int u = Q.front();
// std::cerr << u << '\n';
int v = u >> 1;
if (pre[v] == -1) {
pre[v] = u;
Q.push(v);
}
v = (u - base) / 2 + base;
if (pre[v] == -1) {
pre[v] = u;
Q.push(v);
}
}
for (int i = y - 1000; i <= y + 1000; ++i) if (i >= 0 && i < pre.size() && pre[i] != -1){
std::vector<int> ans;
for (int u = i; u != x; u = pre[u]) {
if ((pre[u] >> 1) == u) ans.push_back(1);
else ans.push_back(2);
if (ans.size() > 50) break;
}
if (ans.size() < 50) {
std::reverse(ans.begin(), ans.end());
for (auto i : ans) std::cout << i;
std::cerr << i << '\n';
return 0;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 6ms
memory: 9112kb
input:
0.5 0.25
output:
1222221222222211
result:
wrong answer wa