QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#396869 | #6749. Target | VictorYuan# | WA | 10ms | 9180kb | C++14 | 977b | 2024-04-23 11:46:15 | 2024-04-23 11:46:16 |
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 - 100; i <= y + 100; ++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: 10ms
memory: 9180kb
input:
0.5 0.25
output:
2212112222222222211
result:
wrong answer wa