QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#623912#7781. Sheep Eat WolvesMEshooter#WA 0ms3892kbC++20790b2024-10-09 14:21:272024-10-09 14:21:41

Judging History

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

  • [2024-10-09 14:21:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3892kb
  • [2024-10-09 14:21:27]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int SIZE = 2e5+10;
int x,y,p,q,xl,xr,yl,yr;

int main(){
    scanf("%lld%lld%lld%lld",&x,&y,&p,&q);
    int ans=0;
    xl=x,xr=0,yl=y,yr=0;
    while(xl)
    {
        if(xl<=p){ans++;break;}
        else if(yl-q>xl-p)
        {
            ans++;
            int k=yl-xl-q;
            if(k>p){printf("-1");return 0;}
            int wolf =(k+p+1)/2;
            yl-=wolf;
            yr=wolf;
            xl-=p-wolf;
            xr+=p-wolf;
        }
        else
        {
            ans++;
            xl-=p;
            xr+=p;
        }
        ans++;
        if(yr-xr-q>0&&xr>0)
        {
            yl+=yr-xr-q;
            yr-=yr-xr-q;
        }
    }
    printf("%lld",ans);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3892kb

input:

4 4 3 1

output:

0

result:

wrong answer 1st numbers differ - expected: '3', found: '0'