QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#796183 | #7781. Sheep Eat Wolves | UESTC_DebugSimulator# | WA | 0ms | 3700kb | C++17 | 629b | 2024-12-01 13:53:23 | 2024-12-01 13:53:23 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int x,y,p,q;
cin>>x>>y>>p>>q;
int lx=x,ly=y,rx=0,ry=0;
int fl=0;
for(int i=1;i<=1000;i++){
int bx=0,by=0,r=p;
if(lx<=p){
cout<<2*i-1<<"\n";
break;
}
by=max(0,ly-lx-q);
r-=by;
if(r<0){
cout<<"-1\n";
break;
}
bx=r/2;
by+=(r+1)/2;
lx-=bx;
ly-=by;
rx+=bx;
ry+=by;
if(bx==0)fl++;
if(fl>=5){
cout<<"-1\n";
break;
}
if(rx){
by=max(0,ry-rx-q);
if(by>p){
cout<<"-1\n";
break;
}
ry-=by;
ly+=by;
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3672kb
input:
4 4 3 1
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
3 5 2 0
output:
5
result:
ok 1 number(s): "5"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
2 5 1 1
output:
-1
result:
ok 1 number(s): "-1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
1 1 1 0
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3640kb
input:
3 3 1 1
output:
-1
result:
wrong answer 1st numbers differ - expected: '7', found: '-1'