QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#231164#7638. Lakeucup-team1716#WA 1ms3676kbC++14561b2023-10-29 03:01:242023-10-29 03:01:24

Judging History

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

  • [2023-10-29 03:01:24]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3676kb
  • [2023-10-29 03:01:24]
  • 提交

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'