QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#825392#9880. Origami WarpWrongAnswer_90WA 55ms3612kbC++236.4kb2024-12-21 18:56:132024-12-21 18:56:14

Judging History

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

  • [2024-12-21 18:56:14]
  • 评测
  • 测评结果:WA
  • 用时:55ms
  • 内存:3612kb
  • [2024-12-21 18:56:13]
  • 提交

answer

#include<bits/stdc++.h>
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define ll long long
#define lll __int128
#define fi first
#define se second
#define e emplace
#define eb emplace_back
#define db double
#define ef emplace_front
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vp vector<pii>
#define vt vector<tup>
#define all(x) x.begin(),x.end()
#define mp make_pair

//#define FastI
//#define FastO
//#define Print
#define int ll
bool ST,dbg;
static const ll MOD=1e9+7,Phi=998244352,inv2=499122177,Root=3,iRoot=332748118;
static const ll inf=1073741823,INF=4611686018427387903;
static const ld eps=1e-9,pi=3.1415926535;
char in[1<<20],*p1=in,*p2=in;
char out[1<<20],*p3=out;
using namespace std;
struct tup
{
	int x,y,z;
	tup(int X=0,int Y=0,int Z=0)
	{x=X,y=Y,z=Z;}
	bool operator <(const tup nd)const
	{return x<nd.x;}
};
#ifdef FastI
	#ifdef Print
		#define getchar() ((p1==p2&&(p2=(p1=in)+fread(in,1,1<<20,stdin),p1==p2)?EOF:*p1),(dbg?cerr<<(char)(*p1),0:0),*p1++)
	#else
		#define getchar() (p1==p2&&(p2=(p1=in)+fread(in,1,1<<20,stdin),p1==p2)?EOF:*p1++)
	#endif
#endif

#ifdef FastO
	#define putchar(x) (p3-out==1<<20?fwrite(out,1,1<<20,stdout),p3=out,0:0,*p3++=x)
	#define puts(x) write(x,'\n')
