CF2230E.Minimum Influence
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Imagine that you are the owner of a news website and want to study how some selected news items affect your users.
You have n news items, and for each of them, you have already determined two parameters: how much it touches politics pi and how much it touches culture ci.
You also have m users whose reaction to the news you want to study. For each person, you have already determined three parameters: tolerance to political news tpj, tolerance to cultural news tcj, and the "zone of influence" dj.
The influence of politics Ip(i,j) and culture Ic(i,j) in news item i on user j can be calculated by the following formulas:
\\begin{array}{ c c } I\_p(i, j) = \\begin{cases} 0 & \\text{if } p\_i \\lt tp\_j \\\\ p\_i & \\text{if } tp\_j \\le p\_i \\lt tp\_j + d\_j \\\\ tp\_j + d\_j & \\text{if } p\_i \\ge tp\_j + d\_j \\end{cases}, & I\_c(i, j) = \\begin{cases} 0 & \\text{if } c\_i \\lt tc\_j \\\\ c\_i & \\text{if } tc\_j \\le c\_i \\lt tc\_j + d\_j \\\\ tc\_j + d\_j & \\text{if } c\_i \\ge tc\_j + d\_j \\end{cases} \\end{array}.In other words, while the amount of politics pi is less than the tolerance level tpj, it does not affect the user. Otherwise, the topic starts to irritate the user, but not more than up to tpj+dj. The same goes for culture.
The total influence of news item i on user j is I(i,j)=Ip(i,j)+Ic(i,j).
For each user j, determine the minimum influence I(i,j) among all news items i.
假设你是某新闻网站的所有者,希望研究若干选定的新闻条目对用户的影响。
你共有 n 条新闻,对每条新闻 i,你已预先确定两个参数:其政治相关度 pi 和文化相关度 ci。
你还拥有 m 名用户,希望研究他们对这些新闻的反应。对每位用户 j,你已预先确定三个参数:其对政治类新闻的容忍度 tpj、对文化类新闻的容忍度 tcj,以及“影响区间” dj。
新闻条目 i 对用户 j 在政治方面的影响 Ip(i,j) 和在文化方面的影响 Ic(i,j) 可由以下公式计算:
I_p(i,j)=⎩⎨⎧0p_itp_j+d_jif p_i<tp_jif tp_j≤p_i<tp_j+d_jif p_i≥tp_j+d_j,I_c(i,j)=⎩⎨⎧0c_itc_j+d_jif c_i<tc_jif tc_j≤c_i<tc_j+d_jif c_i≥tc_j+d_j.
换言之,当政治相关度 pi 小于容忍度 tpj 时,该新闻不会对用户产生影响;否则,该主题开始令用户感到不适,但其影响上限为 tpj+dj。文化相关度同理。
新闻条目 i 对用户 j 的总影响定义为 I(i,j)=Ip(i,j)+Ic(i,j)。
对每位用户 j,请找出其受所有新闻条目 i 影响的最小总影响值 I(i,j)。
输入格式
The first line contains one integer n (1≤n≤2⋅105) — the number of news items.
The second line contains n integers p1,p2,…,pn (0≤pi≤106) — the amount of political content of each news item.
The third line contains n integers c1,c2,…,cn (0≤ci≤106) — the amount of cultural content of each news item.
The fourth line contains one integer m (1≤m≤4⋅105) — the number of users.
The fifth line contains m integers tp1,tp2,…,tpm (0≤tpj≤106) — the political tolerance of each user.
The sixth line contains m integers tc1,tc2,…,tcm (0≤tcj≤106) — the cultural tolerance of each user.
The seventh line contains m integers d1,d2,…,dm (0≤dj≤106) — the zone of influence of each user.
第一行包含一个整数 n(1≤n≤2⋅105)—— 新闻条目的数量。
第二行包含 n 个整数 p1,p2,…,pn(0≤pi≤106)—— 每条新闻的政治内容量。
第三行包含 n 个整数 c1,c2,…,cn(0≤ci≤106)—— 每条新闻的文化内容量。
第四行包含一个整数 m(1≤m≤4⋅105)—— 用户的数量。
第五行包含 m 个整数 tp1,tp2,…,tpm(0≤tpj≤106)—— 每个用户的政治理解度。
第六行包含 m 个整数 tc1,tc2,…,tcm(0≤tcj≤106)—— 每个用户的文化理解度。
第七行包含 m 个整数 d1,d2,…,dm(0≤dj≤106)—— 每个用户的影响力范围。
输出格式
For each user, output one integer — the minimum influence I(i,j) among all news items.
对每个用户,输出一个整数——所有新闻项中最小的影响值 I(i,j)。
输入输出样例
输入#1
6 2 4 1 6 0 10 3 2 6 1 9 0 5 0 0 0 1 5 0 0 9 5 2 9 4 8 2 2
输出#1
5 4 1 2 2
输入#2
5 75 19 53 12 10 34 75 67 84 95 5 55 14 46 97 14 78 61 56 23 33 10 4 7 11 3
输出#2
0 18 53 34 36
说明/提示
null
输入解题思路,AI测评打分。不知道怎么写?