QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#789771#9750. 拼图sunup15#WA 2ms3648kbC++202.4kb2024-11-27 21:47:292024-11-27 21:47:34

Judging History

This is the latest submission verdict.

  • [2024-11-27 21:47:34]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3648kb
  • [2024-11-27 21:47:29]
  • Submitted

answer

/*
2024-11-27 21:23:32
*/
#include<bits/stdc++.h>
#define int long long
#define lc p<<1
#define rc p<<1|1
using std::cin;
using std::cout;
using std::function;
using std::max, std::min, std::swap;
using std::vector, std::string, std::set, std::priority_queue, std::queue;
using PII = std::pair<int,int>;
using Grap = std::vector<std::vector<int>>;
using Grapw = std::vector<std::vector<PII>>;
const int inf = INT64_MAX, _ = 0;
const int N = 2e5 + 5;
int mod = 1e9 + 7;


void init() {
	
}


void solve() {

	int A, B, C, D;
	std::cin >> A >> B >> C >> D;
	
	if (A < 4) return (void) (std::cout << 0 << '\n');
	
	int ans = 4 + min(B, C) * 2, mx = min(B, C) * 2;
	for (int i = 1; i <= D; i++) {
		int j = D / i;
		if (i + i + j + j <= mx) {
			ans = max(ans, (i + 2)*(j + 2));
		}
	}
	
	std::cout << ans << '\n';
	
}





signed main() {
	init();
	// 超时了,优化一下cin输入速度  如果使用了这个,不能同时使用cin 和 scanf
	// in out stream :: sync_with_stdio(flase), cin.tie(0);
	std::ios::sync_with_stdio(false), std::cin.tie(0);
	
	int T = 1;
	std::cin >> T;
	while (T--) solve();
	
	return (0^_^0);
}

/*
1.深呼吸,不要紧张,慢慢读题,读明白题,题目往往比你想的简单。
2.暴力枚举:枚举什么,是否可以使用一些技巧加快枚举速度(预处理、前缀和、数据结构、数论分块)。
3.贪心:需要排序或使用数据结构(pq)吗,这么贪心一定最优吗。
4.二分:满足单调性吗,怎么二分,如何确定二分函数返回值是什么。
5.位运算:按位贪心,还是与位运算本身的性质有关。
6.数学题:和最大公因数、质因子、取模是否有关。
7.dp:怎么设计状态,状态转移方程是什么,初态是什么,使用循环还是记搜转移。
8.搜索:dfs 还是 bfs ,搜索的时候状态是什么,需要记忆化吗。
9.树上问题:是树形dp、树上贪心、或者是在树上搜索。
10.图论:依靠什么样的关系建图,是求环统计结果还是最短路。
11.组合数学:有几种值,每种值如何被组成,容斥关系是什么。
12.交互题:log(n)次如何二分,2*n 次如何通过 n 次求出一些值,再根据剩余次数求答案。
13.如果以上几种都不是,多半是有一个 point 你没有注意到,记住正难则反。
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3624kb

input:

2
4 0 0 0
4 4 4 4

output:

4
16

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3648kb

input:

10000
0 0 0 0
0 0 0 1
0 0 0 2
0 0 0 3
0 0 0 4
0 0 0 5
0 0 0 6
0 0 0 7
0 0 0 8
0 0 0 9
0 0 1 0
0 0 1 1
0 0 1 2
0 0 1 3
0 0 1 4
0 0 1 5
0 0 1 6
0 0 1 7
0 0 1 8
0 0 1 9
0 0 2 0
0 0 2 1
0 0 2 2
0 0 2 3
0 0 2 4
0 0 2 5
0 0 2 6
0 0 2 7
0 0 2 8
0 0 2 9
0 0 3 0
0 0 3 1
0 0 3 2
0 0 3 3
0 0 3 4
0 0 3 5
0 0 3 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 4223rd lines differ - expected: '9', found: '8'