QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#609520 | #7638. Lake | PandaGhost | WA | 0ms | 3944kb | C++17 | 805b | 2024-10-04 13:20:43 | 2024-10-04 13:20:44 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define OPFI(x) freopen(#x".in", "r", stdin);\
freopen(#x".out", "w", stdout)
#define REP(i, a, b) for(int i=(a); i<=(b); ++i)
#define REPd(i, a, b) for(int i=(a); i>=(b); --i)
inline ll rd(){
ll r=0, k=1; char c; while(!isdigit(c=getchar())) if(c=='-') k=-k;
while(isdigit(c)) r=r*10+c-'0', c=getchar(); return r*k;
}
ll n, m, ans;
int main(){
n=rd(), m=rd();
ans=min(n/3, m/3);
n-=ans*3;
m-=ans*3;
if(n+m<=ans){
printf("%lld\n", 2*ans-1);
}else{
if(n>m) swap(n, m);
if(m<=ans){
printf("%lld\n", 2*ans+1);
}else{
m-=ans;
printf("%lld\n", 2*(ans+(m+3)/4)-1);
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3744kb
input:
1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
1 4
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
5 5
output:
3
result:
ok single line: '3'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
4 4
output:
3
result:
ok single line: '3'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
3 4
output:
1
result:
ok single line: '1'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
8 12
output:
5
result:
ok single line: '5'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
12 8
output:
5
result:
ok single line: '5'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
8182 520051
output:
260025
result:
ok single line: '260025'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
501760 6405
output:
250879
result:
ok single line: '250879'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
823266 88861
output:
411633
result:
ok single line: '411633'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
239 145282
output:
72641
result:
ok single line: '72641'
Test #12:
score: -100
Wrong Answer
time: 0ms
memory: 3796kb
input:
699570 720193
output:
466379
result:
wrong answer 1st lines differ - expected: '405647', found: '466379'