QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#235945#7638. Lakeucup-team956#WA 0ms3640kbC++14649b2023-11-03 13:48:512023-11-03 13:48:51

Judging History

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

  • [2023-11-03 13:48:51]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3640kb
  • [2023-11-03 13:48:51]
  • 提交

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'