QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#825826 | #9770. Middle Point | ucup-team3474# | WA | 1ms | 3588kb | C++23 | 1.4kb | 2024-12-21 23:28:24 | 2024-12-21 23:28:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1919810;
typedef long long ll;
typedef pair<ll,ll> PII;
ll n,m,k;
ll a,b,x,y;
void cal(vector<PII> &v,ll len,ll x){
// cout<<len<<" "<<x<<endl;
if(x==0) return;
ll lb=0;
ll cnt=0;
while((1ll<<cnt)<len) cnt++;
while(((1ll<<lb)&x)==0) lb++;
ll l=0,r=len;
while(cnt>lb){
ll mid=l+r>>1;
v.push_back({l,r});
if((x>>cnt)&1) l=mid;
else r=mid;
cnt--;
}
}
void __(){
cin>>a>>b>>x>>y;
ll basea=a,baseb=b;
ll lena=1,lenb=1;
while(basea!=0&&basea%2==0){
basea/=2;
lena<<=1;
}
while(baseb!=0&&baseb%2==0){
baseb/=2;
lenb<<=1;
}
if(basea!=0&&x%basea!=0){
puts("-1");
return;
}
if(basea!=0)
x/=basea;
if(baseb!=0&&y%baseb!=0){
puts("-1");
return;
}
if(baseb!=0)
y/=baseb;
vector<PII> vx,vy;
cal(vx,lena,x);
cal(vy,lenb,y);
while(vx.size()<vy.size()) vx.push_back({x,x});
while(vy.size()<vx.size()) vy.push_back({y,y});
cout<<vx.size()<<endl;
for(int i=0;i<vx.size();i++){
cout<<vx[i].first*basea<<" "<<vy[i].first*baseb<<" "<<vx[i].second*basea<<" "<<vy[i].second*baseb<<"\n";
}
}
int main(){
int _=1;
// cin>>_;
while(_--){
__();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3588kb
input:
2 2 1 1
output:
1 0 0 2 2
result:
ok correct!
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3576kb
input:
8 8 5 0
output:
3 0 0 8 0 0 0 4 0 2 0 4 0
result:
wrong answer target point have not been added into S