QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#852106#9770. Middle PointWanyeWA 0ms3716kbC++14764b2025-01-11 10:08:242025-01-11 10:08:24

Judging History

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

  • [2025-01-11 10:08:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3716kb
  • [2025-01-11 10:08:24]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct node{ll a,b,c,d;};
ll a,b,x,y,ta,tb,la,ra,lb,rb,ans;
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);
	cout<<ans<<endl;
	dfs(x,y,ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 2
1 1

output:

1
0 0 2 2

result:

ok correct!

Test #2:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

8 8
5 0

output:

3
0 0 8 0
0 0 4 0
8 0 2 0

result:

ok correct!

Test #3:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

0 0
0 0

output:

0

result:

ok correct!

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3640kb

input:

2024 0
1012 0

output:

3
2024 0 2024 0
2024 0 2024 0
0 0 2024 0

result:

wrong answer Jury has a better answer