QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#22511 | #2359. The Five Bishops | jyyyyds | TL | 0ms | 0kb | C++20 | 2.9kb | 2022-03-09 19:21:37 | 2022-04-30 01:15:52 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
namespace jyy{
const int mod=998244353,N=200010;
const double eps=1e-8;
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define IN inline
#define pi pair<int,int>
IN int read(){
static int x=0,f=1;x=0,f=1;
static char ch=getchar();
while(ch<'0'||ch>'9'){(ch=='-')?f*=-1:f;ch=getchar();}
while(ch>='0'&&ch<='9')x=x*10+int(ch-48),ch=getchar();
return x*f;
}
IN void fw(int x){if(x<0)putchar('-'),x=-x;x>=10?fw(x/10),1:0;putchar(char(x%10+48));}
}
using namespace jyy;
int a[10],b[10],pd=0;
void get(){
int A,B,C,D;
scanf("%d%d%d%d",&A,&B,&C,&D);
if(!A&&!B&&!C&&!D)return pd=1,void();
a[6]=C,b[6]=D;
}
void work(int x,int s,int tp){
printf("%d %d %d %d\n",a[x],b[x],a[x]+s,b[x]+s*tp);fflush(stdout);
a[x]+=s;b[x]+=s*tp;
get();
}
int id[6];
int now;
void ni_yi_jing_si_la(){
int hh=a[6]-b[6];
if((a[now]-b[now]+(int)1e8)%2==(hh%2+2)%2){
work(now,(a[now]-b[now]-hh)/2,-1);
if(!pd)puts("fuckljx"),exit(0);
return;
}
for(int i=1;i<=5;i++)if(i!=now&&a[i]-b[i]==hh+1){work(i,1,-1);if(pd)return;break;}
for(int i=1;i<=5;i++)if(i!=now&&a[i]-b[i]==hh+2){work(i,-1,-1);if(pd)return;break;}
for(int i=1;i<=5;i++)if(i!=now&&a[i]-b[i]==hh-2){work(i,2,-1);if(pd)return;break;}
hh=a[6]-b[6];
work(now,(a[now]-b[now]-hh)/2,-1);
if(!pd)puts("fuckljx"),exit(0);
return;
}
void solve(){
pd=0;
for(int i=1;i<=5;i++)id[i]=0;
vector<int>v[2];v[0].clear(),v[1].clear();
for(int i=1;i<=6;i++)scanf("%d%d",&a[i],&b[i]);
for(int i=1;i<=5;i++)v[((a[i]%2+2)%2)^((b[i]%2+2)%2)].push_back(i);
if(abs((int)v[0].size()-(int)v[1].size())!=1)return puts("0 0 0 0"),fflush(stdout),void();
for(int i=1;i<=5;i++){
work(i,i*(int)1e7,1);
if(pd)return;
}
for(int i=0;i<=1;i++){
int hh=a[6]-b[6];
int X=v[0][i],Y=v[1][i];
id[X]=id[Y]=1;
if(i==0){
int asd=(a[X]-b[X]-(hh-6))/2;
work(X,asd,-1);if(pd)return;
asd=(a[Y]-b[Y]-(hh-6))/2;
work(Y,asd,-1);if(pd)return;
}
else{
int asd=(a[X]-b[X]-(hh+6))/2;
work(X,asd,-1);if(pd)return;
asd=(a[Y]-b[Y]-(hh+6))/2;
work(Y,asd,-1);if(pd)return;
}
}
for(int i=1;i<=5;i++)if(!id[i]){now=i;break;}
while(1){
int pd1=0,pd2=0;
int hh=a[6]-b[6];
for(int i=1;i<=5;i++)if(i!=now){
if(a[i]-b[i]==hh-1)pd1=1;
if(a[i]-b[i]==hh+1)pd2=1;
}
if(pd1&&pd2)return ni_yi_jing_si_la();
if(!pd1){
int flag=0;
for(int i=1;i<=5;i++){
for(int j=1;j<=5;j++)if(i!=j){
if(a[i]-b[i]+1==a[j]-b[j]&&a[i]-b[i]<hh){
flag=1;
work(i,1,-1);if(pd)return;
break;
}
}
if(flag)break;
}
}
else{
int flag=0;
for(int i=1;i<=5;i++){
for(int j=1;j<=5;j++)if(i!=j){
if(a[i]-b[i]-1==a[j]-b[j]&&a[i]-b[i]>hh){
flag=1;
work(i,-1,-1);if(pd)return;
break;
}
}
if(flag)break;
}
}
}
}
int T;
int main(){
cin>>T;while(T--)solve();
}
详细
Test #1:
score: 0
Time Limit Exceeded
input:
4 1 1 2 2 3 3 4 4 5 5 7 5 1 1 1 2 1 4 1 5 2 2 3 5
output:
0 0 0 0 1 1 10000001 10000001