Re: [code jam] equal sum round 1a

2022-04-24 Thread Joseph DeVincentis
Sorry, no java code. But the programming is simple (unless you are having trouble with the interactive I/O - if that is the case then say so). This problem is more a puzzle to find the right strategy for picking numbers. The problem works like this: You pick 100 different numbers between 1 and

Re: [code jam] Round 1A 2022 - Code Jam 2022: Equal Sum

2022-04-20 Thread Joseph DeVincentis
Suppose after your program chooses the numbers 0 to 99, the server sends you 100 through 198 and 9. Now half the sum of all the numbers is 59850 but the set you choose will always be less than that if you exclude 9, and always more if you include it. You need a different strategy than

Re: [code jam] Qualifications 2022 Twisty Little Passages Analysis Importance Sampling

2022-04-05 Thread Joseph DeVincentis
If, like me, you ignored walking and just teleported to a random sample of the rooms, you would have found that you got a perfect score on the cases in the local testing tool, but wrong answer on the real data. What the analysis is trying to say is that practically the only cases where you will

Re: [gcj] What's my mistake? [Qualification Round 2020: Parenting Partnering Returns]

2020-04-16 Thread Joseph DeVincentis
The input time ranges for case 3 were: 99 150 1 100 100 301 2 5 150 250 JCCJC means to assign 1-100, 100-301, and 150-250 to C, but the last two of those overlap. While sorting the tasks by starting time in order to determine who can handle each one is a good strategy, you have to also retain

Re: [gcj] Re: How to use Hall's Marriage Theorem to prove in Indicium

2020-04-13 Thread Joseph DeVincentis
A...ABC: The n-2 A's give us n possible values from n-2 to (n-2)n as A varies from 1 to n. The B and C can independently vary from 1 to n. If they are both n, then the sum is (n-2)A +2n = nA + 2n - 2A When you increase A by 1 and reduce B and C to 1, then the sum becomes (n-2)(A+1) + 2 = nA + n -

Re: [gcj] Re: Indicium problem discussion

2020-04-07 Thread Joseph DeVincentis
And check the columns in your 4,10. It's not a Latin square. On Tue, Apr 7, 2020 at 4:59 PM Andrii Kovalov wrote: > From your dictionary you are missing 2,4; 3,9, a whole bunch of 4's, and > if you want to pass the small test set, you need to add 5's as well. > > On Tuesday, 7 April 2020

Re: [gcj] Alternative "creative" solutions to "Indicium"

2020-04-06 Thread Joseph DeVincentis
I solved Indicium pretty slowly (17 hours after the other problems...) when I had a brainstorm. It is a lot like what you suggested, but your solution is not complete. (a) if k is a multiple of n, a circulant square with k/n on the diagonal works. (b) When k=n+2, or k=n^2-2, or n=4 and k=10, find

Re: [gcj] Parenting Partnering return

2020-04-06 Thread Joseph DeVincentis
If there are three tasks that conflict in the same period of time, then it is impossible, yes. But consider this input: 1 4 0 100 400 500 0 300 200 600 A working allocation is to put tasks 1 and 4 on one parent and 2 and 3 on the other. But by processing them in the original order and always

Re: [gcj] Re: Cryptopanagrams

2020-04-01 Thread Joseph DeVincentis
That is the trade-off you face when choosing a language. Some languages may have more helpful features but be slower. In this case, once you start doing math with bignums the speed advantage may be mostly negated, plus you spend time coding up your own bignum class in C++. I will point out this

Re: [gcj] Codejam 2019 1C Power Arrangers TLE

2019-05-13 Thread Joseph DeVincentis
On Mon, May 13, 2019 at 2:18 PM Pinku Deb Nath wrote: > I tried to solve this problem but running the interactive_runner locally > does not respond. Online submission gave TLE. I called the runner in the > following way: > python interactive_runner.py python testing_tool.py -- ./a.out >

Re: [gcj] Power Arrangers - problem clarification

2019-05-08 Thread Joseph DeVincentis
Each model contains the five figures in some order, such as ABCDE. There are indeed 5! = 120 possible models. We have 119 of the 120 possible models and they are all lined up next to each other on a very long shelf. If we only had three models ABCDE, ABCED, and EDCBA, then this might look like

