luogu#P4928. [MtOI2018] 衣服?身外之物!

    ID: 3859 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>2018洛谷原创O2优化枚举进制状压 DP

[MtOI2018] 衣服?身外之物!

Background

gcd has many pieces of clothing, and each piece has a different color.

Problem Description

gcd has a total of nn pieces of clothing, numbered A1,A2,AnA_1, A_2, \cdots A_n.

Each piece of clothing has a color value and a washing time. After wearing a piece of clothing, he will send it to be washed. The comfort value of that day depends on the product of the day's weather value and the clothing's color value, and the weather value can be negative.

Given the weather for mm days, find the maximum total comfort value.

If it is certain that there exists a day when gcd has no clothes to wear, output "gcd loves her clothes!" (without quotes).

Input Format

The input consists of 44 lines.

Line 11 contains n,mn, m.

Line 22 contains x1,x2xnx_1, x_2 \cdots x_n, representing the color values of the clothes.

Line 33 contains y1,y2yny_1, y_2 \cdots y_n, representing the washing times of the clothes.

Line 44 contains z1,z2zmz_1, z_2 \cdots z_m, representing the weather value of each day.

Output Format

Output 11 line: the maximum total comfort value over mm days of wearing clothes, or output "gcd loves her clothes!".

2 5
5 10
1 1
2 4 3 5 2
125

Hint

Sample Explanation 11

A1:Day1,Day3,Day5A_1:Day_1,Day_3,Day_5

A2:Day2,Day4A_2:Day_2,Day_4

Subtasks

For 30%30\% of the testdata, n=2n = 2, m=100m = 100.

For 50%50\% of the testdata, n3n \leq 3, m1000m \leq 1000.

For 100%100\% of the testdata, n4n \leq 4, n1n \neq 1, m2000m \leq 2000, yi6y_i \leq 6, Maxy<mMaxy < m, zi108|z_i| \leq 10^8.

Source

MtOI2018 迷途の家の水题大赛 T3

Problem setter: b2019dy

78488

Translated by ChatGPT 5