QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#852111 | #9770. Middle Point | Wanye | WA | 1ms | 3700kb | C++14 | 778b | 2025-01-11 10:10:00 | 2025-01-11 10:10:07 |
Judging History
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!=x) ta/=2,num1++;
if(x%ta!=0){
cout<<-1<<endl;
return 0;
}
}
if(b){
tb = b;
while(tb%2==0&&tb!=y) 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: 3644kb
input:
2 2 1 1
output:
1 0 0 2 2
result:
ok correct!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3560kb
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: 3648kb
input:
0 0 0 0
output:
0
result:
ok correct!
Test #4:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
2024 0 1012 0
output:
1 0 0 2024 0
result:
ok correct!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
2024 2024 2023 2023
output:
-1
result:
ok correct!
Test #6:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
8 6 7 3
output:
3 0 6 8 6 8 6 4 6 8 0 6 6
result:
ok correct!
Test #7:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
2024 2026 2024 2026
output:
0
result:
ok correct!
Test #8:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1000000000 1000000000 70 0
output:
-1
result:
ok correct!
Test #9:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
3 6 2 4
output:
-1
result:
ok correct!
Test #10:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
7 7 7 2
output:
-1
result:
ok correct!
Test #11:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
6 2 5 2
output:
-1
result:
ok correct!
Test #12:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
5 7 5 5
output:
-1
result:
ok correct!
Test #13:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
4 7 2 3
output:
-1
result:
ok correct!
Test #14:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
8 2 2 2
output:
2 0 2 8 2 0 2 4 2
result:
ok correct!
Test #15:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
3 3 0 2
output:
-1
result:
ok correct!
Test #16:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
7 7 1 4
output:
-1
result:
ok correct!
Test #17:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
6 3 6 1
output:
-1
result:
ok correct!
Test #18:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
4 2 2 1
output:
1 0 0 4 2
result:
ok correct!
Test #19:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
7 2 3 2
output:
-1
result:
ok correct!
Test #20:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
2 7 0 3
output:
-1
result:
ok correct!
Test #21:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
1 7 1 0
output:
0
result:
ok correct!
Test #22:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
5 1 0 0
output:
0
result:
ok correct!
Test #23:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
8 7 4 3
output:
-1
result:
ok correct!
Test #24:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
180057652 674822131 110693180 428023738
output:
-1
result:
ok correct!
Test #25:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
62347541 812142018 42922107 486416913
output:
-1
result:
ok correct!
Test #26:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
239604722 244429197 78993837 108804105
output:
-1
result:
ok correct!
Test #27:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
416861903 381749084 375027630 373683256
output:
-1
result:
ok correct!
Test #28:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
594119084 519068971 429116021 298715088
output:
-1
result:
ok correct!
Test #29:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
536870912 536870912 233225286 372408647
output:
29 536870912 0 536870912 536870912 0 536870912 536870912 268435456 536870912 536870912 268435456 402653184 0 0 402653184 469762048 0 0 201326592 234881024 0 0 100663296 117440512 536870912 536870912 50331648 58720256 0 0 293601280 297795584 0 536870912 146800640 148897792 0 0 73400320 342884352 5368...
result:
ok correct!
Test #30:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
536870912 536870912 242171716 210314503
output:
29 536870912 0 536870912 536870912 536870912 536870912 536870912 268435456 0 536870912 536870912 402653184 0 0 268435456 469762048 0 0 134217728 234881024 0 0 67108864 117440512 536870912 0 33554432 58720256 0 0 285212672 29360128 536870912 536870912 142606336 14680064 536870912 0 339738624 27577548...
result:
ok correct!
Test #31:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
536870912 536870912 251118145 48220392
output:
29 0 536870912 536870912 536870912 0 536870912 268435456 536870912 0 536870912 134217728 536870912 0 0 67108864 536870912 0 0 33554432 268435456 0 536870912 16777216 134217728 536870912 536870912 8388608 335544320 0 536870912 272629760 436207616 0 0 136314880 486539264 536870912 0 68157440 243269632...
result:
ok correct!
Test #32:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
126070784 536870912 70206899 483718753
output:
29 126070784 0 126070784 536870912 126070784 0 126070784 268435456 126070784 0 126070784 134217728 126070784 0 126070784 67108864 126070784 0 126070784 33554432 126070784 536870912 126070784 16777216 126070784 536870912 126070784 276824064 126070784 0 126070784 406847488 126070784 0 126070784 203423...
result:
ok correct!
Test #33:
score: -100
Wrong Answer
time: 0ms
memory: 3636kb
input:
134541312 536870912 92168682 321624642
output:
29 134541312 536870912 134541312 536870912 134541312 0 134541312 536870912 134541312 0 134541312 268435456 134541312 0 134541312 134217728 134541312 0 134541312 67108864 134541312 0 134541312 33554432 134541312 536870912 134541312 16777216 134541312 0 134541312 276824064 134541312 0 134541312 138412...
result:
wrong answer Jury has a better answer