Submission #1987441


Source Code Expand

#include <iostream>
using namespace std;
const int mod = 1000000007;
int N, M, K, s, a[59], b[59]; long long dp[2500009];
int main() {
	cin >> N >> M >> K;
	for (int i = 0; i < N; i++) cin >> a[i], s += a[i];
	for (int i = 0; i < M; i++) cin >> b[i], s += b[i];
	dp[0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 2499999; j >= a[i]; j--) {
			dp[j] |= dp[j - a[i]];
		}
	}
	for (int i = 0; i < M; i++) {
		for (int j = 2499999; j >= b[i]; j--) {
			dp[j] |= dp[j - b[i]] << 1;
		}
	}
	int best = -1, evl = 102345678;
	for (int i = 0; i <= s; i++) {
		int ev = i * 2 < s ? s - i * 2 : i * 2 - s;
		for (int j = K % 2; j <= M && j <= K; j += 2) {
			if (((dp[i] >> j) & 1) && ev < evl) {
				evl = ev;
				best = i;
			}
		}
	}
	cout << 1LL * best * (s - best) << endl;
	return 0;
}

Submission Info

Submission Time
Task D - DDPC特別ビュッフェ
User square1001
Language C++14 (GCC 5.4.1)
Score 0
Code Size 818 Byte
Status WA
Exec Time 355 ms
Memory 19840 KB

Judge Result

