QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#32803#2290. Kinking CablesRobeZH#WA 5ms3852kbC++1.5kb2022-05-24 04:56:202022-05-24 04:56:21

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-24 04:56:21]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:3852kb
  • [2022-05-24 04:56:20]
  • 提交

answer

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

#define rep(i,n) for(int i=1;i<=n;++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
const ld eps=1e-12;
struct P{
    ld x,y;
    P operator+(P p){return (P){x+p.x,y+p.y};}
    P operator*(ld c){return (P){x*c,y*c};}
    P operator-(P p){return (P){x-p.x,y-p.y};}
    ld dis(){return hypot(x,y);}
};
int n,m;
ld d;
vector<P> ans;
void sol(){
    P p=(P){0,0},T=(P){1.L*n,1.L*m};
    for(int i=0;i<=n;++i){
        int stp;
        if(i&1)stp=-1;else stp=1;
        for(int j=0;j<=m;++j){
            P nxt=p;
            if(j<m)nxt.y+=stp;
            else nxt.x+=1;
            if(1+(nxt-T).dis()>d+eps){
                ans.pb(p);
                ld l=0,r=1;
                rep(tim,256){
                    ld mid=(l+r)/2;
                    P pos=p*(1-mid)+nxt*mid;
                    if((p-pos).dis()+(pos-T).dis()>d)r=mid;else l=mid;
                }
                P pos=p*(1-l)+nxt*l;
                if((p-pos).dis()>eps)ans.pb(pos);
                ans.pb(T);
                return;
            }else{
                ans.pb(p);
                p=nxt;
                d-=1;
            }
        }
    }
}
int main() {
    scanf("%d%d%Lf",&n,&m,&d);
    sol();
    printf("%d\n",ans.size());
    for(P p:ans)printf("%.15Lf %.15Lf\n",p.x,p.y);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 5ms
memory: 3852kb

input:

79 78
1980.7712136406

output:

1892
0.000000000000000 0.000000000000000
0.000000000000000 1.000000000000000
0.000000000000000 2.000000000000000
0.000000000000000 3.000000000000000
0.000000000000000 4.000000000000000
0.000000000000000 5.000000000000000
0.000000000000000 6.000000000000000
0.000000000000000 7.000000000000000
0.00000...

result:

wrong answer Integer parameter [name=p] equals to 1892, violates the range [2, 500]