QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#588724 | #7638. Lake | Blizzard | WA | 0ms | 3720kb | C++23 | 1.9kb | 2024-09-25 14:13:12 | 2024-09-25 14:13:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
//--------------------------------
// #define int long long
#define LL long long
// #define lc p << 1
// #define rc p << 1 | 1
#define lowbit(x) x & (-x)
#define nc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++)
// #pragma GCC optimize(2)
#define Blizzard ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
inline void read(LL &a)
{
LL s = 0, w = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
{
s = s * 10 + ch - '0';
ch = getchar();
}
a = s * w;
}
//-----------------------------------------
void solve()
{
int n, m;
cin >> n >> m;
if (n == 0 && m == 0)
{
cout << 0;
return;
}
int cnt = 0;
int t1 = n / 4;
if (n % 4)
t1++;
int t2 = m / 3;
if (m % 3)
t2++;
if (t1 >= t2)
{
cnt = n / 4;
if (n % 4)
cnt++;
cout << 2 * cnt - 1;
return;
}
while (n - 3 > 0 && m - 4 >= 0)
{
n -= 3;
m -= 4;
cnt++;
}
// cout << n << " " << m << endl;
if (n - 3 <= 0 && m - 4 <= 0)
{
cnt++;
cout << 2 * cnt - 1;
return;
}
else if (n - 3 <= 0 && m - 4 > 0)
{
cnt += m / 4;
if (m % 4)
cnt++;
cout << 2 * cnt - 1;
}
else if (n - 3 > 0 && m - 4 <= 0)
{
cnt += n / 4;
if (n % 4)
cnt++;
cout << 2 * cnt - 1;
}
}
signed main()
{
Blizzard; // false
int _ = 1;
// cin >> _;
while (_--)
solve();
return 0;
}
/*
while (l < r)
{
int mid = l + r >> 1;
if (check(mid)) r = mid;
else l = mid + 1;
}
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
1 4
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
5 5
output:
3
result:
ok single line: '3'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
4 4
output:
3
result:
ok single line: '3'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
3 4
output:
1
result:
ok single line: '1'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
8 12
output:
5
result:
ok single line: '5'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
12 8
output:
5
result:
ok single line: '5'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
8182 520051
output:
260025
result:
ok single line: '260025'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
501760 6405
output:
250879
result:
ok single line: '250879'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3660kb
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: 0ms
memory: 3664kb
input:
699570 720193
output:
439809
result:
wrong answer 1st lines differ - expected: '405647', found: '439809'