比赛 2026.4.4 评测结果 AAAAA
题目名称 For the Champion 最终得分 100
用户昵称 ChenBp 运行时间 0.016 s
代码语言 C++ 内存使用 3.66 MiB
提交时间 2026-04-04 11:19:15
显示代码纯文本
#include "robot.h"
//#include "grader.cpp" 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N49=4000000000ll,N19=1000000000ll;;

void init(int c, int t) {
	return;
}

ll dis(ll x1,ll y1,ll x2,ll y2){
    return llabs(x1 - x2) + llabs(y1 - y2);
}

pair<int, int> robot(int n, vector<int> x, vector<int> y) {
    int ys=0,yx=0;
    for(int i=0;i<n;i++){
        if(dis(N49,N49,x[ys],y[ys])>dis(N49,N49,x[i],y[i])) {
            ys=i;
        }
        if(dis(N49,-N49,x[yx],y[yx])>dis(N49,-N49,x[i],y[i])) {
            yx=i;
        }
    }
//    cout<<"["<<x[yx]<<","<<y[yx]<<"]\n";
//    cout<<"["<<x[ys]<<","<<y[ys]<<"]\n";
    move(1,N19);
    move(1,N19);
    move(4,N19);
    ll ts=move(4,N19);
    move(2,N19);
    move(2,N19);
    move(2,N19);
    ll tx=move(2,N19);
    
    ll sum=ts+tx+llabs(y[yx]-y[ys])-N49;
    pair<ll,ll>ans;
    ans.first=(sum+x[ys]+x[yx])/2;
    ans.second=y[ys]+ts-(ans.first-x[ys]);
    
    ans.first-=2*N19;
    ans.second-=2*N19;
    return ans;
}