亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

【Codeforces 761 D Dasha and Very Difficult Problem】

2019-11-14 11:00:59
字體:
來源:轉載
供稿:網友

D. Dasha and Very Difficult PRoblem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output

Dasha logged into the system and began to solve problems. One of them is as follows:

Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of which is calculated as follows: ci?=?bi?-?ai.

About sequences a and b we know that their elements are in the range from l to r. More formally, elements satisfy the following conditions: l?≤?ai?≤?r and l?≤?bi?≤?r. About sequence c we know that all its elements are distinct.

Dasha wrote a solution to that problem quickly, but checking her work on the standard test was not so easy. Due to an error in the test system only the sequence a and the compressed sequence of the sequence c were known from that test.

Let’s give the definition to a compressed sequence. A compressed sequence of sequence c of length n is a sequence p of length n, so that pi equals to the number of integers which are less than or equal to ci in the sequence c. For example, for the sequence c?=?[250,?200,?300,?100,?50] the compressed sequence will be p?=?[4,?3,?5,?2,?1]. Pay attention that in c all integers are distinct. Consequently, the compressed sequence contains all integers from 1 to n inclusively.

Help Dasha to find any sequence b for which the calculated compressed sequence of sequence c is correct. Input

The first line contains three integers n, l, r (1?≤?n?≤?105,?1?≤?l?≤?r?≤?109) — the length of the sequence and boundaries of the segment where the elements of sequences a and b are.

The next line contains n integers a1,??a2,??…,??an (l?≤?ai?≤?r) — the elements of the sequence a.

The next line contains n distinct integers p1,??p2,??…,??pn (1?≤?pi?≤?n) — the compressed sequence of the sequence c. Output

If there is no the suitable sequence b, then in the only line print “-1”.

Otherwise, in the only line print n integers — the elements of any suitable sequence b. Examples Input

5 1 5 1 1 1 1 1 3 1 5 4 2

Output

3 1 5 4 2

Input

4 2 9 3 4 8 9 3 2 1 4

Output

2 2 2 9

Input

6 1 5 1 1 1 1 1 1 2 3 5 4 1 6

Output

-1

Note

Sequence b which was found in the second sample is suitable, because calculated sequence c?=?[2?-?3,?2?-?4,?2?-?8,?9?-?9]?=?[?-?1,??-?2,??-?6,?0] (note that ci?=?bi?-?ai) has compressed sequence equals to p?=?[3,?2,?1,?4].

依據Ci的排序sort,令B1 = L,C1 = L - A1,Ci = C i-1 + 1 , Bi = Ai + Ci,若Bi < L,可令Bi = L,Ci = L - Ai,若Bi > R ,則無解,反之,記錄一開始的位置,還原輸出Bi;

AC代碼:

