QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#825833#9770. Middle Pointucup-team3474#WA 1ms3808kbC++231.4kb2024-12-21 23:30:422024-12-21 23:30:46

Judging History

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

  • [2024-12-21 23:30:46]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3808kb
  • [2024-12-21 23:30:42]
  • 提交

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))&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: 3584kb

input:

2 2
1 1

output:

1
0 0 2 2

result:

ok correct!

Test #2:

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

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: 0ms
memory: 3500kb

input:

0 0
0 0

output:

0

result:

ok correct!

Test #4:

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

input:

2024 0
1012 0

output:

1
0 0 2024 0

result:

ok correct!

Test #5:

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

input:

2024 2024
2023 2023

output:

-1

result:

ok correct!

Test #6:

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

input:

8 6
7 3

output:

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

result:

wrong answer (8,3) is not in S