QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#231164 | #7638. Lake | ucup-team1716# | WA | 1ms | 3676kb | C++14 | 561b | 2023-10-29 03:01:24 | 2023-10-29 03:01:24 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int calc(int n, int m) {
assert(n <= m);
int s = n / 3, f = n / 3; // # of one-person seats, # of flights
if (n % 3 != 0) {
f++;
s += 1 + (3 - n % 3) * 2;
}
if (s >= m - n) {
return f * 2 - 1;
}
f += (m - n - s) / 4 + ((m - n - s) % 4 != 0);
return f * 2 - 1;
}
int main() {
int n, m;
cin >> n >> m;
if (n > m) {
swap(n, m);
}
int ans = 1e9;
for (int i = 0; i <= n; ++i) {
ans = min(ans, calc(n - i, m + i));
}
cout << ans << endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
input:
1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
1 4
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
5 5
output:
3
result:
ok single line: '3'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
4 4
output:
3
result:
ok single line: '3'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3464kb
input:
3 4
output:
1
result:
ok single line: '1'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
8 12
output:
5
result:
ok single line: '5'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
12 8
output:
5
result:
ok single line: '5'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
8182 520051
output:
260025
result:
ok single line: '260025'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
501760 6405
output:
250879
result:
ok single line: '250879'
Test #10:
score: -100
Wrong Answer
time: 1ms
memory: 3584kb
input:
823266 88861
output:
411631
result:
wrong answer 1st lines differ - expected: '411633', found: '411631'