QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#396869#6749. TargetVictorYuan#WA 10ms9180kbC++14977b2024-04-23 11:46:152024-04-23 11:46:16

Judging History

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

  • [2024-04-23 11:46:16]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:9180kb
  • [2024-04-23 11:46:15]
  • 提交

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

详细

Test #1:

score: 0
Wrong Answer
time: 10ms
memory: 9180kb

input:

0.5 0.25

output:

2212112222222222211

result:

wrong answer wa