結果

問題 No.1792 科学の甲子園
ユーザー 👑 ygussanyygussany
提出日時 2021-12-21 08:09:23
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 2 ms / 4,000 ms
コード長 842 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 29,320 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 18:41:39
合計ジャッジ時間 1,599 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 0 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 0 ms
4,380 KB
testcase_18 AC 0 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

const int bit[7] = {1, 2, 4, 8, 16, 32, 64};

void chmax(long long* a, long long b)
{
	if (*a < b) *a = b;
}

int main()
{
	int i, j, k, N;
	long long A[6], max[64] = {}, tmp;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		for (j = 0; j < 6; j++) scanf("%lld", &(A[j]));
		for (k = 0; k < bit[6]; k++) {
			for (j = 0, tmp = 1; j < 6; j++) if ((k & bit[j]) != 0) tmp *= A[j];
			chmax(&(max[k]), tmp);
		}
	}
	
	int l;
	long long ans = 0;
	for (i = 0; i < bit[6]; i++) {
		for (j = i + 1; j < bit[6]; j++) {
			if ((i & j) != 0) continue;
			for (k = j + 1; k < bit[6]; k++) {
				if (((i | j) & k) != 0) continue;
				for (l = k + 1; l < bit[6]; l++) {
					if (((i | j | k) & l) != 0) continue;
					chmax(&ans, max[i] * max[j] * max[k] * max[l]);
				}
			}
		}
	}
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}
0