QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#824576#9770. Middle Pointucup-team3586#WA 1ms3824kbC++231.5kb2024-12-21 14:45:292024-12-21 14:45:46

Judging History

This is the latest submission verdict.

  • [2024-12-21 14:45:46]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3824kb
  • [2024-12-21 14:45:29]
  • Submitted

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int A,B,C,D;
	cin>>A>>B>>C>>D;
	A=max(A,1);
	B=max(B,1);
	int g1=__gcd(A,C);
	A/=g1;
	C/=g1;
	int g2=__gcd(B,D);
	B/=g2;
	D/=g2;
	if(__builtin_popcount(A)>1) die("-1");
	if(__builtin_popcount(B)>1) die("-1");
	int x=0,y=0;
	cout<<max(__lg(A),__lg(B))<<'\n';
	while(A>B)
	{
		int val=A/2;
		cout<<x*g1<<" "<<y*g2<<" "<<(x+A)*g1<<" "<<y*g2<<'\n';
		if(val<=C)
		{
			C-=val;
			x+=val;
		}
		A/=2;
	}
	while(A<B)
	{
		int val=B/2;
		cout<<x*g1<<" "<<y*g2<<" "<<x*g1<<" "<<(y+B)*g2<<'\n';
		if(val<=D)
		{
			D-=val;
			y+=val;
		}
		B/=2;
	}
	while(A>1)
	{
		int val=A/2;
		cout<<x*g1<<" "<<y*g2<<" "<<(x+A)*g1<<" "<<(y+B)*g2<<'\n';
		if(val<=C)
		{
			C-=val;
			x+=val;
		}
		if(val<=D)
		{
			D-=val;
			y+=val;
		}
		A/=2;
		B/=2;
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3668kb

input:

2 2
1 1

output:

1
0 0 2 2

result:

ok correct!

Test #2:

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

input:

8 8
5 0

output:

3
0 0 8 0
4 0 8 0
4 0 6 0

result:

ok correct!

Test #3:

score: 0
Accepted
time: 1ms
memory: 3520kb

input:

0 0
0 0

output:

0

result:

ok correct!

Test #4:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

2024 0
1012 0

output:

1
0 0 2024 0

result:

ok correct!

Test #5:

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

input:

2024 2024
2023 2023

output:

-1

result:

ok correct!

Test #6:

score: 0
Accepted
time: 1ms
memory: 3740kb

input:

8 6
7 3

output:

3
0 0 8 0
4 0 8 0
6 0 8 6

result:

ok correct!

Test #7:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

2024 2026
2024 2026

output:

0

result:

ok correct!

Test #8:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

1000000000 1000000000
70 0

output:

-1

result:

ok correct!

Test #9:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

3 6
2 4

output:

-1

result:

ok correct!

Test #10:

score: 0
Accepted
time: 1ms
memory: 3492kb

input:

7 7
7 2

output:

-1

result:

ok correct!

Test #11:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

6 2
5 2

output:

-1

result:

ok correct!

Test #12:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

5 7
5 5

output:

-1

result:

ok correct!

Test #13:

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

input:

4 7
2 3

output:

-1

result:

ok correct!

Test #14:

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

input:

8 2
2 2

output:

2
0 0 8 0
0 0 4 0

result:

wrong answer target point have not been added into S