Set Name Sample Subtask1 Subtask2 All
Score / Max Score 0 / 0 0 / 10 0 / 20 0 / 70
Status
AC × 2
AC × 6
WA × 11
AC × 34
WA × 11
AC × 74
WA × 27
Set Name Test Cases
Sample 000_example_01.txt, 000_example_02.txt
Subtask1 000_example_01.in, 010_rand_01.txt, 010_rand_02.txt, 010_rand_03.txt, 010_rand_04.txt, 010_rand_05.txt, 020_hand_01.txt, 020_hand_02.txt, 020_hand_03.txt, 020_hand_04.txt, 020_hand_05.txt, 020_hand_06.txt, 020_hand_07.txt, 030_max_01.txt, 030_max_02.txt, 030_max_03.txt, 030_max_04.txt, 030_max_05.txt
Subtask2 000_example_01.txt, 000_example_02.txt, 020_hand_01.txt, 020_hand_03.txt, 020_hand_07.txt, 050_rand_01.txt, 050_rand_02.txt, 050_rand_03.txt, 060_rand_01.txt, 060_rand_02.txt, 060_rand_03.txt, 060_rand_04.txt, 060_rand_05.txt, 060_rand_06.txt, 060_rand_07.txt, 060_rand_08.txt, 060_rand_09.txt, 060_rand_10.txt, 070_rand_01.txt, 070_rand_02.txt, 070_rand_03.txt, 070_rand_04.txt, 070_rand_05.txt, 070_rand_06.txt, 070_rand_07.txt, 070_rand_08.txt, 070_rand_09.txt, 070_rand_10.txt, 080_hand_01.txt, 080_hand_02.txt, 080_hand_03.txt, 080_hand_04.txt, 080_hand_05.txt, 080_hand_06.txt, 080_hand_07.txt, 080_hand_08.txt, 080_hand_09.txt, 080_hand_10.txt, 080_hand_11.txt, 090_anti_greedy_01.txt, 090_anti_greedy_02.txt, 090_anti_greedy_03.txt, 090_anti_greedy_04.txt, 090_anti_greedy_05.txt, 090_anti_greedy_06.txt
All 000_example_01.txt, 000_example_02.txt, 010_rand_01.txt, 010_rand_02.txt, 010_rand_03.txt, 010_rand_04.txt, 010_rand_05.txt, 020_hand_01.txt, 020_hand_02.txt, 020_hand_03.txt, 020_hand_04.txt, 020_hand_05.txt, 020_hand_06.txt, 020_hand_07.txt, 030_max_01.txt, 030_max_02.txt, 030_max_03.txt, 030_max_04.txt, 030_max_05.txt, 050_rand_01.txt, 050_rand_02.txt, 050_rand_03.txt, 060_rand_01.txt, 060_rand_02.txt, 060_rand_03.txt, 060_rand_04.txt, 060_rand_05.txt, 060_rand_06.txt, 060_rand_07.txt, 060_rand_08.txt, 060_rand_09.txt, 060_rand_10.txt, 070_rand_01.txt, 070_rand_02.txt, 070_rand_03.txt, 070_rand_04.txt, 070_rand_05.txt, 070_rand_06.txt, 070_rand_07.txt, 070_rand_08.txt, 070_rand_09.txt, 070_rand_10.txt, 080_hand_01.txt, 080_hand_02.txt, 080_hand_03.txt, 080_hand_04.txt, 080_hand_05.txt, 080_hand_06.txt, 080_hand_07.txt, 080_hand_08.txt, 080_hand_09.txt, 080_hand_10.txt, 080_hand_11.txt, 090_anti_greedy_01.txt, 090_anti_greedy_02.txt, 090_anti_greedy_03.txt, 090_anti_greedy_04.txt, 090_anti_greedy_05.txt, 090_anti_greedy_06.txt, 100_rand_01.txt, 100_rand_02.txt, 100_rand_03.txt, 100_rand_04.txt, 100_rand_05.txt, 100_rand_06.txt, 100_rand_07.txt, 100_rand_08.txt, 100_rand_09.txt, 100_rand_10.txt, 110_rand_01.txt, 110_rand_02.txt, 110_rand_03.txt, 110_rand_04.txt, 110_rand_05.txt, 110_rand_06.txt, 110_rand_07.txt, 110_rand_08.txt, 110_rand_09.txt, 110_rand_10.txt, 120_max_01.txt, 120_max_02.txt, 120_max_03.txt, 120_max_04.txt, 120_max_05.txt, 130_max_01.txt, 130_max_02.txt, 130_max_03.txt, 130_max_04.txt, 130_max_05.txt, 140_hand_01.txt, 140_hand_02.txt, 140_hand_03.txt, 140_hand_04.txt, 140_hand_05.txt, 140_hand_06.txt, 140_hand_07.txt, 140_hand_08.txt, 140_hand_09.txt, 140_hand_10.txt, 140_hand_11.txt, 140_hand_12.txt
Case Name Status Exec Time Memory
000_example_01.txt AC 17 ms 19712 KB
000_example_02.txt AC 17 ms 19840 KB
010_rand_01.txt WA 188 ms 19712 KB
010_rand_02.txt WA 125 ms 19840 KB
010_rand_03.txt WA 39 ms 19712 KB
010_rand_04.txt WA 41 ms 19712 KB
010_rand_05.txt WA 172 ms 19712 KB
020_hand_01.txt AC 11 ms 19840 KB
020_hand_02.txt AC 17 ms 19712 KB
020_hand_03.txt AC 247 ms 19840 KB
020_hand_04.txt AC 265 ms 19584 KB
020_hand_05.txt WA 32 ms 19712 KB
020_hand_06.txt AC 32 ms 19840 KB
020_hand_07.txt AC 24 ms 19712 KB
030_max_01.txt WA 254 ms 19840 KB
030_max_02.txt WA 257 ms 19712 KB
030_max_03.txt WA 259 ms 19712 KB
030_max_04.txt WA 254 ms 19712 KB
030_max_05.txt WA 255 ms 19840 KB
050_rand_01.txt AC 195 ms 19840 KB
050_rand_02.txt WA 85 ms 19840 KB
050_rand_03.txt WA 191 ms 19840 KB
060_rand_01.txt AC 195 ms 19840 KB
060_rand_02.txt WA 88 ms 19712 KB
060_rand_03.txt AC 192 ms 19712 KB
060_rand_04.txt AC 156 ms 19712 KB
060_rand_05.txt AC 136 ms 19712 KB
060_rand_06.txt WA 183 ms 19840 KB
060_rand_07.txt AC 87 ms 19840 KB
060_rand_08.txt WA 157 ms 19712 KB
060_rand_09.txt WA 25 ms 19840 KB
060_rand_10.txt AC 96 ms 19712 KB
070_rand_01.txt AC 186 ms 19712 KB
070_rand_02.txt AC 116 ms 19712 KB
070_rand_03.txt WA 40 ms 19840 KB
070_rand_04.txt AC 39 ms 19712 KB
070_rand_05.txt AC 161 ms 19712 KB
070_rand_06.txt WA 100 ms 19840 KB
070_rand_07.txt AC 169 ms 19840 KB
070_rand_08.txt AC 106 ms 19840 KB
070_rand_09.txt AC 100 ms 19840 KB
070_rand_10.txt AC 35 ms 19840 KB
080_hand_01.txt AC 20 ms 19712 KB
080_hand_02.txt AC 24 ms 19712 KB
080_hand_03.txt AC 24 ms 19840 KB
080_hand_04.txt WA 156 ms 19840 KB
080_hand_05.txt AC 23 ms 19712 KB
080_hand_06.txt WA 57 ms 19840 KB
080_hand_07.txt AC 242 ms 19840 KB
080_hand_08.txt WA 246 ms 19712 KB
080_hand_09.txt AC 34 ms 19712 KB
080_hand_10.txt AC 28 ms 19712 KB
080_hand_11.txt AC 28 ms 19712 KB
090_anti_greedy_01.txt AC 238 ms 19840 KB
090_anti_greedy_02.txt AC 245 ms 19840 KB
090_anti_greedy_03.txt AC 240 ms 19712 KB
090_anti_greedy_04.txt AC 241 ms 19840 KB
090_anti_greedy_05.txt AC 246 ms 19840 KB
090_anti_greedy_06.txt AC 245 ms 19712 KB
100_rand_01.txt AC 200 ms 19712 KB
100_rand_02.txt WA 88 ms 19712 KB
100_rand_03.txt AC 198 ms 19840 KB
100_rand_04.txt AC 169 ms 19840 KB
100_rand_05.txt AC 133 ms 19840 KB
100_rand_06.txt AC 184 ms 19840 KB
100_rand_07.txt AC 91 ms 19712 KB
100_rand_08.txt AC 157 ms 19712 KB
100_rand_09.txt WA 26 ms 19712 KB
100_rand_10.txt AC 100 ms 19712 KB
110_rand_01.txt AC 209 ms 19712 KB
110_rand_02.txt AC 90 ms 19712 KB
110_rand_03.txt AC 200 ms 19840 KB
110_rand_04.txt AC 164 ms 19712 KB
110_rand_05.txt AC 141 ms 19840 KB
110_rand_06.txt AC 190 ms 19840 KB
110_rand_07.txt AC 94 ms 19712 KB
110_rand_08.txt AC 167 ms 19840 KB
110_rand_09.txt WA 26 ms 19840 KB
110_rand_10.txt AC 97 ms 19840 KB
120_max_01.txt AC 260 ms 19712 KB
120_max_02.txt AC 253 ms 19840 KB
120_max_03.txt AC 255 ms 19840 KB
120_max_04.txt AC 247 ms 19712 KB
120_max_05.txt AC 242 ms 19712 KB
130_max_01.txt AC 259 ms 19840 KB
130_max_02.txt AC 260 ms 19840 KB
130_max_03.txt AC 256 ms 19712 KB
130_max_04.txt AC 260 ms 19840 KB
130_max_05.txt AC 263 ms 19840 KB
140_hand_01.txt AC 352 ms 19584 KB
140_hand_02.txt AC 49 ms 19712 KB
140_hand_03.txt AC 342 ms 19840 KB
140_hand_04.txt WA 344 ms 19712 KB
140_hand_05.txt AC 20 ms 19840 KB
140_hand_06.txt AC 24 ms 19840 KB
140_hand_07.txt AC 355 ms 19584 KB
140_hand_08.txt AC 27 ms 19712 KB
140_hand_09.txt WA 62 ms 19712 KB
140_hand_10.txt AC 293 ms 19712 KB
140_hand_11.txt AC 159 ms 19712 KB
140_hand_12.txt AC 247 ms 19712 KB