QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#22459#2359. The Five Bishopsjyyyyds#TL 0ms0kbC++112.9kb2022-03-09 18:49:112022-04-30 01:07:24

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 01:07:24]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2022-03-09 18:49:11]
  • 提交

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=read(),B=read(),C=read(),D=read();
	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);
	a[x]+=s;b[x]+=s*tp;
	get();
}
int id[6];
void ni_yi_jing_si_la(){
	for(int i=1;i<=5;i++)id[i]=0;
	int hh=a[6]-b[6];
	for(int i=-2;i<=2;i++){
		for(int j=1;j<=5;j++)if(a[j]-b[j]==hh-i){
			id[j]=1;
			break;
		}
	}
	int now=0;
	for(int i=1;i<=5;i++)if(!id[i]){now=i;break;}
	if((a[now]-b[now]+(int)1e8)%2==hh%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;
	vector<int>v[2];v[0].clear(),v[1].clear();
	for(int i=1;i<=6;i++)a[i]=read(),b[i]=read();
	for(int i=1;i<=5;i++)v[(a[i]%2)^(b[i]%2)].push_back(i);
	if(abs((int)v[0].size()-(int)v[1].size())!=1)return puts("0 0 0 0"),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];
		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;
		}
	}
	while(1){
		int pd1=0,pd2=0;
		int hh=a[6]-b[6];
		for(int i=1;i<=5;i++){
			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

output:


result: