QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#396868#6749. TargetVictorYuan#WA 6ms9112kbC++14977b2024-04-23 11:44:342024-04-23 11:44:35

Judging History

你现在查看的是最新测评结果

  • [2024-04-23 11:44:35]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:9112kb
  • [2024-04-23 11:44:34]
  • 提交

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;
    }
  }
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 6ms
memory: 9112kb

input:

0.5 0.25

output:

1222221222222211

result:

wrong answer wa