#include<cstdio>#include<algorithm>using namespace std;struct node{ int a,b,c,p,n;}st[100010];bool cmp(node i,node j){ return i.p < j.p; }bool cnp(node i,node j){ return i.n < j.n; }int main(){ int N,L,R; scanf("%d %d %d",&N,&L,&R); for(int i = 1 ; i <= N; i++) scanf("%d",&st[i].a),st[i].n = i; for(int i = 1 ; i <= N; i++) scanf("%d",&st[i].p); sort(st + 1, st + 1 + N,cmp); st[1].b = L,st[1].c = L - st[1].a; for(int i = 2 ; i <= N; i++){ st[i].c = st[i - 1].c + 1; st[i].b = st[i].c + st[i].a; if(st[i].b < L) st[i].b = L,st[i].c = L - st[i].a; if(st[i].b > R){ printf("-1/n"); return 0; } } sort(st + 1, st + 1 + N,cnp); for(int i = 1 ; i <= N; i++) printf("%d ",st[i].b); return 0;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
亚洲人在线视频| 国产精品中文字幕在线| 日韩亚洲成人av在线| 91亚洲永久免费精品| 69av在线视频| 91精品国产91久久久久久最新| 欧美大奶子在线| 亚洲欧美激情精品一区二区| 亚洲精品天天看| 日韩av日韩在线观看| 色婷婷亚洲mv天堂mv在影片| 国产精品扒开腿做爽爽爽的视频| 亚洲人成网7777777国产| 欧美多人爱爱视频网站| 久久亚洲私人国产精品va| 国产欧美日韩中文| 久久久久久网址| 国产日韩欧美成人| 欧美日韩性视频| 久久久久999| 欧美黄色小视频| 亚洲精品v欧美精品v日韩精品| 国产午夜一区二区| 久久久精品影院| 69久久夜色精品国产69| 久久九九国产精品怡红院| 91视频九色网站| 成人欧美一区二区三区在线湿哒哒| 欧美性猛交xxxx乱大交极品| 亚洲аv电影天堂网| 中文字幕免费精品一区| 日韩精品一区二区三区第95| 成人美女免费网站视频| 91精品国产乱码久久久久久久久| 欧美日韩性生活视频| 国产一区二区欧美日韩| 亚州精品天堂中文字幕| 亚洲欧美日韩国产中文专区| 日本精品久久电影| 欧美视频在线免费| 亚洲天堂av综合网| 亚洲精品中文字幕有码专区| 亚洲第一综合天堂另类专| 97久久国产精品| 91丝袜美腿美女视频网站| 久久视频在线直播| 国产精品444| 国产高清视频一区三区| 亚洲第一色中文字幕| 亚洲a在线观看| 亚洲欧美日韩一区二区三区在线| 91久久久在线| 久久久亚洲福利精品午夜| 亚洲最大的免费| 亚洲bt欧美bt日本bt| 国产精品第三页| 精品女厕一区二区三区| 久久成人人人人精品欧| 久久久在线免费观看| 国产美女高潮久久白浆| 国内成人精品一区| 久久综合久久88| 国产精品影院在线观看| 久久久久久久久91| 国产精品福利在线| 日韩欧美中文字幕在线播放| 66m—66摸成人免费视频| 91av在线免费观看| 欧美裸体xxxx极品少妇| 国产日本欧美一区二区三区| 日韩亚洲欧美中文高清在线| 国外成人在线视频| 日韩中文在线视频| 精品人伦一区二区三区蜜桃免费| 88xx成人精品| 久久精品男人天堂| 日韩av在线免播放器| 成人亚洲综合色就1024| 国产精品jvid在线观看蜜臀| 日韩精品免费观看| 亚洲欧美激情视频| 欧美另类极品videosbestfree| 欧美在线免费视频| 成人h视频在线| 亚洲男人天天操| 亚洲欧美日韩视频一区| 国产成人在线亚洲欧美| 久久精品中文字幕| 国内精品久久久久久久久| 国产精品白嫩美女在线观看| 国产噜噜噜噜噜久久久久久久久| 久久精品国产成人| 欧美日韩性视频在线| 日韩中文字幕在线观看| 国产精品1区2区在线观看| 日韩精品一区二区视频| 久久久免费观看视频| 国产欧美日韩视频| 亚洲激情视频在线播放| 日韩欧美在线免费| 日韩有码视频在线| 国产有码一区二区| 国产精品高潮在线| 国产精品久久久久久久久久ktv| 高跟丝袜一区二区三区| 欧美激情第99页| 成人免费网站在线看| 日本欧美精品在线| 97精品久久久| 国产精品久久久久久久久久尿| 国产精品日韩欧美综合| 国产日韩专区在线| xxx成人少妇69| 一本一本久久a久久精品综合小说| 成人福利视频网| 午夜免费在线观看精品视频| 亚洲精品在线91| 色诱女教师一区二区三区| 97香蕉超级碰碰久久免费的优势| 日韩成人网免费视频| 欧美一性一乱一交一视频| 最近日韩中文字幕中文| 欧美激情视频在线观看| 国产成人综合亚洲| 久久久精品中文字幕| 97视频在线观看亚洲| 亚洲区在线播放| 欧美国产日韩一区二区在线观看| 北条麻妃一区二区在线观看| 色噜噜狠狠狠综合曰曰曰| 色99之美女主播在线视频| 欧美在线激情网| 久久精品视频网站| 日韩国产高清视频在线| 日韩风俗一区 二区| 欧美大全免费观看电视剧大泉洋| 亚洲色图第一页| 91久久久精品| 亚洲bt欧美bt日本bt| 成人免费在线视频网址| 国模精品一区二区三区色天香| 91精品国产91久久久久久| 亚洲有声小说3d| 久久影院在线观看| 欧美精品做受xxx性少妇| 久久久免费在线观看| 亚洲天堂精品在线| 欧美日韩国产一区二区| 国产小视频国产精品| 日韩精品欧美激情| 国产美女91呻吟求| 国产午夜精品美女视频明星a级| 5566成人精品视频免费| 91在线观看免费高清| 日韩中文字幕av| 亚洲精品日韩激情在线电影| 热久久99这里有精品| 欧美激情视频一区二区| 国产精品成人国产乱一区| 欧美日本高清视频| 亚洲精品av在线播放| 久久91精品国产91久久久| 色在人av网站天堂精品| 色无极亚洲影院|