这就是 GCJ
这就是 GCJ.jpg
神人题目。
人类可以想到的是,你第一步选
人类不能想到的是,你第一步改成选择 这个 )。
人类可以想到的是,你采取和 AI 一样的最优化策略,但是这样胜率只有
然后。。。人类已经灭亡,我们该怎么办?
然后官解声称你要让最后的 AI 尽可能靠边,所以你尽可能偏向某一边地选,这样最后 AI 挽回的那一步就能比较小了。
现在你每次尽可能选坐标
然后你继承
鉴定为非人。。。
注意每次加了线段之后都要更新选一对线段的贡献。如果你输入输出写炸了傻逼交互库会输出一个
代码:
#include<bits/stdc++.h>
#define ll long long
#define INF 214748364719260817ll
using namespace std;
ll t,n,w;
bool a[105],b[105];
struct px
{
ll a,b;
}s[105];
ll cot;
ll cnt[105][105];
random_device my;
mt19937 rd(my());
int main()
{
// ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>t>>n>>w;
while(t--)
{
cot=0;
for(ll i=1;i<=2*n;++i)a[i]=b[i]=0;
cout<<10<<' '<<10<<endl;
s[cot=1]=(px){10,10};a[10]=b[10]=1;
memset(cnt,0,sizeof(cnt));
for(ll i=1;i<=2*n;++i)
for(ll j=1;j<=2*n;++j)
if(i<s[cot].a&&j>s[cot].b||i>s[cot].a&&j<s[cot].b)
++cnt[i][j];
for(ll t=1;t<=n;++t)
{
cin>>s[++cot].a;
if(s[cot].a==-1)assert(0);
cin>>s[cot].b;
if(s[cot].a==-1)assert(0);
if(t==n)break;
a[s[cot].a]=b[s[cot].b]=1;
for(ll i=1;i<=2*n;++i)
for(ll j=1;j<=2*n;++j)
if(i<s[cot].a&&j>s[cot].b||i>s[cot].a&&j<s[cot].b)
++cnt[i][j];
ll maxn=-1,x=0,y=0;
for(ll i=1;i<=2*n;++i)
{
if(a[i])continue;
for(ll j=1;j<=2*n;++j)
{
if(b[j])continue;
ll ss=cnt[i][j];
if(maxn<ss)
maxn=ss,x=i,y=j;
else if(maxn==ss)
{
if(i<10&&j>10)
x=i,y=j;
else if(i+j<x+y)
x=i,y=j;
}
}
}
cout<<x<<' '<<y<<endl;
s[++cot].a=x;s[cot].b=y;
a[x]=b[y]=1;
for(ll i=1;i<=2*n;++i)
for(ll j=1;j<=2*n;++j)
cnt[i][j]+=(i<s[cot].a&&j>s[cot].b||i>s[cot].a&&j<s[cot].b);
}
ll win;
cin>>win;
if(win==-1)assert(0);
}
}