QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#412045#6749. Targethhu_yjhWA 1ms3612kbC++171.2kb2024-05-15 23:40:312024-05-15 23:40:32

Judging History

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

  • [2024-05-15 23:40:32]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3612kb
  • [2024-05-15 23:40:31]
  • 提交

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;




}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3612kb

input:

0.5 0.25

output:

1 

result:

wrong answer wa