QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#414402#6749. TargetOneWanWA 2ms4024kbC++231.2kb2024-05-18 22:45:372024-05-18 22:45:37

Judging History

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

  • [2024-05-18 22:45:37]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:4024kb
  • [2024-05-18 22:45:37]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;

int __OneWan_2024 = [](){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	return 0;
}();
map<int, int> dist;
map<int, array<int, 2>> pre;
int main() {
	double a, b;
	cin >> a >> b;
	int ta = a * 20000, tb = b * 20000;
	dist[ta] = 0;
	queue<int> que;
	que.push(ta);
	pre[ta] = {-1, -1};
	while (!que.empty()) {
		int x = que.front();
		que.pop();
		if (x == tb) break;
		if (dist[x] == 50) continue;
		{
			int tx = x * 0.5;
			if (!dist.count(tx)) {
				dist[tx] = dist[x] + 1;
				pre[tx] = {x, 1};
				que.push(tx);
			} else {
				if (dist[tx] > dist[x] + 1) {
					dist[tx] = dist[x] + 1;
					pre[tx] = {x, 1};
					que.push(tx);
				}
			}
		}
		{
			int tx = (x + 10000);
			if (!dist.count(tx)) {
				dist[tx] = dist[x] + 1;
				pre[tx] = {x, 2};
				que.push(tx);
			} else {
				if (dist[tx] > dist[x] + 1) {
					dist[tx] = dist[x] + 1;
					pre[tx] = {x, 2};
					que.push(tx);
				}
			}
		}
	}
	vector<int> ans;
	int now = tb;
	while (pre[tb][0] != -1) {
		ans.push_back(pre[tb][1]);
		tb = pre[tb][0];
	}
	for (auto &x : ans) {
		cout << x;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

score: 0
Accepted
time: 2ms
memory: 4024kb

input:

1 0

output:

111111111111111

result:

ok ok

Test #4:

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

input:

0.361954 0.578805

output:

211121121111

result:

wrong answer wa