QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#228688#7638. Lakeucup-team1074#WA 0ms3704kbC++201018b2023-10-28 14:00:142023-10-28 14:00:14

Judging History

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

  • [2023-10-28 14:00:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3704kb
  • [2023-10-28 14:00:14]
  • 提交

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(res < 0){
		int pe = t * 2;
		int ne = -res;
		ne -= pe;
		k -= ne / 7;
	}
	if(t > 0 && res > 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: 0
Wrong Answer
time: 0ms
memory: 3704kb

input:

1 1

output:

-1

result:

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