Re: [gcj] Some questions about Bacterial Tactics task of round 1C 2019

2019-05-07 Thread Joseph DeVincentis
Your analysis is incorrect. For both of your examples, all the horizontal moves win for Becca as she takes the entire board. After 0 1 V or 0 2 V on the 1x4 board, Terry plays the other of those two moves, leaving two isolated cells. On Tue, May 7, 2019 at 1:08 PM Ryabokon Sergiy wrote: > I

Re: [gcj] Question about Code Jam 2019 Round 1B second problem - Draupnir

2019-04-30 Thread Joseph DeVincentis
The 1-day rings duplicate every day, so their contribution to the sum moves one bit left in the binary representation every day. After 63 days, since we only get the value mod 2^63, the 1-day rings make no contribution to the value you get. On Tue, Apr 30, 2019 at 10:05 AM Ramesh Kumar wrote: >

Re: [gcj] question about alien rhyme

2019-04-25 Thread Joseph DeVincentis
Remember that when you are rhyming words, you are assigning an accent on a particular letter. So when you rhyme (C)ENT and RE(C)ENT, you can retain SCENT and use it later putting the accent on the E to rhyme SC(E)NT and W(E)NT. Now SC(E)NT does not rhyme with (C)ENT because the tail -(C)ENT is

Re: [gcj] question about alien rhyme

2019-04-23 Thread Joseph DeVincentis
The problem is about matching pairs of rhymes. Apparently we know that the poems in this alien language only ever use each rhyming-ending twice. Or maybe it's that we want to see how complex the rhyme scheme could be, in terms of different rhyming endings. Since rhymes are determined based on the

Re: [gcj] My analysis of Alien Rhyme

2019-04-15 Thread Joseph DeVincentis
My solution was simpler than this. I didn't worry about comparing pairs. I didn't even really worry about the identities of the words; just made sure to count things properly. But like you, I did a search starting with the longest repeats. I think that part may be required to get a working

Re: [gcj] Golf Gophers python 3 TLE

2019-04-14 Thread Joseph DeVincentis
Yes, Bartholomew, that is what I did in my solution. I tested this locally with m=100 and it took 4 seconds to build the mapping, so I figured it was good enough and also that searching for the answer in each test case would time out.

Re: [gcj] What's wrong with my Golf Gophers Lua solution?

2019-04-13 Thread Joseph DeVincentis
You need to flush AFTER you write a line. On Fri, Apr 12, 2019 at 11:38 PM Waffle 3z wrote: > I spent the last hour of this contest trying to figure out what this > interactive system wants. I know my solution is correct, I just don't get > this interactive inputs thing and debugging is

Re: [gcj] Google Code Jam 2019 Qualifications Problem 3: Cryptopangrams - Runtime Error

2019-04-08 Thread Joseph DeVincentis
If the message contains a pattern like ABA, then two consecutive values will be the same. Your code generates the wrong values in this case (because gcd = value and dividing out the gcd gives 1 instead of one of the primes), and probably puts more than 26 values into prime_list, which leads to

Re: [gcj] Runtime Error while uploading solution for the Cryptopangrams problem. Codejam 2019 Qualification R

2019-04-07 Thread Joseph DeVincentis
It is possible when the message starts something like ABA for the first two values to be the same. In this case, you get gcd = values[0] instead of the prime shared between the first two values, and this wrong calculation leads to some of your later numbers being fractions, which probably leads to

Re: [gcj] Analysis for Foregone Solution

2019-04-07 Thread Joseph DeVincentis
We are told in the problem statement that N always contains a 4, so you do not actually have to worry about one of your numbers in the constructive solution ending up as a 0. A number with only one non-zero digit is also not a concern, since this would result in 4000...0 = 2000...0 + 2000...0 and

Re: [gcj] Why was my submission for the problem Rounding Error accepted?

2018-05-02 Thread Joseph DeVincentis
This is actually what the analysis for the large case describes. Because the percentages all really sum to 100%, you want to make as many of them round up as possible. Once one has rounded up, it takes more than an addition of 0.5% to make it round up to the next integer, but it takes only 0.5% to

Re: [gcj] Can someone help me, why my solution failed at 2018 1B: Rounding Error problem?

