QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#228637#7638. Lakeucup-team1074#WA 1ms3592kbC++20922b2023-10-28 13:51:032023-10-28 13:51:04

Judging History

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

  • [2023-10-28 13:51:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3592kb
  • [2023-10-28 13:51:03]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define pb push_back
#define x first
#define y second 
#define endl '\n'
const LL maxn = 4e05+7;
const LL N=1e05+10;
const LL mod=1e09+7;
typedef pair<int,int>pl;
priority_queue<LL , vector<LL>, greater<LL> >t;
priority_queue<LL> q;
LL gcd(LL a, LL b){
	return b > 0 ? gcd(b , a % b) : a;
}

LL lcm(LL a , LL b){
	return a / gcd(a , b) * b;
}
void solve() 
{
	int ad , ch;
	cin>>ad>>ch;
	int res = abs(ad - ch);
	int k = min(ad , ch) / 3;
	ad -= k * 3;
	ch -= k * 3;
	res -= k;
	int t = min(ad , ch);
	if(t > 0){
		res -= (4 - t);
		k ++;
	}
	if(res > 0){
		k += (res - 1) / 4 + 1;
	}
	cout<<k * 2 - 1;
}            
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(10);
    int t=1;
	//cin>>t;
    while(t--)
    {
    	solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3424kb

input:

1 1

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

1 4

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3364kb

input:

5 5

output:

3

result:

ok single line: '3'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3360kb

input:

4 4

output:

3

result:

ok single line: '3'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3352kb

input:

3 4

output:

1

result:

ok single line: '1'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3360kb

input:

8 12

output:

5

result:

ok single line: '5'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

12 8

output:

5

result:

ok single line: '5'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3420kb

input:

8182 520051

output:

260025

result:

ok single line: '260025'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3524kb

input:

501760 6405

output:

250879

result:

ok single line: '250879'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3420kb

input:

823266 88861

output:

411633

result:

ok single line: '411633'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

239 145282

output:

72641

result:

ok single line: '72641'

Test #12:

score: -100
Wrong Answer
time: 1ms
memory: 3416kb

input:

699570 720193

output:

466379

result:

wrong answer 1st lines differ - expected: '405647', found: '466379'