QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#235945 | #7638. Lake | ucup-team956# | WA | 0ms | 3640kb | C++14 | 649b | 2023-11-03 13:48:51 | 2023-11-03 13:48:51 |
Judging History
answer
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i <= b; ++i)
using namespace std;
#define int long long
const int _ = 2e6+6;
bool check(int mid,int n,int m) {
int tot=mid*5;
int need=n+m-min(min(n,m),mid*4);
if(tot>=need) return 1;
return 0;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n,m;
cin>>n>>m;
int l=0,r=n+m,ans=0;
while(l<=r) {
int mid=(l+r)>>1;
if(check(mid,n,m)) {
r=mid-1;
ans=mid;
} else {
l=mid+1;
}
}
ans=(ans-1)*2+1;
cout<<ans<<"\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3640kb
input:
1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
1 4
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 5
output:
3
result:
ok single line: '3'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3548kb
input:
4 4
output:
1
result:
wrong answer 1st lines differ - expected: '3', found: '1'