2018-05-02 Thread Joseph DeVincentis
possible, given the total number of voters and the votes cast by a portion of them. On Wed, May 2, 2018 at 9:27 AM Samuel Jawahar <insidej...@gmail.com> wrote: > Thanks a lot sir,5*round(100/6) is not valid?,in case1 it is > > On Wed, May 2, 2018, 17:39 Joseph DeVincentis <dev..

Re: [gcj] Can someone help me, why my solution failed at 2018 1B: Rounding Error problem?

2018-05-02 Thread Joseph DeVincentis
No. If five people choose one language and one chooses another, than the language with 5 people represents 5/6 = 83.33...% and you get 83 + 17 = 100. If six people all chose different languages then each of six languages would have 17% and the total would be 102, but that option is not available

Re: [gcj] 2018 1A Edgy Baking problem analysis

2018-04-16 Thread Joseph DeVincentis
As I solved this problem, I noted that the range of dimensions for the cookies was limited to 1 to 250. This interval is less than sqrt(2)^16, and I realized it meant that if you keep track of the intervals, merging them as they overlap, you will never have too many different intervals. Start

Re: [gcj] Re: Google Code Jam 2018 registration is open

2018-03-07 Thread Joseph DeVincentis
Hidden *subproblems*. The subproblems are going to be equivalent to different inputs, visible and hidden ones being equivalent to small and large inputs of past Code Jams in the sense that you got the results from small inputs immediately after you submitted them but large input results were not

[gcj] Google Code Jam 2018 registration is open

2018-03-06 Thread Joseph DeVincentis
Registration is open and the full schedule is up. https://code.google.com/codejam/ -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [gcj] Pls help guys

2017-08-03 Thread Joseph DeVincentis
It's too late to get involved this year, but look for it to return at the same time next year and use this year's schedule as an estimate. https://code.google.com/codejam/schedule Follow the other navigation links at the top for more information. The brief summary follows: Registration starts

Re: [gcj] t-shirts

2017-07-30 Thread Joseph DeVincentis
I received my shirt Friday, so if you are due one, expect it soon. On Sun, Jul 30, 2017 at 12:59 AM, Pedro Osório wrote: > Any idea when are the t-shirts being sent out? > > -- > You received this message because you are subscribed to the Google Groups > "Google Code

Re: [gcj] Round 2 2017 Problem B: Roller Coaster Scheduling

2017-05-14 Thread Joseph DeVincentis
For the small case where there are only two customers, the greedy strategy you should be using is to try to wear down the largest stacks of tickets on the same seat first. In that case, after picking any two tickets for different seats in your ride 1, you will pick one of the seat 3 tickets in

Re: [gcj] Problem C Bathroom Stalls - Verification of output

