Submission #1987605
Source Code Expand
#include <vector> #include <iostream> using namespace std; const int mod = 1000000007; int N, M, K, s, a[59], b[59]; long long dp[2444444]; 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 = 1222210; j >= a[i]; j--) { dp[j] |= dp[j - a[i]] << 1; } } for (int i = 0; i <= 1222210; i++) { for (int j = 0; j <= N; j++) { if (j < N - K || j % 2 != (N - K % 2) % 2) { dp[i] |= ~(1LL << j); } } } for (int i = 0; i < M; i++) { for (int j = 2444420; j >= b[i]; j--) { dp[j] |= dp[j - b[i]] << 1; if ((dp[j] >> (N + 1)) & 1) dp[j] -= 1LL << (N + 1); } } int best = -1, evl = 102345678; for (int i = 0; i <= s; i++) { int ev = i * 2 < s ? s - i * 2 : i * 2 - s; if (((dp[i] >> N) & 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 | 1003 Byte |
Status | WA |
Exec Time | 335 ms |
Memory | 19456 KB |
Judge Result
Set Name | Sample | Subtask1 | Subtask2 | All | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 10 | 0 / 20 | 0 / 70 | ||||||||||||||
Status |
|
|
|
|
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 | 20 ms | 19328 KB |
000_example_02.txt | AC | 21 ms | 19456 KB |
010_rand_01.txt | WA | 230 ms | 19328 KB |
010_rand_02.txt | WA | 154 ms | 19328 KB |
010_rand_03.txt | WA | 44 ms | 19328 KB |
010_rand_04.txt | WA | 48 ms | 19328 KB |
010_rand_05.txt | WA | 232 ms | 19328 KB |
020_hand_01.txt | AC | 13 ms | 19328 KB |
020_hand_02.txt | WA | 20 ms | 19328 KB |
020_hand_03.txt | AC | 320 ms | 19328 KB |
020_hand_04.txt | AC | 332 ms | 19328 KB |
020_hand_05.txt | WA | 40 ms | 19328 KB |
020_hand_06.txt | AC | 39 ms | 19328 KB |
020_hand_07.txt | AC | 29 ms | 19328 KB |
030_max_01.txt | WA | 324 ms | 19328 KB |
030_max_02.txt | WA | 326 ms | 19328 KB |
030_max_03.txt | WA | 327 ms | 19328 KB |
030_max_04.txt | WA | 325 ms | 19328 KB |
030_max_05.txt | WA | 324 ms | 19328 KB |
050_rand_01.txt | AC | 238 ms | 19328 KB |
050_rand_02.txt | WA | 120 ms | 19328 KB |
050_rand_03.txt | WA | 266 ms | 19328 KB |
060_rand_01.txt | AC | 239 ms | 19328 KB |
060_rand_02.txt | WA | 121 ms | 19328 KB |
060_rand_03.txt | AC | 266 ms | 19328 KB |
060_rand_04.txt | AC | 195 ms | 19328 KB |
060_rand_05.txt | AC | 159 ms | 19328 KB |
060_rand_06.txt | WA | 223 ms | 19328 KB |
060_rand_07.txt | AC | 107 ms | 19328 KB |
060_rand_08.txt | WA | 180 ms | 19328 KB |
060_rand_09.txt | WA | 33 ms | 19328 KB |
060_rand_10.txt | AC | 127 ms | 19328 KB |
070_rand_01.txt | AC | 216 ms | 19328 KB |
070_rand_02.txt | AC | 151 ms | 19328 KB |
070_rand_03.txt | WA | 46 ms | 19328 KB |
070_rand_04.txt | AC | 48 ms | 19328 KB |
070_rand_05.txt | AC | 215 ms | 19328 KB |
070_rand_06.txt | WA | 115 ms | 19328 KB |
070_rand_07.txt | AC | 205 ms | 19328 KB |
070_rand_08.txt | AC | 118 ms | 19328 KB |
070_rand_09.txt | AC | 118 ms | 19328 KB |
070_rand_10.txt | AC | 39 ms | 19328 KB |
080_hand_01.txt | AC | 22 ms | 19328 KB |
080_hand_02.txt | AC | 29 ms | 19328 KB |
080_hand_03.txt | AC | 29 ms | 19328 KB |
080_hand_04.txt | WA | 193 ms | 19328 KB |
080_hand_05.txt | AC | 29 ms | 19328 KB |
080_hand_06.txt | AC | 72 ms | 19328 KB |
080_hand_07.txt | WA | 300 ms | 19328 KB |
080_hand_08.txt | WA | 300 ms | 19328 KB |
080_hand_09.txt | AC | 40 ms | 19328 KB |
080_hand_10.txt | AC | 39 ms | 19328 KB |
080_hand_11.txt | AC | 35 ms | 19328 KB |
090_anti_greedy_01.txt | AC | 298 ms | 19328 KB |
090_anti_greedy_02.txt | AC | 299 ms | 19328 KB |
090_anti_greedy_03.txt | AC | 297 ms | 19328 KB |
090_anti_greedy_04.txt | AC | 297 ms | 19328 KB |
090_anti_greedy_05.txt | AC | 297 ms | 19328 KB |
090_anti_greedy_06.txt | AC | 301 ms | 19328 KB |
100_rand_01.txt | AC | 241 ms | 19328 KB |
100_rand_02.txt | WA | 122 ms | 19328 KB |
100_rand_03.txt | AC | 269 ms | 19328 KB |
100_rand_04.txt | AC | 196 ms | 19328 KB |
100_rand_05.txt | AC | 159 ms | 19328 KB |
100_rand_06.txt | AC | 214 ms | 19328 KB |
100_rand_07.txt | AC | 110 ms | 19328 KB |
100_rand_08.txt | AC | 181 ms | 19328 KB |
100_rand_09.txt | WA | 32 ms | 19328 KB |
100_rand_10.txt | AC | 127 ms | 19328 KB |
110_rand_01.txt | AC | 245 ms | 19328 KB |
110_rand_02.txt | AC | 117 ms | 19328 KB |
110_rand_03.txt | AC | 244 ms | 19328 KB |
110_rand_04.txt | AC | 199 ms | 19328 KB |
110_rand_05.txt | AC | 164 ms | 19328 KB |
110_rand_06.txt | AC | 215 ms | 19328 KB |
110_rand_07.txt | AC | 110 ms | 19328 KB |
110_rand_08.txt | AC | 185 ms | 19328 KB |
110_rand_09.txt | WA | 32 ms | 19328 KB |
110_rand_10.txt | AC | 129 ms | 19328 KB |
120_max_01.txt | AC | 308 ms | 19328 KB |
120_max_02.txt | AC | 306 ms | 19328 KB |
120_max_03.txt | AC | 308 ms | 19328 KB |
120_max_04.txt | AC | 331 ms | 19328 KB |
120_max_05.txt | AC | 335 ms | 19328 KB |
130_max_01.txt | AC | 303 ms | 19328 KB |
130_max_02.txt | AC | 309 ms | 19328 KB |
130_max_03.txt | AC | 300 ms | 19328 KB |
130_max_04.txt | AC | 307 ms | 19328 KB |
130_max_05.txt | AC | 302 ms | 19328 KB |
140_hand_01.txt | AC | 315 ms | 19328 KB |
140_hand_02.txt | WA | 62 ms | 19328 KB |
140_hand_03.txt | AC | 324 ms | 19328 KB |
140_hand_04.txt | WA | 323 ms | 19328 KB |
140_hand_05.txt | AC | 23 ms | 19328 KB |
140_hand_06.txt | AC | 30 ms | 19328 KB |
140_hand_07.txt | AC | 310 ms | 19328 KB |
140_hand_08.txt | AC | 32 ms | 19328 KB |
140_hand_09.txt | AC | 72 ms | 19328 KB |
140_hand_10.txt | WA | 310 ms | 19328 KB |
140_hand_11.txt | WA | 198 ms | 19328 KB |
140_hand_12.txt | WA | 296 ms | 19328 KB |