acgo题库
  • 首页
  • 题库
  • 学习
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情提交记录(0)
  • 首发

    #include<bits/stdc++.h> using namespace std; long long n,m,k,s,x,y,jl=99999999; long long mx,my; int dpzc_jf(int a,int b,int x,int y){ int l,r,p=(a-x)2; if(b%2==1) {l=b-p;r=b;} else {l=(b+1)-p;p--;r=b-1;} if(l<=0) l=1; if(r>x2-1) r=x*2-1; if(l<=y&&y<=r) return y%2==1?p:p+1; else if(y>r) return p+y-r;else return p+l-y; } int main(){ iossync_with_stdio(0); stdcin.tie(0); std::cout.tie(0); cin>>n>>m>>x>>y; while(m--){ long long a,b,as;cin>>a>>b; if(a>x) as=dpzc_jf(a,b,x,y); else as=dpzc_jf(x,y,a,b); if(as+1<jl) mx=a,my=b; jl=min(jl,as+1); } cout<<mx<<" "<<my<<"\n"; cout<<jl; return 0; }

    userId_undefined

    STL魔法师

    秩序白银时间刺客空间掌握者时空双修者
    3阅读
    0回复
    0点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页