QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#852102#9770. Middle PointWanyeWA 0ms3576kbC++14921b2025-01-11 10:07:362025-01-11 10:07:38

Judging History

This is the latest submission verdict.

  • [2025-01-11 10:07:38]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3576kb
  • [2025-01-11 10:07:36]
  • Submitted

answer

#include<bits/stdc++.h>
#define ll long long
#define N 50005
using namespace std;
struct node{ll a,b,c,d;};
ll a,b,x,y,ta,tb,la,ra,lb,rb,viss[N],ans;
vector<node> ans2;
inline void dfs(ll x,ll y,ll dep){
	if(!dep) return ;
	dfs(2*x-(2*x>a?a:0),2*y-(2*y>b?b:0),dep-1);
	cout<<(2*x>a?a:0)<<" "<<(2*y>b?b:0)<<" "<<2*x-(2*x>a?a:0)<<" "<<2*y-(2*y>b?b:0)<<endl;
}
int main(){
	ll num1 = 0,num2 = 0;
	cin>>a>>b>>x>>y;
	if(x==0&&y==0||x==a&&y==0||x==0&&y==b||x==a&&y==b){
		cout<<0<<endl;
		return 0;
	}
	if(a){
		ta = a;
		while(ta%2==0) ta/=2,num1++;
		if(x%ta!=0){
			cout<<-1<<endl;
			return 0;
		}
	}
	if(b){
		tb = b;
		while(tb%2==0) tb/=2,num2++;
		if(y%tb!=0){
			cout<<-1<<endl;
			return 0;
		}
	}
	ans=max(num1,num2);
	dfs(x,y,ans);
	cout<<ans2.size()<<endl;
	for(int i=0;i<ans2.size();i++) cout<<ans2[i].a<<" "<<ans2[i].b<<" "<<ans2[i].c<<" "<<ans2[i].d<<endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3576kb

input:

2 2
1 1

output:

0 0 2 2
0

result:

wrong answer target point have not been added into S