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

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

【Codeforces 761 D Dasha and Very Difficult Problem】

2019-11-14 10:29:43
字體:
來源:轉載
供稿:網友

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
欧美在线一级视频| 992tv成人免费影院| 久久99久久久久久久噜噜| 欧美猛交ⅹxxx乱大交视频| 欧洲成人在线观看| 亚洲免费影视第一页| 亚洲男人av电影| 欧美成人性色生活仑片| 精品久久久av| 中文精品99久久国产香蕉| 日韩美女av在线免费观看| 亚洲综合日韩在线| 欧美激情小视频| 欧洲日本亚洲国产区| 欧美日韩免费在线| 国产成人精品国内自产拍免费看| 国产一区二区三区中文| 久热99视频在线观看| 成人观看高清在线观看免费| 91亚洲精品久久久久久久久久久久| 亚洲精品www久久久| 久久这里只有精品99| 久久久久久久久久久亚洲| 亚洲最大激情中文字幕| 欧美放荡办公室videos4k| 久久国产精品久久久久久| 国语自产精品视频在线看一大j8| 国产日韩欧美影视| 亚洲天堂第二页| 国产精品91视频| 97久久超碰福利国产精品…| 欧美日韩美女视频| 欧美国产日韩一区二区三区| 亚洲成人久久一区| 精品成人69xx.xyz| 欧美日韩午夜视频在线观看| 日韩欧美国产免费播放| 久久久国产一区二区| 大荫蒂欧美视频另类xxxx| 亚洲精品一区av在线播放| 日韩中文视频免费在线观看| 亚洲福利视频专区| 国产欧美在线看| 久久夜色精品亚洲噜噜国产mv| 欧美激情在线播放| 一区二区亚洲精品国产| 成人乱人伦精品视频在线观看| 日韩h在线观看| 亚洲社区在线观看| 国外成人在线直播| 国产精品福利无圣光在线一区| 亚洲人在线观看| 97国产精品视频人人做人人爱| 91国产在线精品| 亚洲精品成人免费| 欧美大尺度激情区在线播放| 国产一区二区精品丝袜| 中文字幕久久精品| 亚洲日韩欧美视频| 精品久久久久久中文字幕一区奶水| 国产欧美精品一区二区三区-老狼| www日韩欧美| 91久久嫩草影院一区二区| 欧美黄网免费在线观看| 国产精品video| 久久精品国亚洲| 欧美性高跟鞋xxxxhd| 成人在线一区二区| 久久精品国产视频| 亚洲天堂日韩电影| 亚洲a区在线视频| 欧美最近摘花xxxx摘花| 成人有码在线播放| 在线视频一区二区| 欧洲美女7788成人免费视频| 国色天香2019中文字幕在线观看| 草民午夜欧美限制a级福利片| 国内精品小视频| 久久久久久久一区二区| 精品呦交小u女在线| www国产精品com| 国产午夜精品一区二区三区| 久久99青青精品免费观看| 国产一区二区黄| 国产精品午夜视频| 91视频国产一区| 国产精品中文久久久久久久| 国产91精品不卡视频| 亚洲精品国产美女| 欧美极度另类性三渗透| 国产精品草莓在线免费观看| 欧美日本高清视频| 亚洲人午夜精品免费| 欧美国产日韩精品| 国产精品久久久久久久久久久新郎| 亚洲偷熟乱区亚洲香蕉av| 亚洲高清色综合| 日韩国产欧美精品一区二区三区| 日韩欧美亚洲一二三区| 欧美精品日韩三级| 欧美区二区三区| 国产精品入口福利| 欧美激情视频一区| 亚洲黄色片网站| 欧美黑人国产人伦爽爽爽| 久久天天躁狠狠躁夜夜躁| 日韩视频第一页| 狠狠操狠狠色综合网| 色yeye香蕉凹凸一区二区av| 国产精品老女人精品视频| 亚洲精品一区在线观看香蕉| 国产97在线|日韩| 久久精品国产亚洲精品| 91亚洲精品一区| 91久久在线观看| 91精品国产91久久久久久久久| 欧美日韩美女在线| 久久久噜久噜久久综合| 久久av中文字幕| 欧美激情一区二区三区久久久| 国产精品中文久久久久久久| 欧美性生交xxxxx久久久| 欧美在线一区二区三区四| 国产在线拍偷自揄拍精品| 精品国产91乱高清在线观看| 欧美激情第三页| www.亚洲免费视频| 亚洲免费一在线| 精品少妇v888av| 欧美性猛交xxxx黑人| 全色精品综合影院| 亚洲第一综合天堂另类专| 欧美激情xxxxx| 久久夜色撩人精品| 国产成人av在线播放| 国产精品久久久久久久久借妻| 最新69国产成人精品视频免费| 这里只有精品在线观看| 亚洲男人第一网站| 国产精品爱啪在线线免费观看| 中文字幕免费精品一区| 91夜夜揉人人捏人人添红杏| 亚洲第一视频在线观看| 日韩美女写真福利在线观看| 揄拍成人国产精品视频| 精品国产91乱高清在线观看| 亚洲成人黄色网址| 日韩中文字幕视频在线| 91在线视频九色| 成人淫片在线看| 久久精品久久久久久国产 免费| 精品露脸国产偷人在视频| 亚洲成人动漫在线播放| 亚洲第一免费网站| 97在线观看免费高清| 深夜成人在线观看| 久久人人爽人人爽爽久久| 国产日韩中文字幕在线| 亚洲精品乱码久久久久久按摩观| 亚洲精品自产拍| 韩国三级电影久久久久久| 国产精品久久久久7777婷婷| 欧美国产第一页| 国产高清在线不卡|