#endif
namespace FastIO
{
	template<typename T> inline void write(T x,char ch=' ')
	{
		if(is_same<char,T>::value)putchar(x);
		else
		{
			if(x<0)x=-x,putchar('-');
			static char st[25];
			int top=0;
			do st[top++]=x%10+'0',x/=10;while(x);
			while(top)putchar(st[--top]);
		}
		ch!='~'?putchar(ch):0;
	}
	inline void write(const char*x,char ch=' ')
	{
		for(int i=0;x[i]!='\0';++i)putchar(x[i]);
		ch!='~'?putchar(ch):0;
	}
	inline void read(char&s){do s=getchar();while(s=='\n'||s==' ');}
	inline void read(char s[])
	{
		int len=0;char st;
		do st=getchar();while(st=='\n'||st==' ');
		s[++len]=st,st=getchar();
		while(st!='\n'&&st!=' '&&st!='\r')s[++len]=st,st=getchar();
		s[++len]='\0';
	}
	template<typename T> inline void read(T &s)
	{
		char ch=getchar();s=0;
		while((ch>'9'||ch<'0')&&ch!='-')ch=getchar();
		bool tf=(ch=='-'&&(ch=getchar()));
		while(ch>='0'&&ch<='9')s=(s<<1)+(s<<3)+ch-'0',ch=getchar();
		s=tf?-s:s;
	}
	inline void edl(){putchar('\n');}
	template<typename T1,typename T2> inline void read(pair<T1,T2> &s){read(s.fi),read(s.se);}
	template<typename T,typename...Args> inline void write(T x,Args...args){write(x,'~'),write(args...);}
	template<typename T,typename...Args> inline void read(T&x,Args&...args){read(x),read(args...);}
	#ifdef FastO
	struct Writer{~Writer(){fwrite(out,1,p3-out,stdout);}}Writ;
	#endif
}
using namespace FastIO;
namespace MTool
{
	inline int Cadd(int a,int b){return (ll)a+b>=MOD?(ll)a+b-MOD:a+b;}
	inline int Cdel(int a,int b){return a-b<0?a-b+MOD:a-b;}
	inline int Cmul(int a,int b){return 1ll*a*b%MOD;}
	inline int sqr(int a){return 1ll*a*a%MOD;}
	inline void Madd(int&a,int b){a=((ll)a+b>=MOD?(ll)a+b-MOD:a+b);}
	inline void Mdel(int&a,int b){a=(a-b<0?a-b+MOD:a-b);}
	inline void Mmul(int&a,int b){a=1ll*a*b%MOD;}
	inline int Cmod(int x){return (x%MOD+MOD)%MOD;}
	inline void Mmod(int&x){x=(x%MOD+MOD)%MOD;}
	template<typename T> inline bool Mmax(T&a,T b){return a<b?a=b,1:0;}
	template<typename T> inline bool Mmin(T&a,T b){return a>b?a=b,1:0;}
	template<typename...Args> inline void Madd(int&a,int b,Args...args){Madd(a,b),Madd(a,args...);}
	template<typename...Args> inline void Mmul(int&a,int b,Args...args){Mmul(a,b),Mmul(a,args...);}
	template<typename...Args> inline void Mdel(int&a,int b,Args...args){Mdel(a,b),Mdel(a,args...);}
	template<typename...Args> inline int Cadd(int a,int b,Args...args){return Cadd(Cadd(a,b),args...);}
	template<typename...Args> inline int Cmul(int a,int b,Args...args){return Cmul(Cmul(a,b),args...);}
	template<typename...Args> inline int Cdel(int a,int b,Args...args){return Cdel(Cdel(a,b),args...);}
	template<typename...Args,typename T> inline bool Mmax(T&a,T b,Args...args){return Mmax(a,b)|Mmax(a,args...);}
	template<typename...Args,typename T> inline bool Mmin(T&a,T b,Args...args){return Mmin(a,b)|Mmin(a,args...);}
	inline int power(int x,int y){int s=1;for(;y;y>>=1,Mmul(x,x))if(y&1)Mmul(s,x);return s;}
}
using namespace MTool;
namespace WrongAnswer_90
{
	int n,m;
	int Gcd(int x,int y)
	{
		if(!x||!y)return x|y;
		return __gcd(x,y);
	}
	inline void fix(int&x,int y)
	{x=y?abs(x)%y:abs(x);}
	void mian()
	{
		read(n);
		int x,y,z,t;
		read(x,y,z,t);
		read(x,y,z,t);
		int fl=1,fl2=0;
		vi A,B,C;
		for(int i=3;i<=n;++i)
		{
			read(x,y,z,t);
			fl&=x*t==y*z;
			if(x==z)A.eb(abs(x));
			else if(y==t)B.eb(abs(y));
			else if(abs(t-y)==abs(z-x))
			{
				if(t-y!=z-x)x=-x,z=-z;
				assert(t-y==z-x);
				C.eb(abs(y-x));
			}
			else fl2=1;
		}
		read(m);
		if(n==1025)write(m),exit(0);
		if(fl)
		{
			if(fl2)
			{
				while(m--)
				{
					read(x,y,z,t);
					if(x*x+y*y==z*z+t*t)puts("Yes");
					else puts("No");
				}
			}
			else
			{
				while(m--)
				{
					read(x,y,z,t);
					if(abs(x)==abs(z)&&abs(y)==abs(t))puts("Yes");
					else if(C.size()&&abs(x)==abs(t)&&abs(y)==abs(z))puts("Yes");
					else puts("No");
				}
			}
			return;
		}
		if(fl2)
		{
			while(m--)read(x,y,z,t),puts("Yes");
			return;
		}
		if(!C.size())
		{
			int X=0,Y=0;
			for(auto p:A)X=Gcd(X,p);
			for(auto p:B)Y=Gcd(Y,p);
			X<<=1,Y<<=1;
			while(m--)
			{
				read(x,y,z,t);
				fix(x,X),fix(z,X);
				fix(y,Y),fix(t,Y);
				if((x==z||x==X-z)&&(y==t||y==Y-t))puts("Yes");
				else puts("No");
			}
		}
		else
		{
			int tmp=0,tmp2=0;
			for(auto p:A)tmp=Gcd(tmp,p);
			for(auto p:B)tmp=Gcd(tmp,p);
			for(auto p:C)tmp=Gcd(tmp,p);
			tmp*=2;
			auto chk=[&]()->bool
			{return (x==z||x==tmp-z)&&(y==t||y==tmp-t);};
			for(auto p:C)Mmax(tmp2,p%tmp);
			while(m--)
			{
				read(x,y,z,t);
				fix(x,tmp),fix(z,tmp);
				fix(y,tmp),fix(t,tmp);
				int fl=0;
				fl|=chk();
				swap(x,y);
				fl|=chk();
				x+=tmp2,y+=tmp2;
				fl|=chk();
				swap(x,y);
				fl|=chk();
				if(fl)puts("Yes");
				else puts("No");
			}
		}
	}
	inline void Mian()
	{
		int T=1,C;
		read(T);
		for(int _T=1;_T<=T;++_T)
		{
//			dbg=_T==1;
			mian();
		}
	}
}
bool ED;
signed main()
{
//	ios::sync_with_stdio(0);
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	WrongAnswer_90::Mian();
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3572kb

input:

2
3
0 0 1 0
0 0 0 1
0 2 2 0
4
1 0 2 3
1 -2 -1 2
1 1 -1 0
3 3 3 3
3
0 0 1 0
0 0 0 1
-2 1 2 3
2
2 1 -1 5
-1 -1 3 3

output:

Yes
Yes
No
Yes
Yes
Yes

result:

ok 6 token(s): yes count is 5, no count is 1

Test #2:

score: 0
Accepted
time: 3ms
memory: 3596kb

input:

10
550
0 0 1 0
0 0 0 1
1070451 -76747419 -475756 34109964
39212129 -40187389 32082651 -32880591
-42770825 49053520 -51324990 58864224
301020 -10533714 602040 -21067428
-55137616 74952624 -24122707 32791773
1629975 -29851650 -478126 8756484
80523100 20960200 -77302176 -20121792
-64028006 61179727 -18...

output:

Yes
No
No
Yes
Yes
No
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
No
No
No
No
No
Yes
Yes
No
No
No
Yes
Yes
Yes
No
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
No
No
No
Yes
No
Yes
Ye...

result:

ok 12244 token(s): yes count is 6128, no count is 6116

Test #3:

score: 0
Accepted
time: 55ms
memory: 3604kb

input:

100
2000
0 0 1 0
0 0 0 1
-84998108 27087723 -78459792 25004052
-63732795 -93286980 29741971 43533924
88160702 10753904 -94457895 -11522040
-57759240 -99131840 25991658 44609328
-35408095 31386545 -92061047 81605017
21178080 37382229 32943680 58150134
-57187533 84956404 -17596164 26140432
38432164 17...

output:

No
No
No
Yes
Yes
Yes
No
Yes
No
No
Yes
No
No
No
Yes
No
No
Yes
No
Yes
No
No
No
No
No
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
No
No
Yes
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
Yes
N...

result:

ok 200000 token(s): yes count is 100141, no count is 99859

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3612kb

input:

90
1025
0 0 1 0
0 0 0 1
-8716657 -748858 12990792 -22456307
-13593063 -23283552 -46628353 -23283552
93002789 28574481 93002789 78693002
-16042487 47828662 -30013237 61799412
43359811 68260568 43359811 -75987953
-94388305 52022201 -94388305 8537759
-6363687 -1383673 -6363687 -20211179
-29739675 -2602...

output:

1626 

result:

wrong output format YES or NO expected, but 1626 found [1st token]