-
Notifications
You must be signed in to change notification settings - Fork 473
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
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Union of two sorted arrays
Reverse Circular Linked List added
…)-Leetcode(medium) String_to_Int-(atoi)_(Leetcode-Medium).py
Added Segment tree implementation in Algorithm section
lucky number code
Added Lucky Alive Person in GFG folder
Relativity (July Long Challenge)
Peak element code added
Code added for Minimize the Heights II
Added Problem Permutations
Maximum perfect number code added
Connected components 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
Chetas shree mountain #1295
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Checklist: