QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#412045 | #6749. Target | hhu_yjh | WA | 1ms | 3612kb | C++17 | 1.2kb | 2024-05-15 23:40:31 | 2024-05-15 23:40:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int N=3e6+10;
const int mod=998244353;
ll X,Y;
int T;
map<double,double> pre;
int main()
{
double b=0.5,x,z;
cin>>z>>x;
queue<double> q;
q.push(z);
vector<int> ans;
while(q.size()){
auto j=q.front();
q.pop();
double y=j*0.5;
if(abs(x-y)<=1e-4){
pre[y]=j;
ans.push_back(1);
y=j;
while(y!=z){
if(abs(pre[y]*0.5-y)<=1e-4) ans.push_back(1);
else ans.push_back(2);
y=pre[y];
}
break;
}
if(!pre[y]){
pre[y]=j;
q.push(y);
}
y=(j-1)*0.5+1;
if(abs(x-y)<=1e-4){
pre[y]=j;
ans.push_back(2);
y=j;
while(y!=z){
if(abs(pre[y]*0.5-y)<=1e-4) ans.push_back(1);
else ans.push_back(2);
y=pre[y];
}
break;
}
if(!pre[y]){
pre[y]=j;
q.push(y);
}
}
for(int i=ans.size()-1;i>=0;i--) cout<<ans[i]<<' ';
cout<<endl;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3612kb
input:
0.5 0.25
output:
1
result:
wrong answer wa