Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codechef July Challenge 2021 (Rated for Div 3) #1758

Closed
wants to merge 1,532 commits into from
Closed

Conversation

NidhiChaurasia
Copy link

@NidhiChaurasia NidhiChaurasia commented Jul 3, 2021

Description

Chefland has 7 days in a week. Chef is very conscious about his work done during the week.

There are two ways he can spend his energy during the week. The first way is to do x units of work every day and the second way is to do y (>x) units of work for the first d (<7) days and to do z (<x) units of work thereafter since he will get tired of working more in the initial few days.

Find the maximum amount of work he can do during the week if he is free to choose either of the two strategies.

Input
The first line contains an integer T, the number of test cases. Then the test cases follow.
Each test case contains a single line of input, four integers d, x, y, z.
Output
For each testcase, output in a single line the answer to the problem.

Constraints
1≤T≤5⋅103
1≤d<7
1≤z<x<y≤18
Subtasks
Subtask #1 (100 points): Original constraints

Sample Input
3
1 2 3 1
6 2 3 1
1 2 8 1
Sample Output
14
19
14
Explanation
Test Case 1: Using the first strategy, Chef does 2⋅7=14 units of work and using the second strategy Chef does 3⋅1+1⋅6=9 units of work. So the maximum amount of work that Chef can do is max(14,9)=14 units by using the first strategy.

Test Case 2: Using the first strategy, Chef does 2⋅7=14 units of work and using the second strategy Chef does 3⋅6+1⋅1=19 units of work. So the maximum amount of work that Chef can do is max(14,19)=19 units by using the second strategy.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Documentation Update

Checklist:

  • My code follows the style guidelines(Clean Code) of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests/screenshots(if any) that prove my fix is effective or that my feature works

Amit366 and others added 30 commits June 25, 2021 20:52
Bitwise Tuples problem using JAVA
Create First Missing Positive.cpp
Maximum rectangular area in histogram code added
added DFS Graph code in Graph
added online_stack_span.cpp Problem in Leetcode
Add LinkedList to BST program
Added Total Expenses of Codechef in Java under LGMSOC'21
Add Athelete sort in Python in HackerRank
Reverse Circular Linked List added
…)-Leetcode(medium)

String_to_Int-(atoi)_(Leetcode-Medium).py
Added Segment tree implementation in Algorithm section
Added Lucky Alive Person in GFG folder
Ananya-Misra and others added 27 commits July 2, 2021 16:34
Relativity (July Long Challenge)
Code added for Minimize the Heights II
Maximum perfect number code added
Added a program to see a product of a array except self
…ement

Added Cpp Solution to Majority Element
Solution for "Add Binary" on LeetCode for Issue #1725
Solution for "Add Binary" on LeetCode for Issue #1725
Adding Problem 1526B of codeforces in JAVA
Added postorder traversal in python
Added problem B of AtCoder DP
…va#1230

 First missing positive number in unsorted array. (in java)
 added solution for issue number #1331 in C language
C++ Solution for "Roman to Integer" on LeetCode under LGMSOC21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.