QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#228688 | #7638. Lake | ucup-team1074# | WA | 0ms | 3704kb | C++20 | 1018b | 2023-10-28 14:00:14 | 2023-10-28 14:00:14 |
Judging History
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'