anoophky
BAN USER
- 2of 2 votes
AnswersNext Sunday is Ayan’s 4th birthday and a lot of guests are invited for his birthday celebration. All of them are getting gifts for Ayan and his y-1 number of siblings. There are x number of guests coming to the party and each of them presented each kid some integer number of gifts (possibly zero). The guests are numbered with integers from 1 to x and all kids are numbered with integers from 1 to y. For all 1 ≤i ≤x the minimum number of gifts, which i-th guest presented to some kid is equal to gi and for all 1 ≤j ≤y the maximum number of gifts, which j-th kid received from some guest is equal to kj.
- anoophky in United States
Let ai,j be the number of gifts which the i-th guest give to the j-th kid. Then gi is equal exactly to the minimum among values ai,1,ai,2,…,ai,y and kj is equal exactly to the maximum among values g1,j,g2,j,…,gx,j.
You are interested in the minimum total number of gifts that guests could present, so you need to minimize the sum of ai,j for all (i,j) such that 1 ≤i ≤x and 1 ≤j ≤y. You are given the numbers g1,…,gx and k1,…,ky, determine this number.
Input Format
The first line contains two integers x and y, separated with space — the number of guests and kids, respectively (2≤x,y≤100000). The second line contains x integers g1,…,gx, separated by spaces — gi is equal to the minimum number of gifts, which i-th guest presented to some kid (0≤gi≤1000). The third line contains y integers k1,…,ky, separated by spaces — kj is equal to the maximum number of gifts, which j-th kid received from some guest (0≤kj≤1000).
Output Format
If the described situation is impossible, print −1. In another case, print the minimum total number of gifts, which guests could have presented and all conditions could have satisfied.
Sample Input
3 2
1 2 1
3 4
Sample Output
12| Report Duplicate | Flag | PURGE
- 0of 0 votes
AnswersMr. Stark is the owner of Stark industries, a manufacturer of weaponry.
- anoophky in United States
A local Mafia group has hijacked one of the factories in the desert.
The mafias want to transport the weapons from the factory to their base camp, and use a single truck to do it.
But, every kilometer the truck travels with the weapons, one weapon falls off and breaks. The truck can only travel integral values of distance, and will lose 1 weapon for every km travelled.
The weapons can be unloaded at any point from the truck, and can be picked up again later.
Given the number of weapons X, max capacity of the truck Y and distance between the factory and the base Z, find the maximum number of weapons that can be transferred intact from the factory to the mafia base.
Function Description:
findMaxWeapons function takes the following parameters:
X - the number of weapons
Y - max capacity of the truck
Z - distance between the factory and the base| Report Duplicate | Flag | PURGE
- 0of 0 votes
AnswersA string can contain only a, b or c. There cannot be 2 consecutive same character. First and the last character cannot be the same. Now given a string with ‘a’, ‘b’, ‘c’ or ‘?’. We need to find the string replacing ‘?’ that satisfy the above conditions. For multiple-answer display lexicographically smallest string. For no answer possible display “Not Possible”.
- anoophky in India| Report Duplicate | Flag | PURGE
Directi SDE1 String Manipulation
Repyahviross, translator at learnify
Dedicated English-Mandarin Chinese translator with years of experience working in professional and scientific communities.Diverse translation work including proprietary scientific ...
Repryanahurd, Korean Air Change Flight at 247quickbookshelp
Je suis Ryana avec 2 ans d'expérience dans la gestion d'un flux de travail à haut volume en ...
Repselindareese, Animator at Agilent Technologies
I am Selinda a Music teacher and composer with 6+ years of experience with an in depth knowledge of music ...
Repaalexlingram, AT&T Customer service email at ABC TECH SUPPORT
I am Alex and I live in Colorado Springs . I am working as a International human resources manager and I ...
Repjanistbennett, Blockchain Developer at AMD
I am JanisBennett working as a journalist, having years of experience in my career. I have covered various stories.Great ...
Repjosiredhima, AT&T Customer service email at Aricent
I am an architect with three years experience planning and designing commercial buildings. I am working as principal architect on ...
RepEdithJHarden, Random at Axiom Sources
Je suis un professionnel de la gestion des soins de santé avec 2 ans d'expérience en supervision d'établissements ...
Repronalddavis284, Accountant at ADP
As you may be able to infer from my professional background, I have a strong interest in mathematics and the ...
Repgiannanewhart, Cloud Support Associate at ABC TECH SUPPORT
I am Clinical managers, a type of medical and health services manager, and work as managers in both administrative areas ...
Repabig8485, Apple Phone Number available 24/7 for our Customers at ABC TECH SUPPORT
Hello, I'm Abigail and I'm from Hugo City. I maintain customer loyalty and keep a diverse group of ...
Repellaiyer15, Content Writer at Precious Moments
Committed to producing exceptional and creative types of content, including articles, internet content, advertisements, commercials, brochures, and publications. Experienced in ...
Repjacksssones433, Apple Phone Number available 24/7 for our Customers at A9
Proficient and creative WordPress developer with a strong history in website management and development. Experienced in SEO and PPC campaign ...
Repharryhamesh, Android Engineer at ADP
I placement officers usually work in colleges and universities. One of My friends taught me about prayers that break curses ...
RepKimRPierce, Employee at Achieve Internet
I am a customer service-oriented Travel Agent in Travel and Tourism industries. I strongly believe that the skills and abilities ...
Reppaulaamontalvo, AT&T Customer service email at AMD
I am working as Human Resources Associates, and my duties are for obtaining, recording, and interpreting human resources information within ...
Repnorahuerta1111, Accountant at ABC TECH SUPPORT
Hey, I'm Nora Huerta, and I'm working as a journalist. And nowadays I am doing part time jobs ...
RepIndianastrologyguru, Data Scientist at ABC TECH SUPPORT
Hey I'm Shelly Renee and I'm working as a system developer. Currently working part time on a project ...
Repriyanahobett, Sales Development Representative at Capgemini
I am Riyana , driven market researcher with over years of experience at Awthentikz , analyzing information in order to construct profiles ...
RepSarahSKelly, Game Programmer at Akamai
I am Professor, and I am also a skilled fiction writer. I have a collection of novels published in the ...
RepCrystalKeane, Android test engineer at ABC TECH SUPPORT
Hello I am a skill trainer. Master's Degree in Industrial and Organisational Psychology and 10 years of experience working ...
Reptaylamowll, Analyst at AMD
Aspire to work in a challenging environment, where my exceptional skills and abilities are completely explored, and I can easily ...
Repmonicaralvarado94, Korean Air Change Flight at Athena Health
I am fond of reading stories then reading articles which are all about a story of a beautiful nature and ...
Repgoamgivheler, Accountant at Lava
I am working as a nurse in Bali Boer Cafarius. I enjoy relationships with patients and their families. It has ...
Rephelenweiver, Consultant at ASU
I am Helen , policy analyst at Sunflower Market , with 3 years of experience building and maintaining relationships with elected officials ...
RepDonnaArvin, Analyst at Apple
Hii am from the United States. I work as a computer control programmer at Dynatronics Accessories. I am a social ...
Replimlocica, News reporter at Smitty's Marketplace
Hello, I am a News reporter. Master's Degree in astrology and News reporter and 10 years of experience working ...
Repdelenestanf0, HR Executive at Agilent Technologies
Hi, I am a Clinical social worker. methods of prevention and treatment in providing mental-health/healthcare services, I also have ...
Reppamilarbowman, Animator at ABC TECH SUPPORT
Je travaille en tant que Web Manager dans la société Forum Cafeterias. Je veux tout savoir sur le marketing numérique ...
for 3000, 1000, 1000. First fill 1000 in truck move to 500 and drop 500 there repeat 3 times. Now problem reduced to X= 1500 y = 1000, Z = 500 now answer will be 750. But can't satisfy 833
- anoophky September 09, 2019