2017-04-12 Thread Joseph DeVincentis
Paul's technique is how I solved Bathroom stalls. Because there can be a very large number of stalls, you can't simulate every stall, but if you just keep track of how many intervals of empty stalls of each size that there are, then you can do all intervals of one size at once (which all split the

Re: [gcj] Re: regarding the qualification round

2017-04-07 Thread Joseph DeVincentis
You can also go to https://code.google.com/codejam/ where there is a countdown timer to the start of the round. On Fri, Apr 7, 2017 at 5:22 PM, shashanktandon20009 < shashanktandon20...@gmail.com> wrote: > On Friday, 7 April 2017 22:15:27 UTC+1, shrutijha.1305 wrote: > > hello,i am new to the

Re: [gcj] Round 1C Problem B Slides

2016-05-11 Thread Joseph DeVincentis
I'm not even sure how this program is expected to work, but part of the difficulty of this problem is that there are many solutions for most possible inputs and you need to come up with an algorithm that gives you a good one quickly. But consider the output you get from this input: 2 6 13 6 12

Re: [gcj] Confused about fractiles

2016-04-11 Thread Joseph DeVincentis
Your solution fails for the small case when the complexity is 1. In that case you have to uncover every tile. Your assumption that all the students will see gold when the first tile is gold is only valid when the complexity is at least 2. On Mon, Apr 11, 2016 at 11:35 AM, frederik

Re: [gcj] Any non-brute force solution for Typewriter monkey (Round 1C 2015 B)?

2015-05-11 Thread Joseph DeVincentis
if X is the product of the number of keys containing each letter of the target, then the expected number of matches is X*(S-L+1)*K^(S-L)/K^S, or simply X*(S-L+1)/K^L. On Sun, May 10, 2015 at 8:40 PM, Joseph DeVincentis dev...@gmail.com wrote: I was already qualified, so I didn't wake up at 5

Re: [gcj] Any non-brute force solution for Typewriter monkey (Round 1C 2015 B)?

2015-05-10 Thread Joseph DeVincentis
I was already qualified, so I didn't wake up at 5 this morning to solve this round, but I just completed all the problems in practice. For typewriter monkey, the maximum matches is easy. Find the longest initial substring which matches a final substring of the target, shorter than the whole

Re: [gcj] Round 1A : Problem B. Haircut

2015-04-18 Thread Joseph DeVincentis
Here's how I solved haircut. First, write a function which calculates the number of haircuts which have started at or before m minutes after the store opens. A barber who takes mk minutes to do one haircut will have started 1+floor(m/mk) haircuts by minute m. Add this up over all barbers. Then

Re: [gcj] codejam2015

2015-04-11 Thread Joseph DeVincentis
OK, the qualification round is over, so here's how I solved all the problems: A. Standing Ovation: Make a single pass through the list from 0 to max shyness, keeping track of (shyness level minus total audience members less shy than this), which is the number of additional 0-shy members needed to

Re: [gcj] Qualification Round 2012: Problem A. Speaking in Tongues

2014-04-06 Thread Joseph DeVincentis
Take a look at the first and last letters of the alphabet in case 7. On Sun, Apr 6, 2014 at 7:12 AM, Amit Thakur he...@amitthakur.org wrote: Hello! I attempted Qualification Round 2012: Problem A. Speaking in Tongues. Here is the code with output: https://ideone.com/WtSxtd The output

Re: [gcj]

2013-05-13 Thread Joseph DeVincentis
This problem (1C A Consonants) can be solved in O(N). Proceed through the string character by character, keeping a counter indicating the number of consecutive consonants. When it reaches n, do the following: 1. Compute the number of substrings that contain this group of n consonants by

Re: [gcj] Round 1A 2013 - C. Good Luck

2013-05-12 Thread Joseph DeVincentis
There are N cards. The probability that the first card is in the subset is 0.5. The probability that the second card is in the subset is 0.5. ... The probability that the Nth card is in the subset is 0.5. So if there were 3 cards called A, B, and C, then there are 8 equally likely subsets: ABC,

Re: [gcj] GCJ 2013, round 1B, problem B

2013-05-05 Thread Joseph DeVincentis
There are 30 possibilities, but they are not all equally likely, because of the result that after 4 diamonds are stacked on one side, the next one is forced to the other side. On Sun, May 5, 2013 at 3:48 AM, Betlista betli...@gmail.com wrote: But that would say there are 32 possibilities, but

Re: [gcj] Contest Analysis

2013-05-05 Thread Joseph DeVincentis
The point is that removing a mote out of the middle of the sorted sequence doesn't help. If you can already eat that mote then you are better off not removing it. If you can't eat that mote without adding other motes, then you will have to add other motes to be able to eat the next larger

Re: [gcj] Contest Analysis

2013-05-05 Thread Joseph DeVincentis
0 and all of them.* I didn't understand this. On Sun, May 5, 2013 at 8:30 PM, Joseph DeVincentis dev...@gmail.comwrote: The point is that removing a mote out of the middle of the sorted sequence doesn't help. If you can already eat that mote then you are better off not removing it. If you

Re: [gcj] Contest Analysis

2013-05-05 Thread Joseph DeVincentis
, Joseph DeVincentis dev...@gmail.comwrote: The point is that removing a mote out of the middle of the sorted sequence doesn't help. If you can already eat that mote then you are better off not removing it. If you can't eat that mote without adding other motes, then you will have to add other

Re: [gcj] Re: Question on Problem A - Osmos

2013-05-04 Thread Joseph DeVincentis
Introduce 2 to get to 5, introduce 4 to get to 9, introduce 8 to get to 17, and then eat the motes. On Sat, May 4, 2013 at 8:30 PM, Mutley prabra...@gmail.com wrote: On Saturday, May 4, 2013 12:09:49 PM UTC-7, Mutley wrote: Can someone please run this and let me what test cases fail? My code

Re: [gcj] GCJ 2013, round 1B, problem B

2013-05-04 Thread Joseph DeVincentis
In your cases with 10 diamonds, you have probabilities of 1/16, 4/16, 6/16, 4/16, and 1/16 of being in the respective cases. To get to the first case with 11 diamonds, if you are in the 1/16 case, you will always go there, and in the 4/16 case, you will go there half the time, so the correct

Re: [gcj] Re: Contest Analysis for Round 1A has been posted

2013-04-30 Thread Joseph DeVincentis
I used that O(N log N) strategy for my solution (though I got the large input wrong because I did not check for RE, sigh), so let me explain how my solution worked: First, make a copy of all the activity values with their original indexes attached, and sort these in descending order. This is the

Re: [gcj] BullsEye Problem - Python Troubleshooting help!

2013-04-27 Thread Joseph DeVincentis
The problem with this is that pow(foo, 0.5) performs a floating point calculation which is not accurate to the 18 significant figures required for this result. On Sat, Apr 27, 2013 at 6:55 AM, wonjun wonj...@gmail.com wrote: I used the following logic for the problem - Let k be the required

Re: [gcj] Explanation for Treasure

2013-04-24 Thread Joseph DeVincentis
, 2013 at 12:46 AM, Joseph DeVincentis dev...@gmail.comwrote: To solve Treasure, first make sure that the problem has some solution. This requires: 1. There are enough copies of each key available somewhere. 2. There is some viable sequence of chest-openings to unlock each chest

Re: [gcj] Qualification Confirmation

2013-04-18 Thread Joseph DeVincentis
I just got my confirmation email. On Thu, Apr 18, 2013 at 1:23 AM, Ajay Yadav ajayyadav...@gmail.com wrote: when will they send confirmation mail On Wed, Apr 17, 2013 at 10:37 AM, Jugesh Sundram jugeshsund...@gmail.comwrote: I scored an easy 40 for the Quals and I am waiting for

Re: [gcj] Error In Output

2013-03-28 Thread Joseph DeVincentis
me how to implement this problem... thanks a lot... On 28 March 2013 03:14, Joseph DeVincentis dev...@gmail.com wrote: No DFS is needed for the problem you pose here. It can be solved in a single pass through the input. On Mar 27, 2013 5:16 PM, mandeep khatkar mandeep...@gmail.com wrote

Re: [gcj] Re: All your base

2013-03-15 Thread Joseph DeVincentis
zig has a minimum base of 3, since it has 3 different digits. But it could have a larger base where some digits are not used, in the same way that 187 can be a number in base 10, with digits 0, 2, 3, 4, 5, 6, and 9 unused. On Fri, Mar 15, 2013 at 10:46 AM, Aneesh Dogra lionane...@gmail.com

Re: [gcj] Binary Power (x power y) x,y is very large.

2013-01-31 Thread Joseph DeVincentis
I am not sure what this is for, but in problems that ask for something like this, you usually only need x^y modulo m, or the last so many digits of the number, which is equivalent. There are shortcuts to calculate this without calculating all of x^y. On Thu, Jan 31, 2013 at 6:12 PM, upen

Re: [gcj] Algorithmic Approach

2012-10-16 Thread Joseph DeVincentis
With the size fixed at 3x4, this should be solvable as a pruned brute force search. Just go cell by cell, iterating over all possible letters that can go there. A letter is not allowed if it appeared in that row or column of the original, or if you have already placed it in another cell. For each

Re: [gcj] Re: Another doubt, apologies for my last post that has been too long and worthless

2012-08-25 Thread Joseph DeVincentis
You have the product, although you have only done it for one string so far. The problem tells you how to get the mod 47 value; this is in fact such a common operation in computing that your language has an operator to perform it. If your numbers are small, you just have to compare the mod 47

Re: [gcj] Question

2012-08-05 Thread Joseph DeVincentis
If you keep track of the results as a set of nonoverlapping operations, that is, after adding 1 to papers 1 to 10 and subtracting 2 from pages 5 to 20, then you end up with three operations: +1 from 1-4, -1 from 5-10, and -2 from 11-20. Instead of applying each operation to potentially every