QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#409269#6749. Targetundefined-ux#WA 0ms3972kbC++14859b2024-05-11 21:02:562024-05-11 21:02:56

Judging History

This is the latest submission verdict.

  • [2024-05-11 21:02:56]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3972kb
  • [2024-05-11 21:02:56]
  • Submitted

answer

#include <bits/stdc++.h>
#define qio std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
using namespace std;
const int N = 1e5 + 20;
typedef pair<int, int> PII;
typedef struct {
    double a;  string path;
} Node;

double a, b;

void solve(queue<Node>& q) {
    while(!q.empty()) {
        auto now = q.front(); q.pop();
        if(abs(now.a - b) <= 1e-4) {
            cout << now.path << endl;
            return ;
        }
        if(now.path.size() >= 50) continue;
        if(now.a >= b) q.push({now.a / 2, now.path + "1"});
        if((now.a + 1) / 2 <= b) {
            q.push({(now.a + 1) / 2, now.path + "2"});
        }
    }
}

int main() { qio
    int  t = 1;

    while(t--) {
        queue<Node> q;
        cin >> a >> b;
        q.push({a, ""});
        solve(q);
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3972kb

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

1 0.75

output:

12

result:

ok ok

Test #3:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3812kb

input:

0.361954 0.578805

output:


result:

wrong answer wa