Re: [code jam] Chain reaction

2022-04-21 Thread Samuel Jawahar
Hello plesse let me known one good book for dynamic programing
Regards
Samuel

On Tue, 19 Apr 2022, 10:12 Samuel Jawahar,  wrote:

> Thanks a lot sir for spending valuable time
> I have done wrong one if condition that why it was failed
> I corrected in practice mode it worked
>
> https://codingcompetitions.withgoogle.com/codejam/round/00876ff1/00a45ef7
>
> Regards
>
> On Mon, 18 Apr 2022, 20:32 Katalin Brányiné Sulák, <
> branyine.sulak.kata...@gmail.com> wrote:
>
>> Hi Samuel,
>>
>> I checked the case you attached but I couldn't really follow your
>> notation. Either "participated" is wrong (fun value of node-3 is not the
>> given value, it's on node-1), (and)/or your solution is not on starting all
>> leaf nodes in a specific order.
>>
>> My output for this test case is:
>> 1
>> 9
>> 975975168 730620437 185934326 235968776 950919801 889728167 159021761
>> 808742231 730369172
>> 0 0 1 2 1 1 4 3 3
>> Case #1: 4355985804
>>
>> Follow this on paper and check the differences:
>> node 9: yields 975975168, nodes 1,3 are eliminated
>> node 7: yields 730620437, nodes 2,4 are eliminated
>> node 5: yields 950919801 (already root)
>> node 8: yields 808742231 (already root)
>> node 6: yields 889728167 (already root)
>>
>> Hope this helps.
>>
>> Kata
>>
>> Samuel Jawahar  ezt írta (időpont: 2022. ápr. 11.,
>> H, 2:29):
>>
>>> Hello plesse find the attached and let me know what you think
>>> My solution is correct or not
>>> For chain reaction problem
>>> Regards
>>> Samuel
>>>
>>> --
>>> -- You received this message because you are subscribed to the Google
>>> Groups Code Jam group. To post to this group, send email to
>>> google-code@googlegroups.com. To unsubscribe from this group, send
>>> email to google-code+unsubscr...@googlegroups.com. For more options,
>>> visit this group at https://groups.google.com/d/forum/google-code?hl=en
>>> ---
>>> 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 google-code+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/google-code/CAH5vfnOcDCzZ0HCnuFZk_-xB4D%2B3pRm81-BkwLih1ce%2BQhWePA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/google-code/CAH5vfnOcDCzZ0HCnuFZk_-xB4D%2B3pRm81-BkwLih1ce%2BQhWePA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> -- You received this message because you are subscribed to the Google
>> Groups Code Jam group. To post to this group, send email to
>> google-code@googlegroups.com. To unsubscribe from this group, send email
>> to google-code+unsubscr...@googlegroups.com. For more options, visit
>> this group at https://groups.google.com/d/forum/google-code?hl=en
>> ---
>> 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 google-code+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-code/CAPOU4JOJ24%3DaO4eyMnv5qC7E_qzSDfg9EGbCXv-EjjscEBAeHg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/google-code/CAPOU4JOJ24%3DaO4eyMnv5qC7E_qzSDfg9EGbCXv-EjjscEBAeHg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnO7Ag8jV6KfTO1R1xx-RT%3DuV7QBO%2B7g4w2wwvU6WYa05Q%40mail.gmail.com.


Re: [code jam] Qualification round - Chain reaction (WA) - Python 3.7

2022-04-20 Thread Samuel Jawahar
https://codejam.googleapis.com/dashboard/get_file/AQj_6U2-pTNTum7Yk9UWYoDOxk0_IQv4H-zDnwRS/Solution.java?dl=1

On Mon, 11 Apr 2022, 05:59 Katalin Brányiné Sulák, <
branyine.sulak.kata...@gmail.com> wrote:

> I have taken a look into your solution and despite it has the correct O(N)
> idea, unfortunately oversimplifying mixed up different aims in calculations.
> 1. the node X should be counted to the thread which has the lowest
> possible thread value of its triggerer elements
> 2. the full subtree rooted at node X has an aggregated value of the thread
> where X will count to (this is not fixed yet, subject to change in the
> further reaction chain part) _and_ sum of other subtree values of the
> non-minimum elements
> This way, when moving to the triggered node of X, you are using the 2. but
> you are thinking of 1. The max is not taken on fun values, but a fun value
> and an aggregation.
> You could either store both 1. and (2. minus 1.) separately in mem, or
> alternatively, you could only track of the 1. and immediately add the
> aggregated "other" parts to the result which are not reaching the abyss and
> won't change any more.
>
> This type of failure could be revealed in a tiny example F=[3,1,6,10,1]
> and P=[0,1,1,2,2] which selects node 3 as min when calculating node 1,
> given node 2 has mem value = subtree sum = 11 and not min thread value to
> consider = 1 (and node 3 has both = 6). This means the initiators in your
> solution are meant to trigger in the sequence 3,5,4 which gives 17 and not
> as 5,3,4 which gives 19. [I hope I haven't made any typo in the data.]
>
> Kata
>
> Thierry Njike  ezt írta (időpont: 2022. ápr.
> 6., Sze, 2:26):
>
>> Hello everyone,
>>
>> I tried to solve the chain reaction problem using dynamic programming
>> with recursivity.
>> *My logic*:
>> I considered a graph that I built using dictionary where the key is the
>> node number and the value is a list of nodes that point to the key node.
>> The Abyss is my node number 0. So key with [ ] as value are
>> trigerrable nodes.
>> My recursivity starts from abyss to trigerrable nodes. So, the final
>> score would be the abyss's fun score.
>> I passed the sample test but got WA. Could anyone tell me what's wrong
>> with my code please?
>> My code in attachment
>>
>> Thank you in advance
>> Thierry
>>
>>
>> --
>> -- You received this message because you are subscribed to the Google
>> Groups Code Jam group. To post to this group, send email to
>> google-code@googlegroups.com. To unsubscribe from this group, send email
>> to google-code+unsubscr...@googlegroups.com. For more options, visit
>> this group at https://groups.google.com/d/forum/google-code?hl=en
>> ---
>> 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 google-code+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-code/CAFqGFGZhXnupzFEXXCGr%2BFgzvaZNE_cWzrxQMRetL-B-ZaE_gQ%40mail.gmail.com
>> 
>> .
>>
> --
> -- You received this message because you are subscribed to the Google
> Groups Code Jam group. To post to this group, send email to
> google-code@googlegroups.com. To unsubscribe from this group, send email
> to google-code+unsubscr...@googlegroups.com. For more options, visit this
> group at https://groups.google.com/d/forum/google-code?hl=en
> ---
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CAPOU4JOoyuTCykGB%3DM9nq7NPa0%3DXyAY4U-3R9hgwvu3epZGSCA%40mail.gmail.com
> 
> .
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnNErK7uY%3Dk48HpZVK5XaW2kvC5UNxLnistid-xQFAyqDw%40mail.gmail.com.


Re: [code jam] Google Code Jam 2022 - Chain Reactions (RE problem)

2022-04-20 Thread Samuel Jawahar
https://codejam.googleapis.com/dashboard/get_file/AQj_6U2-pTNTum7Yk9UWYoDOxk0_IQv4H-zDnwRS/Solution.java?dl=1

On Mon, 11 Apr 2022, 05:59 Katalin Brányiné Sulák, <
branyine.sulak.kata...@gmail.com> wrote:

> Samuel, the link points to the problem itself, you are the only one seeing
> there your last typed solution. You can get the link of your solution if
> you select one of your submissions (either 'Test n' or 'Attempt n'), then
> in the top right corner click on the download, and check the Download
> section of chrome. It will show the name of the file and also the link
> where it is from. Only sharing the latter link will contain the desired
> code content.
>
> Kata
>
> Samuel Jawahar  ezt írta (időpont: 2022. ápr. 6.,
> Sze, 2:27):
>
>> Hello plesse send one test case where it is failing
>>
>> https://codingcompetitions.withgoogle.com/codejam/round/00876ff1/00a45ef7
>>
>> On Mon, 4 Apr 2022, 20:16 DarkDogg92,  wrote:
>>
>>> Hello everybody,
>>>
>>> I can't manage to solve the Chain Reactions problem. My solution seems
>>> to work locally, passes the sample tests on site, but when it comes to the
>>> real tests, I always get a runtime error.
>>>
>>> I decided to build a graph for every test case, then generate all the
>>> permutations of the chain reaction initiators and traverse the graph in
>>> order relevant for each permutation.
>>>
>>> I used a similar general code structure for other problems and it
>>> worked, so I guess it is a problem with the solution's logic.
>>>
>>> Below is my code in JS.
>>> Any suggestions would be greately appreciated!
>>>
>>>
>>>
>>> 'use strict';
>>>
>>> var readline = require('readline');
>>> var rl = readline.createInterface({
>>> input: process.stdin,
>>> output: process.stdout,
>>> });
>>>
>>> class NodeF {
>>> constructor(f) {
>>> this.back = false;
>>> this.used = false;
>>> this.f = f;
>>> }
>>> }
>>>
>>> class Input {
>>> constructor(strings) {
>>> this.stringsInd = 0;
>>> this.strings = strings;
>>> }
>>> getString() {
>>> return this.strings[this.stringsInd++];
>>> }
>>> getStringArray(sep) {
>>> return this.getString().split(sep);
>>> }
>>> getNumber() {
>>> return parseInt(this.getString());
>>> }
>>> getNumberArray(sep) {
>>> return this.getStringArray(sep).map(a => parseInt(a));
>>> }
>>> }
>>>
>>> let permutatorMethod = (inpArr) => {
>>> let res = [];
>>> let doPermute = (array, g) => {
>>> if (array.length === 0) {
>>> res.push(g);
>>> }
>>> else {
>>> for (let x = 0; x < array.length; x++) {
>>> let current = array.slice();
>>> let next = current.splice(x, 1);
>>> doPermute(current.slice(), g.concat(next));
>>> }
>>> }
>>> };
>>> doPermute(inpArr, []);
>>> return res;
>>> };
>>>
>>> let clearTree = (nodes) => {
>>> nodes.forEach((node) => {
>>> node.used = false;
>>> });
>>> };
>>>
>>> let solve = (input) => {
>>> let n = input.getNumber();
>>> let fss = input.getNumberArray(' ');
>>> let pss = input.getNumberArray(' ');
>>> let nodes = [];
>>> for (let i = 0; i < fss.length; i++) {
>>> nodes.push(new NodeF(fss[i]));
>>> }
>>> for (let i = 0; i < pss.length; i++) {
>>> if (pss[i] === 0) {
>>> nodes[i].next = null;
>>> }
>>> else {
>>> nodes[i].next = nodes[pss[i] - 1];
>>> nodes[pss[i] - 1].back = true;
>>> }
>>> }
>>> let nodeInitiators = nodes.filter(x => x.back === false);
>>> let nodeInitiatorsPerms = permutatorMethod(nodeInitiators);
>>> let permsMaxes = [];
>>> nodeInitiatorsPerms.forEach((perm) => {
>>> clearTree(nodes);
>>> let maxSum = 0;
>>

Re: [code jam] Google Code Jam 2022 - Chain Reactions (RE problem)

2022-04-20 Thread Samuel Jawahar
Hello Kata,
This is the link
https://codejam.googleapis.com/dashboard/get_file/AQj_6U2-pTNTum7Yk9UWYoDOxk0_IQv4H-zDnwRS/Solution.java?dl=1

There was one famous problem its name is milk shake, do you have that link?

Regards
Samuel


On Mon, 11 Apr 2022, 05:59 Katalin Brányiné Sulák, <
branyine.sulak.kata...@gmail.com> wrote:

> Samuel, the link points to the problem itself, you are the only one seeing
> there your last typed solution. You can get the link of your solution if
> you select one of your submissions (either 'Test n' or 'Attempt n'), then
> in the top right corner click on the download, and check the Download
> section of chrome. It will show the name of the file and also the link
> where it is from. Only sharing the latter link will contain the desired
> code content.
>
> Kata
>
> Samuel Jawahar  ezt írta (időpont: 2022. ápr. 6.,
> Sze, 2:27):
>
>> Hello plesse send one test case where it is failing
>>
>> https://codingcompetitions.withgoogle.com/codejam/round/00876ff1/00a45ef7
>>
>> On Mon, 4 Apr 2022, 20:16 DarkDogg92,  wrote:
>>
>>> Hello everybody,
>>>
>>> I can't manage to solve the Chain Reactions problem. My solution seems
>>> to work locally, passes the sample tests on site, but when it comes to the
>>> real tests, I always get a runtime error.
>>>
>>> I decided to build a graph for every test case, then generate all the
>>> permutations of the chain reaction initiators and traverse the graph in
>>> order relevant for each permutation.
>>>
>>> I used a similar general code structure for other problems and it
>>> worked, so I guess it is a problem with the solution's logic.
>>>
>>> Below is my code in JS.
>>> Any suggestions would be greately appreciated!
>>>
>>>
>>>
>>> 'use strict';
>>>
>>> var readline = require('readline');
>>> var rl = readline.createInterface({
>>> input: process.stdin,
>>> output: process.stdout,
>>> });
>>>
>>> class NodeF {
>>> constructor(f) {
>>> this.back = false;
>>> this.used = false;
>>> this.f = f;
>>> }
>>> }
>>>
>>> class Input {
>>> constructor(strings) {
>>> this.stringsInd = 0;
>>> this.strings = strings;
>>> }
>>> getString() {
>>> return this.strings[this.stringsInd++];
>>> }
>>> getStringArray(sep) {
>>> return this.getString().split(sep);
>>> }
>>> getNumber() {
>>> return parseInt(this.getString());
>>> }
>>> getNumberArray(sep) {
>>> return this.getStringArray(sep).map(a => parseInt(a));
>>> }
>>> }
>>>
>>> let permutatorMethod = (inpArr) => {
>>> let res = [];
>>> let doPermute = (array, g) => {
>>> if (array.length === 0) {
>>> res.push(g);
>>> }
>>> else {
>>> for (let x = 0; x < array.length; x++) {
>>> let current = array.slice();
>>> let next = current.splice(x, 1);
>>> doPermute(current.slice(), g.concat(next));
>>> }
>>> }
>>> };
>>> doPermute(inpArr, []);
>>> return res;
>>> };
>>>
>>> let clearTree = (nodes) => {
>>> nodes.forEach((node) => {
>>> node.used = false;
>>> });
>>> };
>>>
>>> let solve = (input) => {
>>> let n = input.getNumber();
>>> let fss = input.getNumberArray(' ');
>>> let pss = input.getNumberArray(' ');
>>> let nodes = [];
>>> for (let i = 0; i < fss.length; i++) {
>>> nodes.push(new NodeF(fss[i]));
>>> }
>>> for (let i = 0; i < pss.length; i++) {
>>> if (pss[i] === 0) {
>>> nodes[i].next = null;
>>> }
>>> else {
>>> nodes[i].next = nodes[pss[i] - 1];
>>> nodes[pss[i] - 1].back = true;
>>> }
>>> }
>>> let nodeInitiators = nodes.filter(x => x.back === false);
>>> let nodeInitiatorsPerms = permutatorMethod(nodeInitiators);
>>> let permsMaxes = [];
>>> nodeIniti

Re: [code jam] Google Code Jam 2022 - Chain Reactions (RE problem)

2022-04-05 Thread Samuel Jawahar
Hello plesse send one test case where it is failing
https://codingcompetitions.withgoogle.com/codejam/round/00876ff1/00a45ef7

On Mon, 4 Apr 2022, 20:16 DarkDogg92,  wrote:

> Hello everybody,
>
> I can't manage to solve the Chain Reactions problem. My solution seems to
> work locally, passes the sample tests on site, but when it comes to the
> real tests, I always get a runtime error.
>
> I decided to build a graph for every test case, then generate all the
> permutations of the chain reaction initiators and traverse the graph in
> order relevant for each permutation.
>
> I used a similar general code structure for other problems and it worked,
> so I guess it is a problem with the solution's logic.
>
> Below is my code in JS.
> Any suggestions would be greately appreciated!
>
>
>
> 'use strict';
>
> var readline = require('readline');
> var rl = readline.createInterface({
> input: process.stdin,
> output: process.stdout,
> });
>
> class NodeF {
> constructor(f) {
> this.back = false;
> this.used = false;
> this.f = f;
> }
> }
>
> class Input {
> constructor(strings) {
> this.stringsInd = 0;
> this.strings = strings;
> }
> getString() {
> return this.strings[this.stringsInd++];
> }
> getStringArray(sep) {
> return this.getString().split(sep);
> }
> getNumber() {
> return parseInt(this.getString());
> }
> getNumberArray(sep) {
> return this.getStringArray(sep).map(a => parseInt(a));
> }
> }
>
> let permutatorMethod = (inpArr) => {
> let res = [];
> let doPermute = (array, g) => {
> if (array.length === 0) {
> res.push(g);
> }
> else {
> for (let x = 0; x < array.length; x++) {
> let current = array.slice();
> let next = current.splice(x, 1);
> doPermute(current.slice(), g.concat(next));
> }
> }
> };
> doPermute(inpArr, []);
> return res;
> };
>
> let clearTree = (nodes) => {
> nodes.forEach((node) => {
> node.used = false;
> });
> };
>
> let solve = (input) => {
> let n = input.getNumber();
> let fss = input.getNumberArray(' ');
> let pss = input.getNumberArray(' ');
> let nodes = [];
> for (let i = 0; i < fss.length; i++) {
> nodes.push(new NodeF(fss[i]));
> }
> for (let i = 0; i < pss.length; i++) {
> if (pss[i] === 0) {
> nodes[i].next = null;
> }
> else {
> nodes[i].next = nodes[pss[i] - 1];
> nodes[pss[i] - 1].back = true;
> }
> }
> let nodeInitiators = nodes.filter(x => x.back === false);
> let nodeInitiatorsPerms = permutatorMethod(nodeInitiators);
> let permsMaxes = [];
> nodeInitiatorsPerms.forEach((perm) => {
> clearTree(nodes);
> let maxSum = 0;
> perm.forEach((ni) => {
> let max = 0;
> while (ni !== null && ni.used !== true) {
> max = Math.max(ni.f, max);
> ni.used = true;
> ni = ni.next;
> }
> maxSum += max;
> });
> permsMaxes.push(maxSum);
> });
> return Math.max(...permsMaxes);
> };
>
>
> let main = (input) => {
> let _numTests = input.getNumber();
> for (let _id = 1; _id <= _numTests; ++_id) {
> console.log('Case #' + _id + ': ' + solve(input));
> }
> };
>
> function init() {
> let strings = [];
> rl.on('line', function (line) {
> strings.push(line);
> }).on('close', function () {
> main(new Input(strings));
> process.exit(0);
> });
> }
> if (!module.parent) {
> init();
> }
> //# sourceMappingURL=index.js.map
>
> --
> -- You received this message because you are subscribed to the Google
> Groups Code Jam group. To post to this group, send email to
> google-code@googlegroups.com. To unsubscribe from this group, send email
> to google-code+unsubscr...@googlegroups.com. For more options, visit this
> group at https://groups.google.com/d/forum/google-code?hl=en
> ---
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/bbff8533-ad73-4b9d-8a72-6794831df987n%40googlegroups.com
> 
> .
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
http

[code jam] Re: Google Code Jam 2022 - Chain Reactions (RE problem)

2022-04-05 Thread Samuel Jawahar

Hello please let me know some testcase to where it is failing
https://codingcompetitions.withgoogle.com/codejam/round/00876ff1/00a45ef7

On Monday, April 4, 2022 at 8:16:14 PM UTC+5:30 DarkDogg92 wrote:

> Hello everybody,
>
> I can't manage to solve the Chain Reactions problem. My solution seems to 
> work locally, passes the sample tests on site, but when it comes to the 
> real tests, I always get a runtime error.
>
> I decided to build a graph for every test case, then generate all the 
> permutations of the chain reaction initiators and traverse the graph in 
> order relevant for each permutation.
>
> I used a similar general code structure for other problems and it worked, 
> so I guess it is a problem with the solution's logic.
>
> Below is my code in JS.
> Any suggestions would be greately appreciated!
>
>
>
> 'use strict';
>
> var readline = require('readline');
> var rl = readline.createInterface({
> input: process.stdin,
> output: process.stdout,
> });
>
> class NodeF {
> constructor(f) {
> this.back = false;
> this.used = false;
> this.f = f;
> }
> }
>
> class Input {
> constructor(strings) {
> this.stringsInd = 0;
> this.strings = strings;
> }
> getString() {
> return this.strings[this.stringsInd++];
> }
> getStringArray(sep) {
> return this.getString().split(sep);
> }
> getNumber() {
> return parseInt(this.getString());
> }
> getNumberArray(sep) {
> return this.getStringArray(sep).map(a => parseInt(a));
> }
> }
>
> let permutatorMethod = (inpArr) => {
> let res = [];
> let doPermute = (array, g) => {
> if (array.length === 0) {
> res.push(g);
> }
> else {
> for (let x = 0; x < array.length; x++) {
> let current = array.slice();
> let next = current.splice(x, 1);
> doPermute(current.slice(), g.concat(next));
> }
> }
> };
> doPermute(inpArr, []);
> return res;
> };
>
> let clearTree = (nodes) => {
> nodes.forEach((node) => {
> node.used = false;
> });
> };
>
> let solve = (input) => {
> let n = input.getNumber();
> let fss = input.getNumberArray(' ');
> let pss = input.getNumberArray(' ');
> let nodes = [];
> for (let i = 0; i < fss.length; i++) {
> nodes.push(new NodeF(fss[i]));
> }
> for (let i = 0; i < pss.length; i++) {
> if (pss[i] === 0) {
> nodes[i].next = null;
> }
> else {
> nodes[i].next = nodes[pss[i] - 1];
> nodes[pss[i] - 1].back = true;
> }
> }
> let nodeInitiators = nodes.filter(x => x.back === false);
> let nodeInitiatorsPerms = permutatorMethod(nodeInitiators);
> let permsMaxes = [];
> nodeInitiatorsPerms.forEach((perm) => {
> clearTree(nodes);
> let maxSum = 0;
> perm.forEach((ni) => {
> let max = 0;
> while (ni !== null && ni.used !== true) {
> max = Math.max(ni.f, max);
> ni.used = true;
> ni = ni.next;
> }
> maxSum += max;
> });
> permsMaxes.push(maxSum);
> });
> return Math.max(...permsMaxes);
> };
>
>
> let main = (input) => {
> let _numTests = input.getNumber();
> for (let _id = 1; _id <= _numTests; ++_id) {
> console.log('Case #' + _id + ': ' + solve(input));
> }
> };
>
> function init() {
> let strings = [];
> rl.on('line', function (line) {
> strings.push(line);
> }).on('close', function () {
> main(new Input(strings));
> process.exit(0);
> });
> }
> if (!module.parent) {
> init();
> }
> //# sourceMappingURL=index.js.map
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/0068695a-9abc-4ab7-b7bf-9d5ada9d481dn%40googlegroups.com.


Re: [code jam] 2021 Round A1: Append Sort

2021-06-02 Thread Samuel Jawahar
Hello , please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of17

On Sun, 25 Apr 2021, 20:56 Benzir Ahammed Shawon, 
wrote:

> Can anyone please tell me what's wrong with this code? It's showing *RE *at
> the *Test Set 2*.
>
> import java.util.Scanner;
> import static java.lang.Math.max;
>
> public class Solution {
> public static void main(String[] args) {
> Scanner scan = new Scanner(System.in);
> int tt, n, i, index, ans = 0;
> int[] x = new int[100];
> n = scan.nextInt();
> for (tt = 1; tt <= n; tt++) {
> ans = 0;
> index = scan.nextInt();
> for (int j = 1; j <= index; j++) {
> x[j] = scan.nextInt();
> }
> for (int jj = 1; jj <= index; jj++) {
> int min = x[jj];
> int maxn = x[jj];
> while (maxn <= x[jj - 1]) {
> maxn = maxn * 10 + 9;
> min = min * 10 + 0;
> ans++;
> }
> x[jj] = max(x[jj - 1] + 1, min);
> }
> System.out.println("Case #" + tt + ": " + ans);
> }
> }
> }
>
> --
> -- You received this message because you are subscribed to the Google
> Groups Code Jam group. To post to this group, send email to
> google-code@googlegroups.com. To unsubscribe from this group, send email
> to google-code+unsubscr...@googlegroups.com. For more options, visit this
> group at https://groups.google.com/d/forum/google-code?hl=en
> ---
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/ad485df3-94ac-4c5d-a277-4fe3e503f657n%40googlegroups.com
> 
> .
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnOKkzgo3dwu5YmUtP4%2B%3D9CEtU6hHZ7n9YKZVD2eVyYXEQ%40mail.gmail.com.


Re: [code jam] Samples: passed, runtime error

2021-06-02 Thread Samuel Jawahar
Hello , please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of17
Show quoted text


On Wed, 7 Apr 2021, 01:46 Nic Moetsch,  wrote:

> Hello all,
>
> I just finished the Code Jam qualification round.
> I didn't manage to get the Reversesort Engeneering question correct,
> everytime I submitted, it returned *Samples: passed* however also a *runtime
> error*.
>
> This combination feedback really threw me off and since the Google team
> doesn't help with debugging, they didn't really answer my question via
> email. It'd be great if someone could try to explain to me what this
> combination of feedbacks means.
>
> My guess is that the code always failed on the last test case i.e.
> SamplesPassed = True after all samples were read and it failed on the last
> iteration, however since the first test set only consisted of lists size 2
> to 7 I'd be suprised if the only edge case happened in the last test case.
>
> I used Python 3.7 if that makes a difference.
>
> Thanks a lot in advance
> Nic
>
> --
> -- You received this message because you are subscribed to the Google
> Groups Code Jam group. To post to this group, send email to
> google-code@googlegroups.com. To unsubscribe from this group, send email
> to google-code+unsubscr...@googlegroups.com. For more options, visit this
> group at https://groups.google.com/d/forum/google-code?hl=en
> ---
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/dc58378f-1ad1-4919-991c-fe438ad71cedn%40googlegroups.com
> 
> .
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnOsMxxtzPoFqqvDx3xgFvedRX%3D6W6YnEDdvfiOaBiDPXw%40mail.gmail.com.


[code jam] Bsf

2021-06-02 Thread Samuel Jawahar
Hello , please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of17
Show quoted text

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnMi4H72w0Dm6%2BCRBp7Oi9cOhJ3ay59sfz-DADuyyy%3DUqA%40mail.gmail.com.


Re: [code jam] 2021 Round 1c: Closest Pick

2021-06-02 Thread Samuel Jawahar
Hello , please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of17
Show quoted text


On Mon, 3 May 2021, 19:34 sudeep.c...@gmail.com, 
wrote:

> Can someone please help me with what is wrong with my solution?
> The idea is to either pick a interval from start till the first smallest
> value (suppose if smallest is 3, then we can have win for 1 and 2 by
> picking 2), largest value to K (suppose if largest is 7 and k is 10, then
> we can have win for 8,9 and 10 by picking 8) as well as other possibilites
> which will be in between intervals (like [3, 7]--> pick 4, then win for
> 4,5).
>
> import java.io.BufferedReader;
> import java.io.IOException;
> import java.io.InputStreamReader;
> import java.io.PrintWriter;
> import java.util.ArrayList;
> import java.util.Arrays;
> import java.util.Collections;
> import java.util.List;
>
> public class Solution {
> public static void main(String[] args) throws IOException {
> BufferedReader br = new BufferedReader(
> new InputStreamReader(System.in));
> int t = Integer.parseInt(br.readLine());
> PrintWriter out = new PrintWriter(System.out);
> StringBuilder str = new StringBuilder("");
> for(int h=1;h<=t;h++)
> {
> str.append("Case #"+h+": ");
> String[] in = br.readLine().trim().split(" ");
> int n = Integer.parseInt(in[0]);
> long k = Long.parseLong(in[1]);
> long arr[] = new long[n];
> in = br.readLine().trim().split(" ");
> for(int i=0;i arr[i]=Long.parseLong(in[i]);
> }
> List diff = new ArrayList<>();
> Arrays.sort(arr);
> for(int i=1;i long d = arr[i]-arr[i-1];
> if(d>0){
> d--;
> }
> diff.add(d);
> }
> Double p = new Double(0);
> Collections.sort(diff);
>
> List ans = new ArrayList<>();
> ans.add(k - arr[n-1]);
> ans.add(arr[0]-1);
> for(int j = diff.size()-1;j>=Math.max(0, diff.size()-2);j--){
> ans.add((diff.get(j)+1) / 2);
> }
> Collections.sort(ans);
> p += ans.get(ans.size()-1);
> p+=ans.get(ans.size()-2);
> str.append(p/(double)k+"\n");
> }
> out.print(str);
> out.flush();
> br.close();
> }
> }
>
> --
> -- You received this message because you are subscribed to the Google
> Groups Code Jam group. To post to this group, send email to
> google-code@googlegroups.com. To unsubscribe from this group, send email
> to google-code+unsubscr...@googlegroups.com. For more options, visit this
> group at https://groups.google.com/d/forum/google-code?hl=en
> ---
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/cba4b486-e06a-4d73-9908-ca61677ae6e3n%40googlegroups.com
> 
> .
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnP_1rrhVrHq_ufQaC1DEVSZGrnBtGJBcNJocQj1hBebeQ%40mail.gmail.com.


Re: [code jam] 2021 Round 1c: Closest Pick

2021-05-31 Thread Samuel Jawahar
Hello , please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of17

On Mon, 3 May 2021, 19:34 sudeep.c...@gmail.com, 
wrote:

> Can someone please help me with what is wrong with my solution?
> The idea is to either pick a interval from start till the first smallest
> value (suppose if smallest is 3, then we can have win for 1 and 2 by
> picking 2), largest value to K (suppose if largest is 7 and k is 10, then
> we can have win for 8,9 and 10 by picking 8) as well as other possibilites
> which will be in between intervals (like [3, 7]--> pick 4, then win for
> 4,5).
>
> import java.io.BufferedReader;
> import java.io.IOException;
> import java.io.InputStreamReader;
> import java.io.PrintWriter;
> import java.util.ArrayList;
> import java.util.Arrays;
> import java.util.Collections;
> import java.util.List;
>
> public class Solution {
> public static void main(String[] args) throws IOException {
> BufferedReader br = new BufferedReader(
> new InputStreamReader(System.in));
> int t = Integer.parseInt(br.readLine());
> PrintWriter out = new PrintWriter(System.out);
> StringBuilder str = new StringBuilder("");
> for(int h=1;h<=t;h++)
> {
> str.append("Case #"+h+": ");
> String[] in = br.readLine().trim().split(" ");
> int n = Integer.parseInt(in[0]);
> long k = Long.parseLong(in[1]);
> long arr[] = new long[n];
> in = br.readLine().trim().split(" ");
> for(int i=0;i arr[i]=Long.parseLong(in[i]);
> }
> List diff = new ArrayList<>();
> Arrays.sort(arr);
> for(int i=1;i long d = arr[i]-arr[i-1];
> if(d>0){
> d--;
> }
> diff.add(d);
> }
> Double p = new Double(0);
> Collections.sort(diff);
>
> List ans = new ArrayList<>();
> ans.add(k - arr[n-1]);
> ans.add(arr[0]-1);
> for(int j = diff.size()-1;j>=Math.max(0, diff.size()-2);j--){
> ans.add((diff.get(j)+1) / 2);
> }
> Collections.sort(ans);
> p += ans.get(ans.size()-1);
> p+=ans.get(ans.size()-2);
> str.append(p/(double)k+"\n");
> }
> out.print(str);
> out.flush();
> br.close();
> }
> }
>
> --
> -- You received this message because you are subscribed to the Google
> Groups Code Jam group. To post to this group, send email to
> google-code@googlegroups.com. To unsubscribe from this group, send email
> to google-code+unsubscr...@googlegroups.com. For more options, visit this
> group at https://groups.google.com/d/forum/google-code?hl=en
> ---
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/cba4b486-e06a-4d73-9908-ca61677ae6e3n%40googlegroups.com
> 
> .
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnMdXSSqcCysqhOmOfs0v8K%2BwNW3f9magVDXdqy-STAWew%40mail.gmail.com.


[code jam] Re: [gcj] [JAVA]Google Kick Start C - Stable Wall

2021-05-31 Thread Samuel Jawahar
Hello , please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of17

On Wed, 19 Aug 2020, 19:45 Quentin,  wrote:

> Hello all,
>
> I am trying to solve the Stable Wall problem but I got a WA even for the
> first use case but I don't know why ?
> I tried multiple use case and all is ok on my side but not ok on the
> Judgment engine.
>
> Here is my code :
>
>
>
>
> import java.util.ArrayList;
> import java.util.Arrays;
> import java.util.Collections;
> import java.util.HashSet;
> import java.util.Iterator;
> import java.util.LinkedHashSet;
> import java.util.LinkedList;
> import java.util.List;
> import java.util.Scanner;
> import java.util.Set;
> import java.util.stream.Collectors;
>
>
> public class Solution {
>
>
>
>
>  static Solution sol = new Solution();
>
>
>  public static void main(String[] args) {
>  Scanner scann = new Scanner(System.in);  // Create a Scanner object
>  int T = scann.nextInt();
>
>
>  for(int usease = 0; usease< T;usease++) {
>  boolean hasSolution = false;
>  int R = scann.nextInt();
>  int C = scann.nextInt();
>  LinkedHashSet solution = new LinkedHashSet<>();
>  Set allPolyominos = new HashSet<>();
>
>  List> table = new ArrayList<>();
>
>  for(int i = 0;i < R ;i++) {
>  List currentLine = Arrays.asList(scann.next().split(""));
>  table.add(currentLine);
>  allPolyominos.addAll(currentLine.stream().collect(Collectors.toSet()));
>  if(i>0) {//If not the first line
>  List previousLine = table.get(i-1);
>  for(int j = 0 ; j < C ; j++) {
>  if(!currentLine.get(j).contentEquals(previousLine.get(j))) {//Check each
> cell of the current line with the previous from top to bottom and if
> different add the previous line Polyominos
>  solution.add(previousLine.get(j));
>  }
>  }
>  }
>  }
>
>  if(allPolyominos.size()!=solution.size()) {//There is a solution if all
> Polyominos are not in the solution list, meaning a Polyominos reach the
> bottom of the Wall
>  allPolyominos.removeAll(solution);
>  solution.addAll(allPolyominos);
>  hasSolution= true;
>  }
>
>
>  //Format the answer
>  Iterator iterator = solution.iterator();
>  StringBuilder sb = new StringBuilder();
>  while(iterator.hasNext()) {
>  sb.append(iterator.next());
>  }
>
>
>
>  if(hasSolution)
>  System.out.println(String.format("Case #%s: %s",usease+1,sb.reverse().
> toString()));
>  else
>  System.out.println(String.format("Case #%s: -1",usease+1));
>
>
>  }
>
>
>
>
>  }
>
>
>
> }
>
>
> If you see any mistakes, thx.
> Regards
>
> Quentin
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/72f769a6-7fcc-4399-b87f-3c59199245aao%40googlegroups.com
> 
> .
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnPA4faDfybGi%3D_B%3Dj_J47KbdQjR0Jp9KMyaFOeYqL9%3Dhw%40mail.gmail.com.


[code jam] Re: [gcj] Google Kickstart round E question 1

2021-05-31 Thread Samuel Jawahar
Hello Tanisha,
please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of17

On Wed, 26 Aug 2020, 02:24 Tanisha Chaudhary, 
wrote:

> My code works just fine but google is still showing a wrong answer. Please
> help me out.
> Here's my code:
>
> no_of_inputs=int(input())
> for i in range(no_of_inputs):
> n = int(input())
> A = []
> A = list(map(int,input().strip().split()))[:n]
> ct =[]
> lt = []
> for j in range(1,len(A)-1):
> if((A[j]-A[j-1])==(A[j+1]-A[j])):
> if(lt == []):
> lt.append(A[j-1])
> lt.append(A[j])
> lt.append(A[j+1])
> else:
> lt.append(A[j+1])
> else:
> ct.append(len(lt))
> lt = []
> ct.append(len(lt))
> print("Case #{}:".format(i+1),max(ct))
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/9599e362-b4ff-4751-beb8-99cedc114f92n%40googlegroups.com
> 
> .
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnN0_Hxiq13v88eNitBVYhKYKcadsud32LmZY%2BDpDWG9zA%40mail.gmail.com.


Re: [code jam] Code Jam Round 2 — less than 24 hours!

2021-05-30 Thread Samuel Jawahar
Hello every one,
Please help me where it is failing
Please review my code please

 please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of17

On Fri, 14 May 2021, 19:55 'Chelsea Lieb' via Google Code Jam, <
google-code@googlegroups.com> wrote:

> Hi everyone,
>
> Congratulations to those who have qualified for Round 2, and we hope the
> rest of you can follow along at g.co/codejam.
>
> Here's what those competing need to know before the round:
>
>-
>
>Round 2 will take place on May 15 from 14:00 UTC to 16:30 UTC. The top
>1000 contestants in Round 2 will advance to Round 3 and win a
>limited-edition Code Jam t-shirt.
>-
>
>Results are not immediately finalized after the round. Official
>advancement emails will be sent out at least one day prior to the next
>round.
>-
>
>Refer to the Code Jam Schedule
> to view
>upcoming round details, view rounds in your time zone, and add them
>directly to your calendar.
>
> Reminder:
>
>-
>
>Collaboration is strictly prohibited in Round 2 and all future rounds
>of Code Jam 2021. Section 7 of the Terms
>
>prohibits sharing or using from others any information about a problem
>before the end of the round. Such actions that violate those Terms &
>Conditions will result in your disqualification. Moreover, please note
>that if you are utilizing a web integrated development environment (IDE),
>be sure to not publish your code or otherwise allow it to be publicly
>visible during the contest, or you could be subject to disqualification.
>
> Please review the FAQ
>  before the round.
> If you experience issues or have questions while competing, please contact
> us using "Ask a Question" for the fastest response.
>
> See you on the scoreboard and good luck!
>
> Chelsea, from the Code Jam Team
>
> --
> -- You received this message because you are subscribed to the Google
> Groups Code Jam group. To post to this group, send email to
> google-code@googlegroups.com. To unsubscribe from this group, send email
> to google-code+unsubscr...@googlegroups.com. For more options, visit this
> group at https://groups.google.com/d/forum/google-code?hl=en
> ---
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/1a9c6c23-e773-407f-b2f3-3bda5e899194n%40googlegroups.com
> 
> .
>

-- 
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
google-code@googlegroups.com. To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnP_L%2BMzYLcKg3AnPUOWqbzycHGb6pdR%2BR_ptuwbSs7kiQ%40mail.gmail.com.


Re: [gcj] C++, Parenting Partnering Returns, Qualification Round 2020. Help to find out the cause for fault!!!

2020-05-12 Thread Samuel Jawahar
Hello sir,
for this input  you mentioned ,the first 2 activities 1 2 and 1 5,are
overlapping how we can assign these two for different kids
Regards
Samuel

On Mon, Apr 27, 2020 at 9:10 PM porker2008  wrote:

> Hey jawa,
>
> You need to process all activities based on the start time.
> If you greedily assign activity in the given order, you will fail the
> following input
>
> Sample Input
> *1*
> *4*
> *1 2*
> *1 5*
> *5 6*
> *2 6*
>
> Expected output:
> *Case #1: CJJC*
>
> However, your solution answers *IMPOSSIBLE*
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/ec715f74-54dc-4a00-9a7a-350848da3dd5%40googlegroups.com
> 
> .
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnOHMccm8FRp%3DqORe4k4FJatOdtRZQBXCEoyr4jXELpS2A%40mail.gmail.com.


Re: [gcj] C++, Parenting Partnering Returns, Qualification Round 2020. Help to find out the cause for fault!!!

2020-05-12 Thread Samuel Jawahar
Thanks a lot sir

On Mon, Apr 27, 2020 at 9:10 PM porker2008  wrote:

> Hey jawa,
>
> You need to process all activities based on the start time.
> If you greedily assign activity in the given order, you will fail the
> following input
>
> Sample Input
> *1*
> *4*
> *1 2*
> *1 5*
> *5 6*
> *2 6*
>
> Expected output:
> *Case #1: CJJC*
>
> However, your solution answers *IMPOSSIBLE*
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/ec715f74-54dc-4a00-9a7a-350848da3dd5%40googlegroups.com
> 
> .
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnMCYPHzGWDbunxPoD69W80Q5%2BBhT1FPhamh38MMSHoUjg%40mail.gmail.com.


Re: [gcj] C++, Parenting Partnering Returns, Qualification Round 2020. Help to find out the cause for fault!!!

2020-04-25 Thread Samuel Jawahar
Hello,  i also faced same problem
Can you please review my code
User name:figlet

On Tue, 7 Apr 2020, 6:14 am Olena Lizina,  wrote:

> Hi all,
>
> I didn't pass the Qualification Round 2020 because stuck with Parenting
> Partnering Returns.
> My solution passes the Sample test cases, but failed on the first Test Set.
>
> I wrote unit tests and tried different data sets to test my code, but the
> Google System didn't accept it.
> Today I checked solutions of others. Found an interesting solution and
> tried to find out what did I miss.
> Found nothing :-(
>
> Can anybody help my to find some corner cases that I missed?
> Please!
>
> #include 
> #include 
> #include 
>
> using namespace std;
>
> class Activity
> {
> public:
>Activity(const int startTime, const int endTime)
>   : m_startTime{startTime}
>   , m_endTime{endTime}
>{
>}
>
>bool overlaps(const Activity& other) const
>{
>   bool result {true};
>   if (m_startTime > other.m_startTime)
>   {
>  result = m_startTime < other.m_endTime;
>   }
>   else
>   {
>  result = other.m_startTime < m_endTime;
>   }
>   return result;
>}
>
>int m_startTime;
>int m_endTime;
> };
>
> class Schedule
> {
> public:
>void addActivity(const Activity& activity)
>{
>   m_activities.push_back(activity);
>}
>
>void sortActivities()
>{
>   std::sort(m_activities.begin(), m_activities.end(), [](Activity lhs,
> Activity rhs)
> {
>return lhs.m_startTime < rhs.m_startTime;
> });
>}
>
>std::string getSchedule()
>{
>   std::string res;
>
>   std::vector Jamies;
>   std::vector Camerons;
>
>   for (size_t i = 0; i < m_activities.size(); ++i)
>   {
>  auto& currActivity = m_activities.at(i);
>  if (Jamies.cend() == std::find_if(Jamies.cbegin(), Jamies.cend(),
> [&currActivity](const Activity& activity)
>{
>   return activity.overlaps(
> currActivity);
>}))
>  {
> Jamies.push_back(currActivity);
> res += "J";
>  }
>  else if (Camerons.cend() == std::find_if(Camerons.cbegin(),
> Camerons.cend(), [&currActivity](const Activity& activity)
>   {
>  return activity.
> overlaps(currActivity);
>   }))
>  {
> Camerons.push_back(currActivity);
> res += "C";
>  }
>  else
>  {
> res = "IMPOSSIBLE";
> break;
>  }
>   }
>   return res;
>}
> private:
>std::vector m_activities;
> };
>
> void assert(const std::string& func, const bool validate)
> {
>if (validate)
>{
>   std::cout << func << ": OK" << std::endl;
>}
>else
>{
>   std::cout << func << ": NOK" << std::endl;
>}
> }
>
> void testActivity()
> {
>{
>   Activity lhs(0, 1);
>   Activity rhs(0, 1);
>   assert(__FUNCTION__, lhs.overlaps(rhs));
>   assert(__FUNCTION__, rhs.overlaps(lhs));
>}
>{
>   Activity lhs(0, 10);
>   Activity rhs(0, 1);
>   assert(__FUNCTION__, lhs.overlaps(rhs));
>   assert(__FUNCTION__, rhs.overlaps(lhs));
>}
>{
>   Activity lhs(0, 10);
>   Activity rhs(3, 10);
>   assert(__FUNCTION__, lhs.overlaps(rhs));
>   assert(__FUNCTION__, rhs.overlaps(lhs));
>}
>{
>   Activity lhs(0, 10);
>   Activity rhs(10, 15);
>   assert(__FUNCTION__, !lhs.overlaps(rhs));
>   assert(__FUNCTION__, !rhs.overlaps(lhs));
>}
>{
>   Activity lhs(0, 10);
>   Activity rhs(11, 15);
>   assert(__FUNCTION__, !lhs.overlaps(rhs));
>   assert(__FUNCTION__, !rhs.overlaps(lhs));
>}
>{
>   Activity lhs(15, 20);
>   Activity rhs(10, 15);
>   assert(__FUNCTION__, !lhs.overlaps(rhs));
>   assert(__FUNCTION__, !rhs.overlaps(lhs));
>}
> }
>
> void testSchedule()
> {
>{
>   Schedule today;
>   today.addActivity(Activity{360, 480});
>   today.addActivity(Activity{420, 540});
>   today.addActivity(Activity{600, 660});
>   assert(__FUNCTION__, (today.getSchedule() == "JCJ"));
>}
>{
>   Schedule today;
>   today.addActivity(Activity{0, 1440});
>   today.addActivity(Activity{1, 3});
>   today.addActivity(Activity{2, 4});
>   assert(__FUNCTION__, (today.getSchedule() == "IMPOSSIBLE"));
>}
>{
>   Schedule today;
>   today.addActivity(Activity{99, 150});
>   today.addActivity(Activity{1, 100});
>   today.addActivity(Activity{100, 301});
>   today.addActivity(Activity{2, 5});
>   today.addActivity(Activity{150, 250});
>   assert(__FUNCTION__, (today.getSchedule() == "JCCJJ"));
>   

[gcj] Re: Parenting Partnering Returns Question

2020-04-07 Thread samuel jawahar
Hello sir,please let me know  for which test case it is failing
please review my code
Regards
Samuel




===
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Solution {
private static boolean isOverLapping(ArrayList activityList, 
Activity activity) {
int len = activityList.size();
Activity aux = null;
for (int i = 0; i < len; i++) {
aux = activityList.get(i);
if ((aux.s == activity.s) && (aux.e == activity.e)) {
return true;
}

if ((aux.s <= activity.s) && (aux.e >= activity.e)) {
return true;
}

if ((aux.s <= activity.s) && (aux.e >= activity.e)) {
return true;
}
if ((activity.s <= aux.s) && (activity.e >= aux.e)) {
return true;
}
if (aux.s < activity.s) {
if (aux.e > activity.s) {
return true;
}
}
if (activity.s < aux.s) {
if (activity.e > aux.s) {
return true;
}
}
}
return false;
}

public static void main(String[] args) {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new 
InputStreamReader(System.in));
try {
int t = Integer.parseInt(br.readLine());
int n = 0, s = 0, e = 0;
String data[] = null;
StringBuilder result = new StringBuilder();
ArrayList cameron = new ArrayList();
ArrayList jamie = new ArrayList();
for (int i = 1; i <= t; i++) {
cameron.clear();
jamie.clear();
n = Integer.parseInt(br.readLine());
result = result.delete(0, result.capacity());
for (int j = 0; j < n; j++) {
if (result.toString().trim().equals("IMPOSSIBLE")) {
String aux = br.readLine();
continue;
}
data = br.readLine().split(" ");
s = Integer.parseInt(data[0]);
e = Integer.parseInt(data[1]);
Activity activity = new Activity(s, e);

if (!isOverLapping(cameron, activity)) {
cameron.add(activity);
result.append("C");
} else {
if (!isOverLapping(jamie, activity)) {
jamie.add(activity);
result.append("J");
} else {
result = result.delete(0, result.capacity());
result.append("IMPOSSIBLE");
}
}
}
System.out.println("Case #" + i + ": " + result.toString());
result = result.delete(0, result.capacity());
cameron.clear();
jamie.clear();
}

} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}

class Activity {
int s = 0, e = 0;

Activity(int s, int e) {
this.s = s;
this.e = e;
}

public String toString() {
return s + ":" + e;
}
}

-- 
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 google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/55eff5c9-2fe9-489d-b050-b007a909b63f%40googlegroups.com.


Re: [gcj] Parenting Partnering Returns

2020-04-07 Thread Samuel Jawahar
Hello Sir can you please review my Code?


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Solution {
private static boolean isOverLapping(ArrayList activityList, 
Activity activity) {
int len = activityList.size();
Activity aux = null;
for (int i = 0; i < len; i++) {
aux = activityList.get(i);
if ((aux.s == activity.s) && (aux.e == activity.e)) {
return true;
}

if ((aux.s <= activity.s) && (aux.e >= activity.e)) {
return true;
}

if ((aux.s <= activity.s) && (aux.e >= activity.e)) {
return true;
}
if ((activity.s <= aux.s) && (activity.e >= aux.e)) {
return true;
}
if (aux.s < activity.s) {
if (aux.e > activity.s) {
return true;
}
}
if (activity.s < aux.s) {
if (activity.e > aux.s) {
return true;
}
}
}
return false;
}

public static void main(String[] args) {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
int t = Integer.parseInt(br.readLine());
int n = 0, s = 0, e = 0;
String data[] = null;
StringBuilder result = new StringBuilder();
ArrayList cameron = new ArrayList();
ArrayList jamie = new ArrayList();
for (int i = 1; i <= t; i++) {
cameron.clear();
jamie.clear();
n = Integer.parseInt(br.readLine());
result = result.delete(0, result.capacity());
for (int j = 0; j < n; j++) {
if (result.toString().trim().equals("IMPOSSIBLE")) {
String aux = br.readLine();
continue;
}
data = br.readLine().split(" ");
s = Integer.parseInt(data[0]);
e = Integer.parseInt(data[1]);
Activity activity = new Activity(s, e);

if (!isOverLapping(cameron, activity)) {
cameron.add(activity);
result.append("C");
} else {
if (!isOverLapping(jamie, activity)) {
jamie.add(activity);
result.append("J");
} else {
result = result.delete(0, result.capacity());
result.append("IMPOSSIBLE");
}
}
}
System.out.println("Case #" + i + ": " + result.toString());
result = result.delete(0, result.capacity());
cameron.clear();
jamie.clear();
}

} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}

class Activity {
int s = 0, e = 0;

Activity(int s, int e) {
this.s = s;
this.e = e;
}

public String toString() {
return s + ":" + e;
}
}
==


On Tuesday, April 7, 2020 at 6:36:10 AM UTC+5:30 xli...@gmail.com wrote:

> I hope its help,
>
> from functools import reduce
>
> class Solver(object):
> def __init__(self):
> super().__init__()
>
> def find_distribution(self, intervals):
> _intervals = list(intervals)
> intervals.sort(key=lambda x: x[0])
>
> mp = {}
> J = 0
> C = 0
> for e in intervals:
> tp = (e[0], e[1])
> if tp not in mp:
> mp[tp] = [0]
> if J <= e[0]:
> J = e[1]
> mp[tp].append('J')
> mp[tp][0] += 1
> elif C <= e[0]:
> C = e[1]
> mp[tp].append('C')
> mp[tp][0] += 1
> else:
> return 'IMPOSSIBLE' 
>
> sq = ''
> for e in _intervals:
> tp = (e[0], e[1])
> sq += mp[tp][mp[tp][0]]
> mp[tp][0] -= 1
> return sq
>
> def main():
> solver = Solver()
> T = int(input())
> for t in range(T):
> n = int(input())
> intervals = []
> for _ in range(n):
> intervals.append([int(e) for e in input().split()])
> print('Case #%d: %s' % (t + 1, 
> solver.find_distribution(intervals))) 
> return 0
>
> if __name__ == "__main__":
> main()
>
> On Apr 4, 2020, at 11:54, Martin Seeler  wrote:
>
> I'm asking to keep my sanity: Did anyone solve this problem with Python?
> I can't find these tricky edge cases where my code fails, all variations I 
> try on my machine seem to work just fine. Still CodeJam Environment says 
> *WA*. 
>
> If there is someone who solved it in python, then I know I'm missing some 
> cases. Otherwise I start to question the environment :D
>
> Thanks and have a nice day everyone
>
> -- 
> 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 google-code...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/google-code/d7192abb-1170-491e-9ad4-ac0d8f7978c7%40googlegroups.com
>  
> 
> .
>
>
>

-- 
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 google-code+unsubscr...@googl

Re: [gcj] fair fight

2019-05-04 Thread Samuel Jawahar
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

class Solution {
static int c[] = null, d[] = null;

public static void solve() {

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

int t = 0, n = 0, k = 0;
String data[] = null;
try {
result = 0;
t = Integer.parseInt(br.readLine());
for (int i = 1; i <= t; i++) {
data = br.readLine().split(" ");
n = Integer.parseInt(data[0]);
k = Integer.parseInt(data[1]);
c = new int[n];
d = new int[n];
data = br.readLine().split(" ");
for (int j = 0; j < n; j++) {
c[j] = Integer.parseInt(data[j]);
}
data = br.readLine().split(" ");
for (int j = 0; j < n; j++) {
d[j] = Integer.parseInt(data[j]);
}

Pair aux = new Pair();
aux.l = 0;
aux.r = n;
ArrayList clist = new ArrayList();
clist.add(aux);

aux = new Pair();
aux.l = 0;
aux.r = n;
ArrayList dlist = new ArrayList();
dlist.add(aux);
processWar(clist, k, n);
System.out.println("Case #" + i + ": " + result);
result = 0;
}

} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

static int result = 0;

public static void main(String[] args) {
solve();
}

public static void processWar(ArrayList cswards, int k, int n) {
int len = 0;
int clen = cswards.size();
int start = 0, end = 0;
Pair csward = null, auxC = null, auxP = null;
ArrayList cswards2 = new ArrayList<>();
ArrayList cloactions = new ArrayList();
ArrayList dloactions = new ArrayList();
int cCnt = 0, dCnt = 0;
for (int i = 0; i < clen; i++) {
csward = cswards.get(i);
cloactions.clear();
dloactions.clear();
cCnt = getMaxCnt_C(csward.l, csward.r, cloactions);
dCnt = getMaxCnt_D(csward.l, csward.r, dloactions);

if ((Math.abs(cCnt - dCnt)) <= k) {
result += (cloactions.size() * dloactions.size());
}
cloactions.retainAll(dloactions);
if(cloactions.size()==0) {
cloactions=dloactions;
}
start = csward.l;
end = csward.r;
len = cloactions.size();
if (len == 0) {
continue;
}
int j = 0;
auxP = null;
if (start == cloactions.get(0)) {
start++;
j++;
} else {
auxP = auxC = new Pair();
auxC.l = start;
auxC.r = cloactions.get(0);
start = cloactions.get(0) + 1;
cswards2.add(auxC);
j++;
}
for (; j < len; j++) {
if (cloactions.get(j) - cloactions.get(j - 1) == 1) {
start = cloactions.get(j) + 1;
continue;
}
if (start < cloactions.get(j) - 1) {
auxC = new Pair();
auxC.l = start;
auxC.r = cloactions.get(j);
start = cloactions.get(j) + 1;
if (auxP == null) {
auxP = auxC;
cswards2.add(auxC);
} else {
if (auxP.r == auxC.l) {
auxP.r = auxC.r;
} else {
cswards2.add(auxC);
}
}

}
}

if (!(start == csward.l && end == csward.r) && (cloactions.get(len - 1) + 1
< end)) {
if (start != end && start < end) {
auxC = new Pair();
auxC.l = start;
auxC.r = end;
cswards2.add(auxC);
}
}

}
if (cswards2.size() == 0) {
return;
}
processWar(cswards2, k, n);
}

public static int getMaxCnt_C(int l, int u, ArrayList locations) {
int max = 0;
for (int i = l; i < u; i++) {
if (max < c[i]) {
locations.clear();
max = c[i];
locations.add(i);
continue;
}
if (max == c[i]) {
locations.add(i);
}
}
return max;
}

public static int getMaxCnt_D(int l, int u, ArrayList locations) {
int max = 0;
for (int i = l; i < u; i++) {
if (max < d[i]) {
locations.clear();
max = d[i];
locations.add(i);
continue;
}
if (max == d[i]) {
locations.add(i);
}
}
return max;
}
}

class Pair {
int l = 0, r = 0;

public String toString() {
return l + "," + r;
}
}


On Sat, May 4, 2019 at 9:28 AM samuel jawahar 
wrote:

> Hello sir,please review my code,help me for which test case it is failing
>
> ---
> import java.io.BufferedReader;
> import java.io.IOException;
> import java.io.InputStreamReader;
> import java.util.ArrayList;
>
> class Solution {
> static int c[] = null, d[] = null;
>
> public static void solve() {
>
> BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
>
> int t = 0, n = 0, k = 0;
> String data[] = null;
> try {
> result = 0;
> t = Integer.parseInt(br.readLine());
> for (int i = 1; i <= t; i++) {
> data = br.readLine().split(" ");
> n = Integer.parseInt(data[0]);
> k = Integer.parseInt(data[1]);
> c = new int[n];
> d = new int[n];
> data = br.readLine().split(" ");
> for (int j = 0; j < n; j++) {
> c[j] = Integer.parseInt(data[j]);
> }
> data = br.readLine().split(" ");
> for (int j = 0; j < n; j++) {
> d[j] = Integer.parseInt(data[j]);
> }
>
> Pair aux = new Pair();
> aux.l = 0;
> aux.r = n;
> ArrayList clist = new ArrayList();
> clist.add(aux);
>
> aux = new Pair();
> aux

[gcj] fair fight

2019-05-03 Thread samuel jawahar
Hello sir,please review my code,help me for which test case it is failing
---
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

class Solution {
static int c[] = null, d[] = null;

public static void solve() {

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

int t = 0, n = 0, k = 0;
String data[] = null;
try {
result = 0;
t = Integer.parseInt(br.readLine());
for (int i = 1; i <= t; i++) {
data = br.readLine().split(" ");
n = Integer.parseInt(data[0]);
k = Integer.parseInt(data[1]);
c = new int[n];
d = new int[n];
data = br.readLine().split(" ");
for (int j = 0; j < n; j++) {
c[j] = Integer.parseInt(data[j]);
}
data = br.readLine().split(" ");
for (int j = 0; j < n; j++) {
d[j] = Integer.parseInt(data[j]);
}

Pair aux = new Pair();
aux.l = 0;
aux.r = n;
ArrayList clist = new ArrayList();
clist.add(aux);

aux = new Pair();
aux.l = 0;
aux.r = n;
ArrayList dlist = new ArrayList();
dlist.add(aux);
processWar(clist, k, n);
System.out.println("Case #" + i + ": " + result);
result = 0;
}

} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

static int result = 0;

public static void main(String[] args) {
solve();
}

public static void processWar(ArrayList cswards, int k, int n) {
int len = 0;
int clen = cswards.size();
int start = 0, end = 0;
Pair csward = null, auxC = null, auxP = null;
ArrayList cswards2 = new ArrayList<>();
ArrayList cloactions = new ArrayList();
ArrayList dloactions = new ArrayList();
int cCnt = 0, dCnt = 0;
for (int i = 0; i < clen; i++) {
csward = cswards.get(i);
cloactions.clear();
dloactions.clear();
cCnt = getMaxCnt_C(csward.l, csward.r, cloactions);
dCnt = getMaxCnt_D(csward.l, csward.r, dloactions);

if ((Math.abs(cCnt - dCnt)) <= k) {
result += (cloactions.size() * dloactions.size());
} else {
cloactions = dloactions;
}
start = csward.l;
end = csward.r;
len = cloactions.size();
if (len == 0) {
continue;
}
int j = 0;
auxP = null;
if (start == cloactions.get(0)) {
start++;
j++;
} else {
auxP = auxC = new Pair();
auxC.l = start;
auxC.r = cloactions.get(0);
start = cloactions.get(0)+1;
cswards2.add(auxC);
j++;
}
for (; j < len; j++) {
if (cloactions.get(j) - cloactions.get(j - 1) == 1) {
start=cloactions.get(j)+1;
continue;
}
if (start < cloactions.get(j) - 1) {
auxC = new Pair();
auxC.l = start;
auxC.r = cloactions.get(j);
start = cloactions.get(j) + 1;
if (auxP == null) {
auxP = auxC;
cswards2.add(auxC);
} else {
if (auxP.r == auxC.l) {
auxP.r = auxC.r;
} else {
cswards2.add(auxC);
}
}

}
}

if (!(start == csward.l && end == csward.r) && (cloactions.get(len - 1) + 1
< end)) {
if (start != end && start < end) {
auxC = new Pair();
auxC.l = start;
if (end != n) {
end++;
}
auxC.r = end;
cswards2.add(auxC);
}
}

}
if (cswards2.size() == 0) {
return;
}
processWar(cswards2, k, n);
}

public static int getMaxCnt_C(int l, int u, ArrayList locations) {
int max = 0;
for (int i = l; i < u; i++) {
if (max < c[i]) {
locations.clear();
max = c[i];
locations.add(i);
continue;
}
if (max == c[i]) {
locations.add(i);
}
}
return max;
}

public static int getMaxCnt_D(int l, int u, ArrayList locations) {
int max = 0;
for (int i = l; i < u; i++) {
if (max < d[i]) {
locations.clear();
max = d[i];
locations.add(i);
continue;
}
if (max == d[i]) {
locations.add(i);
}
}
return max;
}
}

class Pair {
int l = 0, r = 0;

public String toString() {
return l + "," + r;
}
}

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAN7RGWZv1hG6bQpKiGUGOO-vCZFAgO1uT8OrNufCzPUoB_P4UA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[gcj] fair faight

2019-05-03 Thread Samuel Jawahar
Hello please verify my approach ,please let me know for which test case it
is failing

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

class Solution {
static int c[] = null, d[] = null;

public static void solve() {

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

int t = 0, n = 0, k = 0;
String data[] = null;
try {
result = 0;
t = Integer.parseInt(br.readLine());
for (int i = 1; i <= t; i++) {
data = br.readLine().split(" ");
n = Integer.parseInt(data[0]);
k = Integer.parseInt(data[1]);
c = new int[n];
d = new int[n];
data = br.readLine().split(" ");
for (int j = 0; j < n; j++) {
c[j] = Integer.parseInt(data[j]);
}
data = br.readLine().split(" ");
for (int j = 0; j < n; j++) {
d[j] = Integer.parseInt(data[j]);
}

Pair aux = new Pair();
aux.l = 0;
aux.r = n;
ArrayList clist = new ArrayList();
clist.add(aux);

aux = new Pair();
aux.l = 0;
aux.r = n;
ArrayList dlist = new ArrayList();
dlist.add(aux);
processWar(clist, k, n);
System.out.println("Case #" + i + ": " + result);
result = 0;
}

} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

static int result = 0;

public static void main(String[] args) {
solve();
}

public static void processWar(ArrayList cswards, int k, int n) {
int len = 0;
int clen = cswards.size();
int start = 0, end = 0;
Pair csward = null, auxC = null, auxP = null;
ArrayList cswards2 = new ArrayList<>();
ArrayList cloactions = new ArrayList();
ArrayList dloactions = new ArrayList();
int cCnt = 0, dCnt = 0;
for (int i = 0; i < clen; i++) {
csward = cswards.get(i);
cloactions.clear();
dloactions.clear();
cCnt = getMaxCnt_C(csward.l, csward.r, cloactions);
dCnt = getMaxCnt_D(csward.l, csward.r, dloactions);

if ((Math.abs(cCnt - dCnt)) <= k) {
result += (cloactions.size() * dloactions.size());
} else {
cloactions = dloactions;
}
start = csward.l;
end = csward.r;
len = cloactions.size();
if (len == 0) {
continue;
}
int j = 0;
auxP = null;
if (start == cloactions.get(0)) {
start++;
j++;
} else {
auxP = auxC = new Pair();
auxC.l = start;
auxC.r = cloactions.get(0);
start = cloactions.get(0)+1;
cswards2.add(auxC);
j++;
}
for (; j < len; j++) {
if (cloactions.get(j) - cloactions.get(j - 1) == 1) {
continue;
}
if (start < cloactions.get(j) - 1) {
auxC = new Pair();
auxC.l = start;
auxC.r = cloactions.get(j);
start = cloactions.get(j) + 1;
if (auxP == null) {
auxP = auxC;
cswards2.add(auxC);
} else {
if (auxP.r == auxC.l) {
auxP.r = auxC.r;
} else {
cswards2.add(auxC);
}
}

}
}

if (!(start == csward.l && end == csward.r) && (cloactions.get(len - 1) + 1
< end)) {
if (start != end && start < end) {
auxC = new Pair();
auxC.l = start;
if (end != n) {
end++;
}
auxC.r = end;
cswards2.add(auxC);
}
}

}
if (cswards2.size() == 0) {
return;
}
processWar(cswards2, k, n);
}

public static int getMaxCnt_C(int l, int u, ArrayList locations) {
int max = 0;
for (int i = l; i < u; i++) {
if (max < c[i]) {
locations.clear();
max = c[i];
locations.add(i);
continue;
}
if (max == c[i]) {
locations.add(i);
}
}
return max;
}

public static int getMaxCnt_D(int l, int u, ArrayList locations) {
int max = 0;
for (int i = l; i < u; i++) {
if (max < d[i]) {
locations.clear();
max = d[i];
locations.add(i);
continue;
}
if (max == d[i]) {
locations.add(i);
}
}
return max;
}
}

class Pair {
int l = 0, r = 0;

public String toString() {
return l + "," + r;
}
}

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnMqqz-tmPB1kT82qm9qvPWiwyvjT4TLd4Dbo2qfFdWEmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gcj] language flags update

2019-04-12 Thread Samuel Jawahar
Hello Sir ,i am not able to open the dashboard
Regards
Samuel

On Sat, Apr 13, 2019 at 4:03 AM 'Pablo Heiber' via Google Code Jam <
google-code@googlegroups.com> wrote:

> Hi Everyone,
>
> We have updated the way we compile and/or run code in several languages to
> address some of the feedback from the Qualification Round and our own
> findings. Please check out the updated version of the "For each supported
> language, what version, libraries, and compilation and execution lines does
> the platform use?" question in the Coding section of the FAQ
> .
>
> Hope to see you soon in Round 1 A!
>
> Best,
> Pablo
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CANa5jcCs%2BXKt6L%3Dmr6Y5p0i6Vj5D5On05pvPb%2B%3DF0gdMYUw88Q%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnPBchFzLLMskHCjV6az19uACOPyw-pJTQK9Bj5ccp_6pA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gcj] Round 1A

2019-04-08 Thread Samuel Jawahar
Hello,how  to know points?only through mail we will come to know?
Regards
Samuel

On Mon, Apr 8, 2019 at 9:26 PM  wrote:

> I have earned required 30 points to be qualified for the next round, but
> the "Schedule" section does not show me a tick under the "Qualified" part.
> Do you have the same issue, guys?
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/35c23eaf-2171-4144-a810-87964f77f8b6%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnNb3ksJoU_a7EAv5ObfYryAXxwQhj_MK7VrPk6Zz%2BXJMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[gcj] relative or absolute error

2019-04-08 Thread Samuel Jawahar
Hello,what is the measning of "Answers with a relative or absolute error of
at most 10-6 will be considered correct."
https://code.google.com/codejam/contest/32013/dashboard#s=p2

Regards
Samuel

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnM4VvLNwRZ_es59MA5TSA9%2B6%3D8ZmhrUFPQ%2Bq9ricjz9%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[gcj] good book for restricted permutatons

2019-02-25 Thread Samuel Jawahar
Hello all ,please help me to solve this problem
https://stackoverflow.com/questions/11382189/number-of-ways-to-place-kings-on-chess-board
suggest me to books required to solve this type of problem
Regards
Samuel

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnPzqWbeyLBgZRp%2BZ%2BgA17RCv6RZaBVQxS9N9tzp1%2Br4Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-05-02 Thread Samuel Jawahar
Thanks a lot sir,5*round(100/6) is not valid?,in case1 it is

On Wed, May 2, 2018, 17:39 Joseph DeVincentis  wrote:

> 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
> due to the initial condition indicating three people chose the same
> language.
>
> On Wed, May 2, 2018 at 7:14 AM Samuel Jawahar 
> wrote:
>
>> In Sample Case #3, one optimal scenario is as follows: each of the
>> remaining two people chooses an unchosen language, so the rounded
>> percentages add up to 50 + 17 + 17 + 17 = 101.
>>
>> if 5 people chooses same language and one person chooses different one
>> then the result=102
>> 5*17+17=102
>> Regards
>> Samuel
>>
>>
>> On Wed, May 2, 2018 at 4:43 PM, Samuel Jawahar 
>> wrote:
>>
>>> In Sample Case #3, one optimal scenario is as follows: each of the
>>> remaining two people chooses an unchosen language, so the rounded
>>> percentages add up to 50 + 17 + 17 + 17 = 101.
>>>
>>> if 5 people chooses same language and one person chooses different one
>>> then the result=102
>>>
>>> Regards
>>> Samuel
>>>
>>> On Wed, May 2, 2018 at 3:23 PM, Samuel Jawahar 
>>> wrote:
>>>
>>>> Hello Sir,
>>>> Rounding Error:-
>>>> My understanding is we need to maximize the sum of n values of 100/n,if
>>>> it is below 100%
>>>> please let me know ,my understanding is correct or not
>>>> Regards
>>>> Samuel
>>>>
>>>>
>>>>
>>>> On Mon, Apr 30, 2018 at 8:33 AM, Si  wrote:
>>>>
>>>>> Hi, I think I test all the cases but I still get WA in set1. I really
>>>>> wish to know why.
>>>>>
>>>>> My idea is to use an array from 0~N to represent the number of
>>>>> language with i votes
>>>>> Ex, [ 1, 1, 3] => [0, 2, 0, 1]  where there are two 1 vote language
>>>>> and a 3 votes language
>>>>> And use backtracking algorithm to solve it.
>>>>>
>>>>> -
>>>>> import math
>>>>> class Solution:
>>>>>   def __init__(self, N, nums):
>>>>> self.N = N
>>>>> self.best = 0
>>>>> self.records = {}
>>>>> self.nums = [0] * (N + 1)
>>>>>
>>>>> # use array to track the number of  language with n votes
>>>>> count = 0
>>>>> for n in nums:
>>>>>   count += n
>>>>>   self.nums[n] += 1
>>>>>
>>>>> self.chosen(self.nums, count)
>>>>>
>>>>>   def cal(self, nums):
>>>>> total = 0
>>>>> for i in range(1, self.N + 1):
>>>>>   if nums[i] == 0:
>>>>> continue
>>>>>
>>>>>   total += nums[i] * round((100 * i) / self.N)
>>>>> return total
>>>>>
>>>>>   def chosen(self, nums, count):
>>>>> tp = tuple(nums)
>>>>>
>>>>> if tp in self.records:
>>>>>   return
>>>>> else:
>>>>>   self.records[tp] = True
>>>>>
>>>>> # stop when count is N
>>>>> if count >= self.N:
>>>>>   total = self.cal(nums)
>>>>>   if total > self.best:
>>>>> self.best = total
>>>>>   return
>>>>>
>>>>> for k in range(1, self.N + 1):
>>>>>   if nums[k] == 0:
>>>>> continue
>>>>>
>>>>>   # add one to a language with k votes
>>>>>   nums[k + 1] += 1
>>>>>   nums[k] -= 1
>>>>>   self.chosen(nums, count + 1)
>>>>>   nums[k + 1] -= 1
>>>>>   nums[k] += 1
>>>>>
>>>>> # add a new language
>>>>> nums[1] += 1
>>>>> self.chosen(nums, count + 1)
>>>>> nums[1] -= 1
>>>>>
>>>>> cases = int(input())
>>>>> for T in range(1, cases + 1):
>>>>>   N, X = [int(s) for s in input().split(' 

Re: [gcj] Why didn't my solution for Rounding Error in Round 1B 2018 pass the hidden test set?

2018-05-02 Thread Samuel Jawahar
 In Sample Case #3, one optimal scenario is as follows: each of the
remaining two people chooses an unchosen language, so the rounded
percentages add up to 50 + 17 + 17 + 17 = 101.

if 5 people chooses same language and one person chooses different one
then the result=102
5*17+17=102
Regards


On Wed, May 2, 2018 at 3:49 AM, Xiongqi ZHANG 
wrote:

> while num * 100 / N - int(num * 100 / N) < 0.5:
> num += 1
>
> This is too slow for large input. Instead you can calculate the least
> number to get a round up.
>
>
>1. for T in range(int(input())):
>2. N, L = list(map(int, input().split()))
>3. C = list(map(int, input().split()))
>4.
>5. if 100 % N != 0:
>6. remaining = N - sum(C)
>7. counts = C + [0 for i in range(remaining)]
>8.
>9. least = 0
>10. while least * 100 / N - int(least * 100 / N) < 0.5:
>11. least += 1
>12. needed = []
>13. for cnt in counts:
>14. if cnt <= least:
>15. needed.append(least - cnt)
>16. else:
>17. num = cnt
>18. while num * 100 / N - int(num * 100 / N) < 0.5:
>19. num += 1
>20. needed.append(num - cnt)
>21.
>22. needed, counts = list(map(list, zip(*sorted(zip(needed, counts)
>23.
>24. for i in range(len(counts)):
>25. if needed[i] <= remaining:
>26. counts[i] += needed[i]
>27. remaining -= needed[i]
>28. counts[-1] += remaining
>29.
>30. result = []
>31. for cnt in counts:
>32. percentage = cnt * 100 / N
>33. if percentage - int(percentage) < 0.5:
>34. result.append(int(percentage))
>35. else:
>36. result.append(int(percentage) + 1)
>37.
>38. print('Case #' + str(T + 1) + ': ' + str(sum(result)))
>39.
>40. else:
>41. print('Case #' + str(T + 1) + ': 100')
>
>
> Arti Schmidt 于2018年5月1日周二 下午1:41写道:
>
>> My solution passed both visible test sets, but I got a
>> "TIME_LIMIT_EXCEEDED" error on the hidden one. As far as I can tell, I did
>> exactly what was described to solve test set 3 in the analysis. What did I
>> do wrong?
>>
>> (Python 3)
>>
>> for T in range(int(input())):
>> N, L = list(map(int, input().split()))
>> C = list(map(int, input().split()))
>>
>> if 100 % N != 0:
>> remaining = N - sum(C)
>> counts = C + [0 for i in range(remaining)]
>>
>> needed = []
>> for cnt in counts:
>> num = cnt
>> while num * 100 / N - int(num * 100 / N) < 0.5:
>> num += 1
>> needed.append(num - cnt)
>>
>> needed, counts = list(map(list, zip(*sorted(zip(needed,
>> counts)
>>
>> for i in range(len(counts)):
>> if needed[i] <= remaining:
>> counts[i] += needed[i]
>> remaining -= needed[i]
>> counts[-1] += remaining
>>
>> result = []
>> for cnt in counts:
>> percentage = cnt * 100 / N
>> if percentage - int(percentage) < 0.5:
>> result.append(int(percentage))
>> else:
>> result.append(int(percentage) + 1)
>>
>> print('Case #' + str(T + 1) + ': ' + str(sum(result)))
>>
>> else:
>> print('Case #' + str(T + 1) + ': 100')
>>
>> --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/google-code/c7efd9ae-a678-476d-b579-e64bf35c6514%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-code/CAGDEU-%2BX6-%3DbtSAyjD%3Dc2KnE3NU2xa_
> U8CmmLqhrhmtqLRGLkg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnPjJx5Aq783sutRk3aj_UxJ_MATNh9fh8MnPyKUQxxtSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-05-02 Thread Samuel Jawahar
 In Sample Case #3, one optimal scenario is as follows: each of the
remaining two people chooses an unchosen language, so the rounded
percentages add up to 50 + 17 + 17 + 17 = 101.

if 5 people chooses same language and one person chooses different one
then the result=102
5*17+17=102
Regards
Samuel


On Wed, May 2, 2018 at 4:43 PM, Samuel Jawahar  wrote:

> In Sample Case #3, one optimal scenario is as follows: each of the
> remaining two people chooses an unchosen language, so the rounded
> percentages add up to 50 + 17 + 17 + 17 = 101.
>
> if 5 people chooses same language and one person chooses different one
> then the result=102
>
> Regards
> Samuel
>
> On Wed, May 2, 2018 at 3:23 PM, Samuel Jawahar 
> wrote:
>
>> Hello Sir,
>> Rounding Error:-
>> My understanding is we need to maximize the sum of n values of 100/n,if
>> it is below 100%
>> please let me know ,my understanding is correct or not
>> Regards
>> Samuel
>>
>>
>>
>> On Mon, Apr 30, 2018 at 8:33 AM, Si  wrote:
>>
>>> Hi, I think I test all the cases but I still get WA in set1. I really
>>> wish to know why.
>>>
>>> My idea is to use an array from 0~N to represent the number of language
>>> with i votes
>>> Ex, [ 1, 1, 3] => [0, 2, 0, 1]  where there are two 1 vote language and
>>> a 3 votes language
>>> And use backtracking algorithm to solve it.
>>>
>>> -
>>> import math
>>> class Solution:
>>>   def __init__(self, N, nums):
>>> self.N = N
>>> self.best = 0
>>> self.records = {}
>>> self.nums = [0] * (N + 1)
>>>
>>> # use array to track the number of  language with n votes
>>> count = 0
>>> for n in nums:
>>>   count += n
>>>   self.nums[n] += 1
>>>
>>> self.chosen(self.nums, count)
>>>
>>>   def cal(self, nums):
>>> total = 0
>>> for i in range(1, self.N + 1):
>>>   if nums[i] == 0:
>>> continue
>>>
>>>   total += nums[i] * round((100 * i) / self.N)
>>> return total
>>>
>>>   def chosen(self, nums, count):
>>> tp = tuple(nums)
>>>
>>> if tp in self.records:
>>>   return
>>> else:
>>>   self.records[tp] = True
>>>
>>> # stop when count is N
>>> if count >= self.N:
>>>   total = self.cal(nums)
>>>   if total > self.best:
>>> self.best = total
>>>   return
>>>
>>> for k in range(1, self.N + 1):
>>>   if nums[k] == 0:
>>> continue
>>>
>>>   # add one to a language with k votes
>>>   nums[k + 1] += 1
>>>   nums[k] -= 1
>>>   self.chosen(nums, count + 1)
>>>   nums[k + 1] -= 1
>>>   nums[k] += 1
>>>
>>> # add a new language
>>> nums[1] += 1
>>> self.chosen(nums, count + 1)
>>> nums[1] -= 1
>>>
>>> cases = int(input())
>>> for T in range(1, cases + 1):
>>>   N, X = [int(s) for s in input().split(' ')]
>>>   nums = [int(s) for s in input().split(' ')]
>>>   solution = Solution(N, nums)
>>>   print('Case #%d: %d' % (T, solution.best))
>>> 
>>>
>>> --
>>> 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 google-code+unsubscr...@googlegroups.com.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/google-code/66eb6217-cc8d-43d1-a5a3-70627bca70eb%40googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnNi4RKPFxrR9EhbE7tDEfmuO%2BJMP3S7WGj6jMvyaiMF%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-05-02 Thread Samuel Jawahar
 In Sample Case #3, one optimal scenario is as follows: each of the
remaining two people chooses an unchosen language, so the rounded
percentages add up to 50 + 17 + 17 + 17 = 101.

if 5 people chooses same language and one person chooses different one
then the result=102

Regards
Samuel

On Wed, May 2, 2018 at 3:23 PM, Samuel Jawahar  wrote:

> Hello Sir,
> Rounding Error:-
> My understanding is we need to maximize the sum of n values of 100/n,if it
> is below 100%
> please let me know ,my understanding is correct or not
> Regards
> Samuel
>
>
>
> On Mon, Apr 30, 2018 at 8:33 AM, Si  wrote:
>
>> Hi, I think I test all the cases but I still get WA in set1. I really
>> wish to know why.
>>
>> My idea is to use an array from 0~N to represent the number of language
>> with i votes
>> Ex, [ 1, 1, 3] => [0, 2, 0, 1]  where there are two 1 vote language and a
>> 3 votes language
>> And use backtracking algorithm to solve it.
>>
>> -
>> import math
>> class Solution:
>>   def __init__(self, N, nums):
>> self.N = N
>> self.best = 0
>> self.records = {}
>> self.nums = [0] * (N + 1)
>>
>> # use array to track the number of  language with n votes
>> count = 0
>> for n in nums:
>>   count += n
>>   self.nums[n] += 1
>>
>> self.chosen(self.nums, count)
>>
>>   def cal(self, nums):
>> total = 0
>> for i in range(1, self.N + 1):
>>   if nums[i] == 0:
>> continue
>>
>>   total += nums[i] * round((100 * i) / self.N)
>> return total
>>
>>   def chosen(self, nums, count):
>> tp = tuple(nums)
>>
>> if tp in self.records:
>>   return
>> else:
>>   self.records[tp] = True
>>
>> # stop when count is N
>> if count >= self.N:
>>   total = self.cal(nums)
>>   if total > self.best:
>> self.best = total
>>   return
>>
>> for k in range(1, self.N + 1):
>>   if nums[k] == 0:
>> continue
>>
>>   # add one to a language with k votes
>>   nums[k + 1] += 1
>>   nums[k] -= 1
>>   self.chosen(nums, count + 1)
>>   nums[k + 1] -= 1
>>   nums[k] += 1
>>
>> # add a new language
>> nums[1] += 1
>> self.chosen(nums, count + 1)
>> nums[1] -= 1
>>
>> cases = int(input())
>> for T in range(1, cases + 1):
>>   N, X = [int(s) for s in input().split(' ')]
>>   nums = [int(s) for s in input().split(' ')]
>>   solution = Solution(N, nums)
>>   print('Case #%d: %d' % (T, solution.best))
>> 
>>
>> --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/google-code/66eb6217-cc8d-43d1-a5a3-70627bca70eb%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnO7T6xJDaJeGHP4V%2BJ-U7McqeK_r0JiOQkULDJC%3DeNCaw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-05-02 Thread Samuel Jawahar
Hello Sir,
Rounding Error:-
My understanding is we need to maximize the sum of n values of 100/n,if it
is below 100%
please let me know ,my understanding is correct or not
Regards
Samuel



On Mon, Apr 30, 2018 at 8:33 AM, Si  wrote:

> Hi, I think I test all the cases but I still get WA in set1. I really wish
> to know why.
>
> My idea is to use an array from 0~N to represent the number of language
> with i votes
> Ex, [ 1, 1, 3] => [0, 2, 0, 1]  where there are two 1 vote language and a
> 3 votes language
> And use backtracking algorithm to solve it.
>
> -
> import math
> class Solution:
>   def __init__(self, N, nums):
> self.N = N
> self.best = 0
> self.records = {}
> self.nums = [0] * (N + 1)
>
> # use array to track the number of  language with n votes
> count = 0
> for n in nums:
>   count += n
>   self.nums[n] += 1
>
> self.chosen(self.nums, count)
>
>   def cal(self, nums):
> total = 0
> for i in range(1, self.N + 1):
>   if nums[i] == 0:
> continue
>
>   total += nums[i] * round((100 * i) / self.N)
> return total
>
>   def chosen(self, nums, count):
> tp = tuple(nums)
>
> if tp in self.records:
>   return
> else:
>   self.records[tp] = True
>
> # stop when count is N
> if count >= self.N:
>   total = self.cal(nums)
>   if total > self.best:
> self.best = total
>   return
>
> for k in range(1, self.N + 1):
>   if nums[k] == 0:
> continue
>
>   # add one to a language with k votes
>   nums[k + 1] += 1
>   nums[k] -= 1
>   self.chosen(nums, count + 1)
>   nums[k + 1] -= 1
>   nums[k] += 1
>
> # add a new language
> nums[1] += 1
> self.chosen(nums, count + 1)
> nums[1] -= 1
>
> cases = int(input())
> for T in range(1, cases + 1):
>   N, X = [int(s) for s in input().split(' ')]
>   nums = [int(s) for s in input().split(' ')]
>   solution = Solution(N, nums)
>   print('Case #%d: %d' % (T, solution.best))
> 
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-code/66eb6217-cc8d-43d1-a5a3-70627bca70eb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnPCGD6YTXxPO5hKQs5QcaW-gkcZ8bNE5ALPoOZ2Vgcg%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gcj] The Qual Round is over!

2018-04-08 Thread Samuel Jawahar
You can know by the icon they disply,if it ? And displying NOT this
message"testing skiped"

On Mon, Apr 9, 2018, 01:13 Felix Voituret  wrote:

> Well the real difference here is that you do not know if the time limit
> was respected for the hidden dataset (previously large). So you really has
> to ensure required points from visible one that you can control unless you
> estimate correctly time complexity regarding dataset limits.
>
> Envoyé de mon iPhone
>
> > Le 8 avr. 2018 à 20:29, newbie007  a écrit :
> >
> > Usually in the qualification round the first two problems are simple and
> with no tricks.
> >
> > I got A and B correct for the small data sets, so I assumed it was fine.
> >
> > But then wrong for A large and time exceed for B large. Oo
> >
> > Probably I was too careless, but I think CodeJam missed the
> qualification round purpose this year.
> >
> > --
> > 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 google-code+unsubscr...@googlegroups.com.
> > To post to this group, send email to google-code@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/1c05cf0e-d772-4b96-879c-b61535bd9145%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/04C481DF-7DFB-4A75-9A85-C2DFF300CE09%40gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnPLzWV2LFKqXgNeSDz8WjKM2vT62e2yfbpNsFm7dgiB9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gcj] Finding another competitor on the score board?

2018-04-08 Thread Samuel Jawahar
Oh really great sir

On Mon, Apr 9, 2018, 01:57 Bartholomew Furrow  wrote:

> Right now I work at home, and my employers are both under the age of 6. :-)
>
> On Sun, Apr 8, 2018 at 1:01 PM Samuel Jawahar 
> wrote:
>
>> Thanks a lot sir,where are you working
>>
>> On Sun, Apr 8, 2018, 21:33 Bartholomew Furrow  wrote:
>>
>>> Hey Samuel! I answered you in chat as well, but in case anyone else is
>>> wondering:
>>>
>>> I totally understand the concern. A couple of things about that: I don't
>>> work at Google anymore, so I'm the wrong person to ask to make a change.
>>>
>>> I can tell you about why we made the decision originally though. It
>>> boils down to this: we chose the time we thought most competitors could
>>> compete. Late Saturday night is a better time than late Sunday night for
>>> people who have to work on Monday. That's an issue for Japan, NZ, and other
>>> places close to the date line on the west. I remember other considerations
>>> -- I know it wasn't a perfect solution for holy days, for example, since
>>> Shabbat (Saturday) is a holy day in Judaism -- but I think that was the
>>> major one.
>>>
>>> Please bear in mind that I don't work at Google anymore, so if I've said
>>> something incorrect or impolitic then please don't blame them. :-)
>>>
>>> Bartholomew
>>>
>>> On Sat, Apr 7, 2018 at 8:50 PM Samuel Jawahar 
>>> wrote:
>>>
>>>> Hello sir,so many people have to work on Saturday too,if possible
>>>> please give heigher priority to Sunday to conduct exam
>>>> Regards
>>>> Samuel
>>>>
>>>> On Sun, Apr 8, 2018, 08:06 Bartholomew Furrow  wrote:
>>>>
>>>>> It's missing for now, though either Pablo or Ian mentioned that it's
>>>>> on their list of things to add. I'm guessing things that impact the
>>>>> competition more directly will come first.
>>>>>
>>>>> On Sat, Apr 7, 2018 at 7:45 AM meir  wrote:
>>>>>
>>>>>> I seem unable to find a way to look up another player in the
>>>>>> scoreboard.
>>>>>> I used to do this, to track both real life friends and other notable
>>>>>> competitors I become aware of.
>>>>>> Is this feature missing from current incarnation? or am I just not
>>>>>> seeing it?
>>>>>>
>>>>>> --
>>>>>> 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 google-code+unsubscr...@googlegroups.com.
>>>>>> To post to this group, send email to google-code@googlegroups.com.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/google-code/62442b26-f763-404b-88c0-818291b50941%40googlegroups.com
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> --
>>>>> 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 google-code+unsubscr...@googlegroups.com.
>>>>> To post to this group, send email to google-code@googlegroups.com.
>>>>>
>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/google-code/CAHaiWHP36m6DR7wz3P42pbcA4NaWOjoNOmXGEyp21V28%3DXuaNg%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/google-code/CAHaiWHP36m6DR7wz3P42pbcA4NaWOjoNOmXGEyp21V28%3DXuaNg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>
>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>>> 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 google-code+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to google-code@googlegroups.com.
>>>> To view this discussion on the web visit
>>&

Re: [gcj] Finding another competitor on the score board?

2018-04-08 Thread Samuel Jawahar
Thanks a lot sir,where are you working

On Sun, Apr 8, 2018, 21:33 Bartholomew Furrow  wrote:

> Hey Samuel! I answered you in chat as well, but in case anyone else is
> wondering:
>
> I totally understand the concern. A couple of things about that: I don't
> work at Google anymore, so I'm the wrong person to ask to make a change.
>
> I can tell you about why we made the decision originally though. It boils
> down to this: we chose the time we thought most competitors could compete.
> Late Saturday night is a better time than late Sunday night for people who
> have to work on Monday. That's an issue for Japan, NZ, and other places
> close to the date line on the west. I remember other considerations -- I
> know it wasn't a perfect solution for holy days, for example, since Shabbat
> (Saturday) is a holy day in Judaism -- but I think that was the major one.
>
> Please bear in mind that I don't work at Google anymore, so if I've said
> something incorrect or impolitic then please don't blame them. :-)
>
> Bartholomew
>
> On Sat, Apr 7, 2018 at 8:50 PM Samuel Jawahar 
> wrote:
>
>> Hello sir,so many people have to work on Saturday too,if possible please
>> give heigher priority to Sunday to conduct exam
>> Regards
>> Samuel
>>
>> On Sun, Apr 8, 2018, 08:06 Bartholomew Furrow  wrote:
>>
>>> It's missing for now, though either Pablo or Ian mentioned that it's on
>>> their list of things to add. I'm guessing things that impact the
>>> competition more directly will come first.
>>>
>>> On Sat, Apr 7, 2018 at 7:45 AM meir  wrote:
>>>
>>>> I seem unable to find a way to look up another player in the scoreboard.
>>>> I used to do this, to track both real life friends and other notable
>>>> competitors I become aware of.
>>>> Is this feature missing from current incarnation? or am I just not
>>>> seeing it?
>>>>
>>>> --
>>>> 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 google-code+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to google-code@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/google-code/62442b26-f763-404b-88c0-818291b50941%40googlegroups.com
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> 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 google-code+unsubscr...@googlegroups.com.
>>> To post to this group, send email to google-code@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/google-code/CAHaiWHP36m6DR7wz3P42pbcA4NaWOjoNOmXGEyp21V28%3DXuaNg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/google-code/CAHaiWHP36m6DR7wz3P42pbcA4NaWOjoNOmXGEyp21V28%3DXuaNg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>
>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-code/CAH5vfnMj5sfhnhc3bOrrFHjbf-JhfvEim-Zdyx5rPeUhraC-3Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/google-code/CAH5vfnMj5sfhnhc3bOrrFHjbf-JhfvEim-Zdyx5rPeUhraC-3Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CAHaiWHPQsDzAHFcvQjT_91KXi6b6zxpGqbmjijLYGzz2HDdxmw%40mail.gmail.com
> <ht

Re: [gcj] A problem ocurred. try again later. But then the solutions appear in submissions

2018-04-08 Thread Samuel Jawahar
it was very slow yesterday

On Sat, Apr 7, 2018 at 8:07 PM, newbie007  wrote:

> after some minutes the solutions are in submissions, even though it says a
> "problem occurred"
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-code/128da8e3-6fc4-4cc1-8fbc-99ae3b660974%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnNXsqVkNxL28AvKvu8oyvSJpjPEoC19pfj-MNOpkYocMw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gcj] Finding another competitor on the score board?

2018-04-07 Thread Samuel Jawahar
Hello sir,so many people have to work on Saturday too,if possible please
give heigher priority to Sunday to conduct exam
Regards
Samuel

On Sun, Apr 8, 2018, 08:06 Bartholomew Furrow  wrote:

> It's missing for now, though either Pablo or Ian mentioned that it's on
> their list of things to add. I'm guessing things that impact the
> competition more directly will come first.
>
> On Sat, Apr 7, 2018 at 7:45 AM meir  wrote:
>
>> I seem unable to find a way to look up another player in the scoreboard.
>> I used to do this, to track both real life friends and other notable
>> competitors I become aware of.
>> Is this feature missing from current incarnation? or am I just not seeing
>> it?
>>
>> --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-code/62442b26-f763-404b-88c0-818291b50941%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CAHaiWHP36m6DR7wz3P42pbcA4NaWOjoNOmXGEyp21V28%3DXuaNg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnMj5sfhnhc3bOrrFHjbf-JhfvEim-Zdyx5rPeUhraC-3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gcj] Square Fields - Google Code Jam

2015-02-03 Thread Samuel Jawahar
Hello,for some problems java will not give correct results
even Algorithm is correct
example
even for small n's it is not working
is it because of java mod function?
example:
my codecheff id:jawa2code
my Algo:
http://discuss.codechef.com/questions/58496/seagcd-editorial

my code:
http://www.codechef.com/viewsolution/5569341
regards

On Wed, Jan 28, 2015 at 7:09 PM, Luke Pebody  wrote:

> The crux of this solution is in the recursive function Rec. I have
> rewritten this with easier to read variable names and with commenting at
>
> http://ideone.com/TNrdFO
>
> Essentially it recursively goes through all ways of separating these into
> at most k sets, finds the minimum square size needed for each way and then
> outputs the best one it has found.
>
>
> On Wed, Jan 28, 2015 at 12:31 PM, sujit  wrote:
>
>> Hi,
>>
>> I am not able to understand the solution of Square Fields problem.
>>
>> Problem - https://code.google.com/codejam/contest/32004/dashboard#s=p1
>>
>> Can you please explain below given solution for this problem (in detail)?
>>
>>
>> --
>> Solution -
>>
>> --
>>
>> #define _CRT_SECURE_NO_DEPRECATE
>> #include 
>> #include 
>> #include 
>> using namespace std;
>>
>> int N,kk,n,res,j;
>> int x[100],y[100];
>> int mnx[100],mny[100],mxx[100],mxy[100];
>>
>>
>> void inline Rec(int i, int k, int sz)
>> {
>>
>> if (k<=kk && sz<=res)
>> {
>> if (i==n)
>> {
>> res=min(res,sz);
>> }
>> else
>> {
>> for (int j=0; j<=k; ++j)
>> {
>> int omnx=mnx[j],omny=mny[j],omxx=mxx[j],omxy=mxy[j];
>> mnx[j]=min(mnx[j],x[i]);
>> mny[j]=min(mny[j],y[i]);
>> mxx[j]=max(mxx[j],x[i]);
>> mxy[j]=max(mxy[j],y[i]);
>>
>> Rec(i+1,max(k,j+1),max(sz,max(mxx[j]-mnx[j],mxy[j]-mny[j])));
>> mnx[j]=omnx,mny[j]=omny,mxx[j]=omxx,mxy[j]=omxy;
>>
>> }
>> }
>> }
>> }
>>
>> int main()
>> {
>> #ifndef ONLINE_JUDGE
>> freopen("B-small-attempt0.in", "r", stdin);
>> freopen("output.txt", "w", stdout);
>> #endif
>> scanf("%d",&N);
>> for (int ii=0; ii> {
>> scanf("%d%d",&n,&kk);
>> for (int i=0; i> scanf("%d%d",&x[i],&y[i]);
>> for (int i=0; i<100; ++i)
>> mnx[i] = mny[i] = 100,
>> mxx[i] = mxy[i] = -100;
>> res=100;
>> Rec(0,0,0);
>> printf("Case #%d: %d\n",ii+1,res);
>> }
>> return 0;
>> }
>>
>> 
>>
>> Thanks,
>> Sujit
>>
>> --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-code/72ca9ae5-d9c9-4fab-b879-39539de73fae%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CAECKw-NZUixBRnnWdLLUAJVgnchYBGXF8b03h2xbNQRsXGEiPw%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnPG%3Dr-BEJz%2Bh2O3b%3DkPLTCDZ%3D1oOFL0b6DaF-gGh6vjjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[gcj] is Java works?

2015-01-31 Thread samuel jawahar
Hello,for some problems java will not give correct results
even Algorithm is correct
example
even for small n's it is not working
is it because of java mod function?
example:
my codecheff id:jawa2code
my Algo:
http://discuss.codechef.com/questions/58496/seagcd-editorial

my code:
http://www.codechef.com/viewsolution/5569341
regards
Samuel

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/e019c275-95fa-4958-89e2-26858a40e129%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gcj] Proposed 2015 Code Jam Schedule

2015-01-30 Thread Samuel Jawahar
Hello,is it possible to conduct the test on week days only,instead of
weekends
Regards
Samuel

On Fri, Oct 10, 2014 at 11:57 PM, 'Google Code Jam' via Google Code Jam <
google-code@googlegroups.com> wrote:

> Hi All,
>
> We're close to announcing the 2015 Code Jam schedule! But we want your
> feedback first. Here is the proposed schedule.
>
> DescriptionDurationTime (UTC)DateRegistration Opens1 month20:00Tuesday,
> March 3rdQualification Round27 hr23:00Friday, April 3rdQualification
> Round Ends | Reg Closesn/a3:00Saturday, April 4thRound 1A2 hr 30 
> min1:00Saturday,
> April 18thRound 1B2 hr 30 min16:00Saturday, May 2ndRound 1C2 hr 30 
> min9:00Sunday,
> May 17thRound 22 hr 30 min14:00Saturday, June 6thRound 32 hr 30 
> min14:00Saturday,
> June 20thOnsite Finals4 hrsTBDFriday, August 21st
>
> We did our best to avoid any overlap with other major programming
> competitions and holidays. If you know of any serious conflicts that will
> affect a significant number of contestants *please reply to this email by
> October 17th.*
>
> Thanks!
> The Google Code Jam Team
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CAORzay%3DeUO28a14U5_spvjK_VbSsGix2%3DAD9_qqmj1MTo64fDw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnPhQpm%3DJ%3Dca6jR-g%3D1_6gNMvr20r-SEGtvbCOpd6D0h3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[gcj] Good books for counting

2014-04-23 Thread Samuel Jawahar
Hello,can anyone please help tell me the Good book for counting
Regards
Samuel


On Tue, Apr 22, 2014 at 12:51 AM, Luke Pebody  wrote:

> I do not agree with the sentiments expressed in this email. In general,
> for early rounds, there is a significantly easier "brute force" algorithm
> that will solve small cases but not large ones. You need a significantly
> more complicated algorithm to solve the large cases than the small ones. In
> general.
>
>
> On Mon, Apr 21, 2014 at 6:55 PM, AYAN  wrote:
>
>> Solving large data set problems just requires variables(data types) with
>> larger rangesex. Using double instead of float variable.
>> All of these depend on the constraints provided for the variables in the
>> problem...
>> Except for the data types everything else is generally same.
>>
>> --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-code/e6728395-8aa0-47f9-9002-9150604add4c%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CAECKw-Ok8ofrVw47m48U7HBKofH1ozKoXkuXWs3cYE8Cwo9xWg%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnPZBr%2B0M48OjiKEVkRGhg_2aiGp14usnuKXW3Gn5kNngg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[gcj] good book for counting problems

2014-04-18 Thread Samuel Jawahar
Hello all can you please let me know good books for
"Counting the restricted combinations"
Regards
Samuel

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH5vfnPhrHwn533SauX_m5Hu2Qjn%3Dz3k-Pbb5Xax_Do9HWCftg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gcj] Dynamic programming book

2013-05-06 Thread Samuel Jawahar
Thanks a lot Archit,


On Tue, May 7, 2013 at 12:12 AM, Archit Goel  wrote:

> I am not an expert, but if you want to practice and improve your dp start
> participating and practicing on Topcoder.
> Maximum of the Div 2 1000 pointers and Div 1 250 pointers are dynamic
> programming problems.
> You can browse through the problem 
> archive<http://community.topcoder.com/tc?module=ProblemArchive&sr=&er=&sc=&sd=&class=&cat=Dynamic+Programming&div1l=&div2l=&mind1s=&mind2s=&maxd1s=&maxd2s=&wr=>for
>  selecting the dp problems. And if you get stuck or need help, the
> editorials are always there.
>
>
>
> On Mon, May 6, 2013 at 10:57 PM, Samuel Jawahar wrote:
>
>> Hello DP experts can you please suggest good book for DP
>> Regards
>> Samuel
>>
>> --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>  --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[gcj] Dynamic programming book

2013-05-06 Thread Samuel Jawahar
Hello DP experts can you please suggest good book for DP
Regards
Samuel

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [gcj] Dynamic programming book

2013-04-30 Thread Samuel Jawahar
Thanks a lot to all for guiding me
Regards
Samuel


On Thu, Apr 25, 2013 at 10:55 AM, Nitin Kumar  wrote:

> http://www.cs.berkeley.edu/~vazirani/algorithms.html .
>
> This book is also good. It's chapter on DP is freely available
>
> http://www.cs.berkeley.edu/~vazirani/algorithms/chap6.pdf.
>
>
> On Thu, Apr 25, 2013 at 10:11 AM, ayman bs  wrote:
>
>> How familiar are you with the topic?
>>
>>
>> On Thu, Apr 25, 2013 at 12:26 AM, Vincent Dirie wrote:
>>
>>> Introduction to Algorithms
>>>
>>> this has an extensive introduction to Dynamic programming. here is the
>>> link
>>>
>>> http://www.amazon.com/Introduction-Algorithms-Thomas-H-Cormen/dp/0262033844/ref=pd_sim_b_6/191-4382951-9705247
>>>
>>>
>>> On Wed, Apr 24, 2013 at 6:50 PM, Samuel Jawahar wrote:
>>>
>>>> Hello i need good DP book,please let me know which one is good
>>>> regards
>>>> Samuel
>>>>
>>>> --
>>>> 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 google-code+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to google-code@googlegroups.com.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>  --
>>> 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 google-code+unsubscr...@googlegroups.com.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> Nitin Kumar
> Software Development Engineer
> Amazon.com, India
>
>  --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[gcj] Is it possible to attend the different time zone?

2013-04-29 Thread Samuel Jawahar


-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [gcj] Re: Bull's Eye - Large

2013-04-28 Thread Samuel Jawahar
int a=2*r+1;
int d=4;
double d=-(2*a-d)+Math.sqrt((2*a-d)*(2*a-d)+8*d*k);
int dinominator=2*d;
int result=d/dinominator;
answer is result


On Sun, Apr 28, 2013 at 7:35 AM, bas <366a...@gmail.com> wrote:

> The result of that formula is very large, so there is a possibility
> that it will not fit into a 64-bit integer.
> The first comparison uses 'double' type to check if this number is too
> large. If it is, it is certainly bigger than t. If it is not, more
> precise integer computations can be used (second comparison).
> I guess 1.5 is just a large enough number to be safe.
>
> I personally used 'unsigned long long' instead, and that was enough to
> avoid dealing with floating point calculations.
>
> --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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

2013-04-28 Thread Samuel Jawahar
Is it possible to in different time zone


On Sun, Apr 28, 2013 at 5:23 PM, Samuel Jawahar wrote:

> Is it possible to in different timt zone
>
>
> On Sat, Apr 27, 2013 at 4:52 PM, Joseph DeVincentis wrote:
>
>> 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  wrote:
>>
>>> I used the following logic for the problem -
>>>
>>> Let k be the required answer. Then,
>>> (R+1)^2 - R^2 = 2R + 1  amount of paint to paint the first circle
>>> (R+3)^2 - (R+2)^2 = 2R + 5 amount of paint to paint the second circle.
>>> ...
>>> and so on - we get total k equations.
>>>
>>> Now, adding the k equations, and putting the RHS <= t we get the
>>> following quadratic inequality:
>>>
>>> 2k^2 + (2R - 1)k - t <= 0.
>>> So I managed to get a closed formula for this problem.
>>>
>>> However, when I ran my code to the test cases given, it solved them all
>>> correctly, except for the last one. I double checked my soln; seemed there
>>> was nothing at all but a problem in Python (I think.).
>>>
>>> Substituting k = 49 works, but k = 50 in (*) makes RHS > 0.
>>> [Check the following code]
>>>
>>> >>> def check(k):
>>> r,t = 1, 100
>>>  if 2*k*k + 2*(r-1)*k - t <= 0:
>>> return True
>>> return False
>>>
>>> >>> check(49)
>>> True
>>> >>> check(50)
>>> False
>>>
>>> >>> r,t = 1, 100
>>> >>> (-(2*r - 1) + pow(pow((2*r - 1), 2) + 4*2*t, 0.5))/4.0 ## Note
>>> that this is the closed formula.
>>> 50.0
>>>
>>>
>>> I wonder what's causing such error? Is it because of calculation of big
>>> numbers?
>>> Anyhow, in seeing this I managed to submit for A small. I changed my
>>> code abit using while loop and tweaking alittle and submitted large; but
>>> got it wrong in the end.
>>>
>>> I'm currently using Python 2.7.
>>> Any reason why its behaving so weirdly?
>>>
>>>
>>>
>>>  --
>>> 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 google-code+unsubscr...@googlegroups.com.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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

2013-04-28 Thread Samuel Jawahar
Is it possible to in different timt zone


On Sat, Apr 27, 2013 at 4:52 PM, Joseph DeVincentis wrote:

> 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  wrote:
>
>> I used the following logic for the problem -
>>
>> Let k be the required answer. Then,
>> (R+1)^2 - R^2 = 2R + 1  amount of paint to paint the first circle
>> (R+3)^2 - (R+2)^2 = 2R + 5 amount of paint to paint the second circle.
>> ...
>> and so on - we get total k equations.
>>
>> Now, adding the k equations, and putting the RHS <= t we get the
>> following quadratic inequality:
>>
>> 2k^2 + (2R - 1)k - t <= 0.
>> So I managed to get a closed formula for this problem.
>>
>> However, when I ran my code to the test cases given, it solved them all
>> correctly, except for the last one. I double checked my soln; seemed there
>> was nothing at all but a problem in Python (I think.).
>>
>> Substituting k = 49 works, but k = 50 in (*) makes RHS > 0.
>> [Check the following code]
>>
>> >>> def check(k):
>> r,t = 1, 100
>>  if 2*k*k + 2*(r-1)*k - t <= 0:
>> return True
>> return False
>>
>> >>> check(49)
>> True
>> >>> check(50)
>> False
>>
>> >>> r,t = 1, 100
>> >>> (-(2*r - 1) + pow(pow((2*r - 1), 2) + 4*2*t, 0.5))/4.0 ## Note
>> that this is the closed formula.
>> 50.0
>>
>>
>> I wonder what's causing such error? Is it because of calculation of big
>> numbers?
>> Anyhow, in seeing this I managed to submit for A small. I changed my code
>> abit using while loop and tweaking alittle and submitted large; but got it
>> wrong in the end.
>>
>> I'm currently using Python 2.7.
>> Any reason why its behaving so weirdly?
>>
>>
>>
>>  --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [gcj] Explanation for Treasure

2013-04-24 Thread Samuel Jawahar
i got it,thanks a lot


On Thu, Apr 25, 2013 at 7:37 AM, Samuel Jawahar wrote:

> what is that, bridge problem?
>
>
> On Thu, Apr 25, 2013 at 7:08 AM, Joseph DeVincentis wrote:
>
>> Samuel, I don't have a book to recommend for that. But where I really
>> learned how to do dynamic programming was Project Euler.
>>
>>
>> On Wed, Apr 24, 2013 at 8:59 PM, Samuel Jawahar wrote:
>>
>>> Thanks Joseph,can you please tell me the good book for Dynamic
>>> programming
>>>
>>>
>>> On Tue, Apr 16, 2013 at 12:46 AM, Joseph DeVincentis 
>>> wrote:
>>>
>>>> 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.
>>>>
>>>> (1) can be verified simply by counting all the keys and locks.
>>>> (2) can be verified by a quick search in which you assume the keys
>>>> don't break upon use. Here there is no branching; just keep track of the
>>>> keys you have previously acquired and each time you get a new one, open all
>>>> chests that open with that key and add any new keys to your inventory. If
>>>> you can't open all the chests this way, then you'll never be able to solve
>>>> the real problem.
>>>>
>>>> Much of the official analysis goes into proving that the above two
>>>> conditions guarantee a solution to the real problem.
>>>>
>>>> Now for the cases not proven impossible, find the "lexicographically
>>>> first" solution sequence by repeatedly opening the lowest-numbered locked
>>>> chest which you have the key to open. After each step, repeat the analysis
>>>> from (2) to ensure the remaining problem is still solvable. If it isn't,
>>>> then you need to backtrack; go back to the state before that last move, and
>>>> open the 2nd (or 3rd, etc. as necessary) chest instead.
>>>>
>>>> Because we ensure that the problem is solvable after each move, we know
>>>> that at least one of those chests leads to a solution, so we never have to
>>>> backtrack multiple steps, and the number of moves we need to attempt is
>>>> limited to the square of the number of chests, so we will always find a
>>>> solution, and always find it quickly.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, Apr 15, 2013 at 2:55 PM, vivek dhiman 
>>>> wrote:
>>>>
>>>>> Honestly. Content analysis for Treasure is too long. Only some time
>>>>> during weekend can be given to understand.
>>>>> Can someone explain in short ?
>>>>>
>>>>> Thanks
>>>>> Vivek Dhiman
>>>>>
>>>>> --
>>>>> 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 google-code+unsubscr...@googlegroups.com.
>>>>> To post to this group, send email to google-code@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>>
>>>>>
>>>>
>>>>  --
>>>> 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 google-code+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to google-code@googlegroups.com.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>  --
>>> 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 google-code+unsubscr...@googlegroups.com.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [gcj] Explanation for Treasure

2013-04-24 Thread Samuel Jawahar
what is that, bridge problem?


On Thu, Apr 25, 2013 at 7:08 AM, Joseph DeVincentis wrote:

> Samuel, I don't have a book to recommend for that. But where I really
> learned how to do dynamic programming was Project Euler.
>
>
> On Wed, Apr 24, 2013 at 8:59 PM, Samuel Jawahar wrote:
>
>> Thanks Joseph,can you please tell me the good book for Dynamic programming
>>
>>
>> On Tue, Apr 16, 2013 at 12:46 AM, Joseph DeVincentis wrote:
>>
>>> 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.
>>>
>>> (1) can be verified simply by counting all the keys and locks.
>>> (2) can be verified by a quick search in which you assume the keys don't
>>> break upon use. Here there is no branching; just keep track of the keys you
>>> have previously acquired and each time you get a new one, open all chests
>>> that open with that key and add any new keys to your inventory. If you
>>> can't open all the chests this way, then you'll never be able to solve the
>>> real problem.
>>>
>>> Much of the official analysis goes into proving that the above two
>>> conditions guarantee a solution to the real problem.
>>>
>>> Now for the cases not proven impossible, find the "lexicographically
>>> first" solution sequence by repeatedly opening the lowest-numbered locked
>>> chest which you have the key to open. After each step, repeat the analysis
>>> from (2) to ensure the remaining problem is still solvable. If it isn't,
>>> then you need to backtrack; go back to the state before that last move, and
>>> open the 2nd (or 3rd, etc. as necessary) chest instead.
>>>
>>> Because we ensure that the problem is solvable after each move, we know
>>> that at least one of those chests leads to a solution, so we never have to
>>> backtrack multiple steps, and the number of moves we need to attempt is
>>> limited to the square of the number of chests, so we will always find a
>>> solution, and always find it quickly.
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Apr 15, 2013 at 2:55 PM, vivek dhiman wrote:
>>>
>>>> Honestly. Content analysis for Treasure is too long. Only some time
>>>> during weekend can be given to understand.
>>>> Can someone explain in short ?
>>>>
>>>> Thanks
>>>> Vivek Dhiman
>>>>
>>>> --
>>>> 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 google-code+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to google-code@googlegroups.com.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>  --
>>> 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 google-code+unsubscr...@googlegroups.com.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [gcj] Explanation for Treasure

2013-04-24 Thread Samuel Jawahar
Thanks Joseph,can you please tell me the good book for Dynamic programming


On Tue, Apr 16, 2013 at 12:46 AM, Joseph DeVincentis wrote:

> 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.
>
> (1) can be verified simply by counting all the keys and locks.
> (2) can be verified by a quick search in which you assume the keys don't
> break upon use. Here there is no branching; just keep track of the keys you
> have previously acquired and each time you get a new one, open all chests
> that open with that key and add any new keys to your inventory. If you
> can't open all the chests this way, then you'll never be able to solve the
> real problem.
>
> Much of the official analysis goes into proving that the above two
> conditions guarantee a solution to the real problem.
>
> Now for the cases not proven impossible, find the "lexicographically
> first" solution sequence by repeatedly opening the lowest-numbered locked
> chest which you have the key to open. After each step, repeat the analysis
> from (2) to ensure the remaining problem is still solvable. If it isn't,
> then you need to backtrack; go back to the state before that last move, and
> open the 2nd (or 3rd, etc. as necessary) chest instead.
>
> Because we ensure that the problem is solvable after each move, we know
> that at least one of those chests leads to a solution, so we never have to
> backtrack multiple steps, and the number of moves we need to attempt is
> limited to the square of the number of chests, so we will always find a
> solution, and always find it quickly.
>
>
>
>
>
> On Mon, Apr 15, 2013 at 2:55 PM, vivek dhiman wrote:
>
>> Honestly. Content analysis for Treasure is too long. Only some time
>> during weekend can be given to understand.
>> Can someone explain in short ?
>>
>> Thanks
>> Vivek Dhiman
>>
>> --
>> 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 google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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 google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[gcj] Dynamic programming book

2013-04-24 Thread Samuel Jawahar
Hello i need good DP book,please let me know which one is good
regards
Samuel

-- 
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 google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [gcj] Milkshake algorithm

2012-04-11 Thread Samuel Jawahar
slight modification now it is working

Start:
All choices for the malt are moved the end if the choice list
ex:3 1,2 0,1 0 given
2 0,2 0,3 1 arranged is the pre condition for this algorithm
For each test case
declare malt and unmalt of size number of flavours,initial values of malt
and unmalt are zeros
repeate step 1 to 4 for number of flavours
1)get all cutomer choices in to choices
2)customer's who have only one choice have to be full filled
if unmalt flavour i is the only choices of the customer then increment the
value of the unmalt[i]+=1
if malt flavour i is the only choices of the customer then increment the
value of the malt[i]+=1
3)check if any flavour i is malted and unmalted,then return "IMPOSSIBLE"
4)Otherwise check the customers who are having more then one choices
for each choices either malted or unmalted at least one should satisfy
below condition
ex:3 1 flavour 3 malted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
malt[i]+=1
if unmalt[3]>0 this choice can not be satified
ex:3 0 flavour 3 unmalted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
if malt[3]>0 this choice can not be satified
5)at least one of the each customer choice are satisfied according to the
step 4
then print all malt[i] if malt[i]>0 print 1 else 0
End:

On Mon, Apr 9, 2012 at 10:17 PM, jawa  wrote:

> Hello, iam using the below algorithm to solve the milkshake problem
> http://code.google.com/codejam/contest/32016/dashboard#s=p1
> but iam getting the incorrect answer
> Start:
> All choices for the malt are moved the end if the choice list
> ex:3 1,2 0,1 0 given
>  2 0,2 0,3 1 arranged is the pre condition for this algorithm
> For each test case
>  declare malt and unmalt of size number of flavours,initial values of malt
> and unmalt are zeros
>  1)get all cutomer choices in to choices
>  2)customer's who have only one choice have to be full filled
>   if unmalt flavour i is the  only choices of the customer then increment
> the value of the unmalt[i]+=1
>   if malt flavour i is the  only choices of the customer then increment
> the value of the malt[i]+=1
>  3)check if any flavour i is malted and  unmalted,then return "IMPOSSIBLE"
>  4)Otherwise check the customers who are having more then one choices
>   for each choices either malted or unmalted at least one should satisfy
> below condition
>   ex:3 1 flavour 3 malted
>   if malt[3]==0 and unmalt[3]==0 then this customer chilce can be
> satified
>malt[i]+=1
>   if unmalt[3]>0 this choice can not be satified
>   ex:3 0 flavour 3 unmalted
>   if malt[3]==0 and unmalt[3]==0 then this customer chilce can be
> satified
>   if malt[3]>0 this choice can not be satified
>  5)at least one of the each customer choice are satisfied according to the
> step 4
>   then print all malt[i] if malt[i]>0 print 1 else 0
> End:
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-code/-/W36NkGMyFUsJ.
> To post to this group, send email to google-code@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.



Re: [gcj] Numbers problem.

2012-04-08 Thread Samuel Jawahar
use the Binomial theorem to solve this.
did you solve the milkshake problem?

On Sun, Apr 8, 2012 at 6:28 PM, Sachin Gupta wrote:

> can anyone please check why this code is giving wrong answers. I've
> checked the solutions each of them uses recursion to solve the problem.
> http://code.google.com/codejam/contest/32016/dashboard#s=p2
>
> import java.io.*;
> import java.math.*;
> import java.util.*;
>
> public class Main {
> public static void main (String args[]) throws Exception
> { BufferedReader in = new BufferedReader(new FileReader("C:\\downloads\\
> c-small-practice.in"));
>   BufferedWriter out = new BufferedWriter(new FileWriter("C:\\downloads\\
> c-output.in"));
>   int t = Integer.parseInt(in.readLine());
>   BigDecimal x = new BigDecimal(Math.sqrt(5));
>   x = x.add(BigDecimal.valueOf(3));
>   System.out.println(x.toString());
>   for (int i=1;i<=t;i++)
>   { int n = Integer.parseInt(in.readLine());
> BigDecimal bd ;
> bd = x;
> bd = bd.pow(n);
>// System.out.println(bd);
>// System.out.println(bd.toBigInteger());
> Formatter fmt = new Formatter();
> fmt.format("%03d",bd.toBigInteger());
>// System.out.println(fmt);
>
> StringBuilder sb = new StringBuilder(fmt.toString());
>// System.out.println(sb.substring(sb.length()-3,sb.length()));
> out.write("Case #"+i+": "+sb.substring(sb.length()-3,sb.length()));
> out.newLine();
>   }
>   out.close();
>  }
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to google-code@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.



Re: [gcj] Solution Walkthrough - Reverse Words

2012-04-07 Thread Samuel Jawahar
if unmalt[3]==0 means no unmalted flavour 3 is requested ,if it is
unmalt[3]>0 then it is Unmalted
In short  i am doing as below
*case1:no customer requested requested single choice*
  In this case all unmlted flavours can full fill the all
customers,since customer ca not request   more then one malted
flavour
*case2:some customers have single choices*
In this case i will first consider customers who are having single
choice
ex:1(one test case)
3(flavours)
3(customers)
1 1 1
1  2 1
3 3 1 2 0 1 0
  After processing the customer choices{moving the malted to lost}

1 1 1
1  2 1
3  2 0 1 0 3 1
Now find out customers who are having single choices
both are malted so the matl[1]=1,and malt[2]=1 unmalt[1]=0,unmalt[2]=0
the main purpose of malt and unmalt aray is to find out how meny malted and
unmalted flavoirs choices customers have
Now  from the step 4,malt[3]=0 and unmalt[3]=0
and it malted so it increments the malt[3],if it is unmalt it will not
incremented



On Sat, Apr 7, 2012 at 7:24 PM, Luke Pebody  wrote:

> Step 4. You have a customer who can be satisfied by flavour 3 malted, and
> you have no evidence that flavour 3 has to be unmalted yet, so you decide
> to make flavour 3 malted. However, this may turn out to be the wrong choice.
>
> For example:
> Customer A: Malted 3 or Unmalted 4
> Customer B: Unmalted 3 or Unmalted 4
> Customer C: Unmalted 3 or Malted 4.
>
> Your solution would, if I understand it correctly, set 3 to Malted for
> customer A, set 4 to Unmalted for customer B and then be left floundering
> on the rock for customer C, and so say "IMPOSSIBLE". There is a solution
> though - just throw the malt away.
>
>
>
> On 7 Apr 2012, at 12:55, Samuel Jawahar  wrote:
>
> Hello if you have time can you please verify my algorithm to solve the
> milkshake problem
>
> start:
>
> For each test case
> declare malt and unmalt of size number of flavours,initial values of malt
> and unmalt are zeros
> 1)get all cutomer choices in to choices
> 2)customer's who have only one choice have to be full filled
> if unmalt flavour i is the only choices of the customer then increment the
> value of the unmalt[i]+=1
> if malt flavour i is the only choices of the customer then increment the
> value of the malt[i]+=1
> 3)check if any flavour i is malted and unmalted,then return "IMPOSSIBLE"
> 4)Otherwise check the customers who are having more then one choices
> for each choices either malted or unmalted at least one should satisfy
> below condition
> ex:3 1 flavour 3 malted
> if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
> malt[3]+=1
> if unmalt[3]>0 this choice can not be satified
> ex:3 0 flavour 3 unmalted
> if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
> unmalt[i]+=1
> if malt[3]>0 this choice can not be satified
> 5)at least one of the each customer choice are satisfied according to the
> step 4
> then print all malt[i] if malt[i]>0 print 1 else 0
>
> end:
>
> On Sat, Apr 7, 2012 at 3:52 PM, Abizern  wrote:
>
>> Not yet, but I'll consider doing a 'cast about it next.
>>
>>
>> On 7 April 2012 10:57, Samuel Jawahar  wrote:
>>
>>> Hello.did you solve the problem milkshake
>>> http://code.google.com/codejam/contest/dashboard?c=32016#s=p1&a=1
>>>
>>>
>>> On Sat, Apr 7, 2012 at 2:58 PM, Abizern  wrote:
>>>
>>>> I made a short screencast last night to show the process of solving a
>>>> problem, retrieving the input files and uploading the solutions for the
>>>> small and large cases.
>>>>
>>>> http://youtu.be/_tgv3HVgOMc?hd=1
>>>>
>>>> If you aren't interested in the (trivial) solution in Haskell, skip to
>>>> the last few minutes to see the mechanics of submitting the final solution
>>>> files.
>>>>
>>>> --
>>>> Abizer
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google Code Jam" group.
>>>> To post to this group, send email to google-code@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> google-code+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/google-code?hl=en.
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Code Jam" group.
>>>

Re: [gcj] gcj

2012-04-07 Thread Samuel Jawahar
updated
Start:
All choices for the malt are moved the end if the choice list
ex:3 1,2 0,1 0 given
2 0,2 0,3 1 arranged is the pre condition for this algorithm
For each test case
declare malt and unmalt of size number of flavours,initial values of malt
and unmalt are zeros
1)get all cutomer choices in to choices
2)customer's who have only one choice have to be full filled
if unmalt flavour i is the only choices of the customer then increment the
value of the unmalt[i]+=1
if malt flavour i is the only choices of the customer then increment the
value of the malt[i]+=1
3)check if any flavour i is malted and unmalted,then return "IMPOSSIBLE"
4)Otherwise check the customers who are having more then one choices
for each choices either malted or unmalted at least one should satisfy
below condition
ex:3 1 flavour 3 malted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
malt[i]+=1
if unmalt[3]>0 this choice can not be satified
ex:3 0 flavour 3 unmalted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
if malt[3]>0 this choice can not be satified
5)at least one of the each customer choice are satisfied according to the
step 4
then print all malt[i] if malt[i]>0 print 1 else 0
End:

On Sat, Apr 7, 2012 at 5:08 PM, Samuel Jawahar  wrote:

> Hello Bartholomew
> I have solved the Milkshake(
> http://code.google.com/codejam/contest/dashboard?c=32016#s=p1&a=1)
> problem with below algorithm
> Start:
> For each test case
> declare malt and unmalt of size number of flavours,initial values of malt
> and unmalt are zeros
> 1)get all cutomer choices in to choices
> 2)customer's who have only one choice have to be full filled
> if unmalt flavour i is the only choices of the customer then increment the
> value of the unmalt[i]+=1
> if malt flavour i is the only choices of the customer then increment the
> value of the malt[i]+=1
> 3)check if any flavour i is malted and unmalted,then return "IMPOSSIBLE"
> 4)Otherwise check the customers who are having more then one choices
> for each choices either malted or unmalted at least one should satisfy
> below condition
> ex:3 1 flavour 3 malted
> if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
> malt[3]+=1
> if unmalt[3]>0 this choice can not be satified
> ex:3 0 flavour 3 unmalted
> if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
> unmalt[i]+=1
> if malt[3]>0 this choice can not be satified
> 5)at least one of the each customer choice are satisfied according to the
> step 4
> then print all malt[i] if malt[i]>0 print 1 else 0
> End:
> i am getting incorrect answer can you please have a look on my algorithm
> Regards
> Samuel
>
> On Wed, Apr 4, 2012 at 10:19 PM, Bartholomew Furrow wrote:
>
>> Your numbers are a bit low for input and output files -- we let those get
>> as high as 200kB (the input files can actually be bigger, but max out at
>> 200kB gzipped -- all modern browsers [as far as I can tell] automatically
>> request a gzipped version from the server).  Bala, for my own information,
>> how fast is your connection in kB/s?
>>
>>
>> On Wed, Apr 4, 2012 at 4:58 AM, Amahdy  wrote:
>>
>>> At the beginning of the competition, due to the very heavy load and
>>> number of people loading the competition page, there may be a delay not due
>>> to your internet but due to Google's server load. (Specially in Round1 (A,
>>> B, & C))
>>> But other than that, you need to load the question page once (~ 2K),
>>> download the input files (~5K) and upload yours (~ 5K also). Which I assume
>>> is good enough over 2G.
>>>
>>> p.s. There should be an improvement in the Google's server load, so
>>> maybe you won't even encounter the firstly mentioned problem.
>>>
>>> -- AMahdy!
>>> www.amahdy.net
>>>
>>>
>>>
>>> On Wed, Apr 4, 2012 at 13:12, bala subramanian 
>>> wrote:
>>>
>>>> Hi I am using 2g network only.its enough for google code jam or we
>>>> need high speed for gcj.please give me solution.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google Code Jam" group.
>>>> To post to this group, send email to google-code@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> google-code+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/google-code?hl=en.
>>>>
>>>>
>>> --
>>> You received this messag

Re: [gcj] Solution Walkthrough - Reverse Words

2012-04-07 Thread Samuel Jawahar
Start:
All choices for the malt are moved the end if the choice list
ex:3 1,2 0,1 0 given
2 0,2 0,3 1 arranged is the pre condition for this algorithm
For each test case
declare malt and unmalt of size number of flavours,initial values of malt
and unmalt are zeros
1)get all cutomer choices in to choices
2)customer's who have only one choice have to be full filled
if unmalt flavour i is the only choices of the customer then increment the
value of the unmalt[i]+=1
if malt flavour i is the only choices of the customer then increment the
value of the malt[i]+=1
3)check if any flavour i is malted and unmalted,then return "IMPOSSIBLE"
4)Otherwise check the customers who are having more then one choices
for each choices either malted or unmalted at least one should satisfy
below condition
ex:3 1 flavour 3 malted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
malt[i]+=1
if unmalt[3]>0 this choice can not be satified
ex:3 0 flavour 3 unmalted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
if malt[3]>0 this choice can not be satified
5)at least one of the each customer choice are satisfied according to the
step 4
then print all malt[i] if malt[i]>0 print 1 else 0
End:

On Sat, Apr 7, 2012 at 6:31 PM, Samuel Jawahar  wrote:

> Thanks a lot for giving response
> But i need u to go through my algorithm
> did you check my algorithm?can you please
> Regards
> Samuel
>
>
> On Sat, Apr 7, 2012 at 6:18 PM, Abizern  wrote:
>
>> Have a look at this explanation with a solution:
>>
>> http://www.necessaryandsufficient.net/2008/07/google-code-jam-milkshakes/
>>
>>
>> On 7 April 2012 12:55, Samuel Jawahar  wrote:
>>
>>> Hello if you have time can you please verify my algorithm to solve the
>>> milkshake problem
>>>
>>> start:
>>>
>>> For each test case
>>> declare malt and unmalt of size number of flavours,initial values of
>>> malt and unmalt are zeros
>>> 1)get all cutomer choices in to choices
>>> 2)customer's who have only one choice have to be full filled
>>> if unmalt flavour i is the only choices of the customer then increment
>>> the value of the unmalt[i]+=1
>>> if malt flavour i is the only choices of the customer then increment the
>>> value of the malt[i]+=1
>>> 3)check if any flavour i is malted and unmalted,then return "IMPOSSIBLE"
>>> 4)Otherwise check the customers who are having more then one choices
>>> for each choices either malted or unmalted at least one should satisfy
>>> below condition
>>> ex:3 1 flavour 3 malted
>>> if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
>>> malt[3]+=1
>>> if unmalt[3]>0 this choice can not be satified
>>> ex:3 0 flavour 3 unmalted
>>> if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
>>> unmalt[i]+=1
>>> if malt[3]>0 this choice can not be satified
>>> 5)at least one of the each customer choice are satisfied according to
>>> the step 4
>>> then print all malt[i] if malt[i]>0 print 1 else 0
>>>
>>> end:
>>>
>>> On Sat, Apr 7, 2012 at 3:52 PM, Abizern  wrote:
>>>
>>>> Not yet, but I'll consider doing a 'cast about it next.
>>>>
>>>>
>>>> On 7 April 2012 10:57, Samuel Jawahar  wrote:
>>>>
>>>>> Hello.did you solve the problem milkshake
>>>>> http://code.google.com/codejam/contest/dashboard?c=32016#s=p1&a=1
>>>>>
>>>>>
>>>>> On Sat, Apr 7, 2012 at 2:58 PM, Abizern  wrote:
>>>>>
>>>>>> I made a short screencast last night to show the process of solving a
>>>>>> problem, retrieving the input files and uploading the solutions for the
>>>>>> small and large cases.
>>>>>>
>>>>>> http://youtu.be/_tgv3HVgOMc?hd=1
>>>>>>
>>>>>> If you aren't interested in the (trivial) solution in Haskell, skip
>>>>>> to the last few minutes to see the mechanics of submitting the final
>>>>>> solution files.
>>>>>>
>>>>>> --
>>>>>> Abizer
>>>>>>  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Google Code Jam" group.
>>>>>> To post to this group, send email to google-code@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> goog

Re: [gcj] Solution Walkthrough - Reverse Words

2012-04-07 Thread Samuel Jawahar
Thanks a lot for giving response
But i need u to go through my algorithm
did you check my algorithm?can you please
Regards
Samuel


On Sat, Apr 7, 2012 at 6:18 PM, Abizern  wrote:

> Have a look at this explanation with a solution:
>
> http://www.necessaryandsufficient.net/2008/07/google-code-jam-milkshakes/
>
>
> On 7 April 2012 12:55, Samuel Jawahar  wrote:
>
>> Hello if you have time can you please verify my algorithm to solve the
>> milkshake problem
>>
>> start:
>>
>> For each test case
>> declare malt and unmalt of size number of flavours,initial values of malt
>> and unmalt are zeros
>> 1)get all cutomer choices in to choices
>> 2)customer's who have only one choice have to be full filled
>> if unmalt flavour i is the only choices of the customer then increment
>> the value of the unmalt[i]+=1
>> if malt flavour i is the only choices of the customer then increment the
>> value of the malt[i]+=1
>> 3)check if any flavour i is malted and unmalted,then return "IMPOSSIBLE"
>> 4)Otherwise check the customers who are having more then one choices
>> for each choices either malted or unmalted at least one should satisfy
>> below condition
>> ex:3 1 flavour 3 malted
>> if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
>> malt[3]+=1
>> if unmalt[3]>0 this choice can not be satified
>> ex:3 0 flavour 3 unmalted
>> if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
>> unmalt[i]+=1
>> if malt[3]>0 this choice can not be satified
>> 5)at least one of the each customer choice are satisfied according to the
>> step 4
>> then print all malt[i] if malt[i]>0 print 1 else 0
>>
>> end:
>>
>> On Sat, Apr 7, 2012 at 3:52 PM, Abizern  wrote:
>>
>>> Not yet, but I'll consider doing a 'cast about it next.
>>>
>>>
>>> On 7 April 2012 10:57, Samuel Jawahar  wrote:
>>>
>>>> Hello.did you solve the problem milkshake
>>>> http://code.google.com/codejam/contest/dashboard?c=32016#s=p1&a=1
>>>>
>>>>
>>>> On Sat, Apr 7, 2012 at 2:58 PM, Abizern  wrote:
>>>>
>>>>> I made a short screencast last night to show the process of solving a
>>>>> problem, retrieving the input files and uploading the solutions for the
>>>>> small and large cases.
>>>>>
>>>>> http://youtu.be/_tgv3HVgOMc?hd=1
>>>>>
>>>>> If you aren't interested in the (trivial) solution in Haskell, skip to
>>>>> the last few minutes to see the mechanics of submitting the final solution
>>>>> files.
>>>>>
>>>>> --
>>>>> Abizer
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Google Code Jam" group.
>>>>> To post to this group, send email to google-code@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> google-code+unsubscr...@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/google-code?hl=en.
>>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google Code Jam" group.
>>>> To post to this group, send email to google-code@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> google-code+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/google-code?hl=en.
>>>>
>>>
>>>
>>>
>>> --
>>> Abizer
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Code Jam" group.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> google-code+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-code?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To post to this group, send email to google-code@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-code+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=en.
>>
>
>
>
> --
> Abizer
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to google-code@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.



Re: [gcj] Solution Walkthrough - Reverse Words

2012-04-07 Thread Samuel Jawahar
Hello if you have time can you please verify my algorithm to solve the
milkshake problem

start:

For each test case
declare malt and unmalt of size number of flavours,initial values of malt
and unmalt are zeros
1)get all cutomer choices in to choices
2)customer's who have only one choice have to be full filled
if unmalt flavour i is the only choices of the customer then increment the
value of the unmalt[i]+=1
if malt flavour i is the only choices of the customer then increment the
value of the malt[i]+=1
3)check if any flavour i is malted and unmalted,then return "IMPOSSIBLE"
4)Otherwise check the customers who are having more then one choices
for each choices either malted or unmalted at least one should satisfy
below condition
ex:3 1 flavour 3 malted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
malt[3]+=1
if unmalt[3]>0 this choice can not be satified
ex:3 0 flavour 3 unmalted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
unmalt[i]+=1
if malt[3]>0 this choice can not be satified
5)at least one of the each customer choice are satisfied according to the
step 4
then print all malt[i] if malt[i]>0 print 1 else 0

end:

On Sat, Apr 7, 2012 at 3:52 PM, Abizern  wrote:

> Not yet, but I'll consider doing a 'cast about it next.
>
>
> On 7 April 2012 10:57, Samuel Jawahar  wrote:
>
>> Hello.did you solve the problem milkshake
>> http://code.google.com/codejam/contest/dashboard?c=32016#s=p1&a=1
>>
>>
>> On Sat, Apr 7, 2012 at 2:58 PM, Abizern  wrote:
>>
>>> I made a short screencast last night to show the process of solving a
>>> problem, retrieving the input files and uploading the solutions for the
>>> small and large cases.
>>>
>>> http://youtu.be/_tgv3HVgOMc?hd=1
>>>
>>> If you aren't interested in the (trivial) solution in Haskell, skip to
>>> the last few minutes to see the mechanics of submitting the final solution
>>> files.
>>>
>>> --
>>> Abizer
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Code Jam" group.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> google-code+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-code?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To post to this group, send email to google-code@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-code+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=en.
>>
>
>
>
> --
> Abizer
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to google-code@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.



Re: [gcj] gcj

2012-04-07 Thread Samuel Jawahar
Hello Bartholomew
I have solved the Milkshake(
http://code.google.com/codejam/contest/dashboard?c=32016#s=p1&a=1) problem
with below algorithm
Start:
For each test case
declare malt and unmalt of size number of flavours,initial values of malt
and unmalt are zeros
1)get all cutomer choices in to choices
2)customer's who have only one choice have to be full filled
if unmalt flavour i is the only choices of the customer then increment the
value of the unmalt[i]+=1
if malt flavour i is the only choices of the customer then increment the
value of the malt[i]+=1
3)check if any flavour i is malted and unmalted,then return "IMPOSSIBLE"
4)Otherwise check the customers who are having more then one choices
for each choices either malted or unmalted at least one should satisfy
below condition
ex:3 1 flavour 3 malted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
malt[3]+=1
if unmalt[3]>0 this choice can not be satified
ex:3 0 flavour 3 unmalted
if malt[3]==0 and unmalt[3]==0 then this customer chilce can be satified
unmalt[i]+=1
if malt[3]>0 this choice can not be satified
5)at least one of the each customer choice are satisfied according to the
step 4
then print all malt[i] if malt[i]>0 print 1 else 0
End:
i am getting incorrect answer can you please have a look on my algorithm
Regards
Samuel

On Wed, Apr 4, 2012 at 10:19 PM, Bartholomew Furrow wrote:

> Your numbers are a bit low for input and output files -- we let those get
> as high as 200kB (the input files can actually be bigger, but max out at
> 200kB gzipped -- all modern browsers [as far as I can tell] automatically
> request a gzipped version from the server).  Bala, for my own information,
> how fast is your connection in kB/s?
>
>
> On Wed, Apr 4, 2012 at 4:58 AM, Amahdy  wrote:
>
>> At the beginning of the competition, due to the very heavy load and
>> number of people loading the competition page, there may be a delay not due
>> to your internet but due to Google's server load. (Specially in Round1 (A,
>> B, & C))
>> But other than that, you need to load the question page once (~ 2K),
>> download the input files (~5K) and upload yours (~ 5K also). Which I assume
>> is good enough over 2G.
>>
>> p.s. There should be an improvement in the Google's server load, so maybe
>> you won't even encounter the firstly mentioned problem.
>>
>> -- AMahdy!
>> www.amahdy.net
>>
>>
>>
>> On Wed, Apr 4, 2012 at 13:12, bala subramanian wrote:
>>
>>> Hi I am using 2g network only.its enough for google code jam or we
>>> need high speed for gcj.please give me solution.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Code Jam" group.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> google-code+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-code?hl=en.
>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To post to this group, send email to google-code@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-code+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to google-code@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.



Re: [gcj] Solution Walkthrough - Reverse Words

2012-04-07 Thread Samuel Jawahar
Hello.did you solve the problem milkshake
http://code.google.com/codejam/contest/dashboard?c=32016#s=p1&a=1


On Sat, Apr 7, 2012 at 2:58 PM, Abizern  wrote:

> I made a short screencast last night to show the process of solving a
> problem, retrieving the input files and uploading the solutions for the
> small and large cases.
>
> http://youtu.be/_tgv3HVgOMc?hd=1
>
> If you aren't interested in the (trivial) solution in Haskell, skip to the
> last few minutes to see the mechanics of submitting the final solution
> files.
>
> --
> Abizer
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to google-code@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.



Re: [gcj] GCD and LCM problem

2012-04-03 Thread Samuel Jawahar
http://code.google.com/codejam/contest/dashboard?c=32016#s=p1

On Tue, Apr 3, 2012 at 7:50 PM, Samuel Jawahar  wrote:

> Hi any one solved Milkshaes problem?
> I have implemented in DP
> don't know why it is failing,can any one review my code
>
> -start---
> import java.io.BufferedReader;
> import java.io.FileReader;
> import java.io.FileWriter;
> import java.io.IOException;
> import java.io.PrintWriter;
> import java.util.ArrayList;
> import java.util.Collections;
> import java.util.Comparator;
>
> public class Milkshakes {
> PrintWriter out = null;
> BufferedReader in = null;
> ArrayList customerChoices = new
> ArrayList();
> int numberOfmc = 0;
> StringBuilder sb = new StringBuilder();
> String solutionString = "";
> int backtrackState = -1;
>
> public Milkshakes() {
> try {
> out = new PrintWriter(new FileWriter("B-small-practice.out"));
> in = new BufferedReader(new FileReader("B-small-practice.in"));
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
>
> public String processSolutionString(String data) {
> String output[] = new String[numberOfmc];
> data = data.trim();
> String choices[] = data.split(" ");
> int len = choices.length;
> String aux[] = new String[2];
> for (int i = 0; i < len; i++) {
> aux = choices[i].split(":");
> output[Integer.parseInt(aux[0]) - 1] = aux[1];
> }
> StringBuilder sb = new StringBuilder();
> for (int i = 0; i < numberOfmc; i++) {
> if (output[i] == null) {
> output[i] = "0";
> }
> sb.append(output[i]).append(" ");
> }
> return sb.toString();
>
> }
>
> public void doitIndp(StringAttr canterminate, String previousDecissions,
> int currentStage, int numberOfstages) {
> CustomerChoices cc = customerChoices.get(currentStage);
> ArrayList ccl = cc.getChoiceList();
> int size = ccl.size();
> Choice curentChoice = null;
> String decissionString = "";
> if (currentStage == numberOfstages - 1) {
> // solution state
>
> for (int i = 0; i < size; i++) {
> curentChoice = ccl.get(i);
> decissionString = "";
> if (curentChoice.type == 1) {
> decissionString = " " + curentChoice.machineNumber + ":"
> + 0;
> } else {
> decissionString = " " + curentChoice.machineNumber + ":"
> + 1;
> }
> if (!previousDecissions.contains(decissionString)) {
> decissionString = " " + curentChoice.machineNumber + ":"
> + curentChoice.type;
> solutionString = processSolutionString(previousDecissions
> + decissionString);
> canterminate.setCanTerminate("YES");
> return;
> }
> }
> } else {
> for (int i = 0; i < size; i++) {
> curentChoice = ccl.get(i);
> decissionString = "";
> if (curentChoice.type == 1) {
> decissionString = " " + curentChoice.machineNumber + ":"
> + 0;
> } else {
> decissionString = " " + curentChoice.machineNumber + ":"
> + 1;
> }
> if (!previousDecissions.contains(decissionString)) {
> decissionString = " " + curentChoice.machineNumber + ":"
> + curentChoice.type;
> doitIndp(canterminate,
> previousDecissions + decissionString,
> currentStage + 1, numberOfstages);
> if (canterminate.getCanTerminate() == "YES") {
> return;
> }
> if (canterminate.getCanTerminate() == "BT") {
> if (currentStage == backtrackState) {
> backtrackState = 0;
> canterminate.setCanTerminate("NO");
> continue;
> } else {
> return;
> }
> }
> }
> }
> if (currentStage != 0) {
> int backstate = 0;
> previousDecissions = previousDecissions.trim();
> String pst[] = previousDecissions.split(" ");
>
> for (; backstate < pst.length; backstate++) {
> if (pst[backstate].trim().equals(decissionString.trim())) {
> break;
> }
> }
> canterminate.setCanTerminate("BT");
> backtrackState = backstate;
> }
> }
> }
>
> /**
> * @param args
> */
> public static void main(String[] args) {
> Milkshakes m = new Milkshakes();
> int stages = 0;
> try {
> int ntc = Integer.parseInt(m.in.readLine().trim());
> for (int i = 1; i <= ntc; i++) {
> m.customerChoices.clear();
> m.solutionString = "";
> m.numberOfmc = Integer.parseInt(m.in.readLine().trim());
> int malted[] = new int[m.numberOfmc];
> for (int l = 0; l < m.numberOfmc; l++) {
> malted[l] = -1;
> }
> stages = Integer.parseInt(m.in.readLine().trim());
> System.out.println("-");
> S

Re: [gcj] GCD and LCM problem

2012-04-03 Thread Samuel Jawahar
Hi any one solved Milkshaes problem?
I have implemented in DP
don't know why it is failing,can any one review my code
-start---
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Milkshakes {
PrintWriter out = null;
BufferedReader in = null;
ArrayList customerChoices = new
ArrayList();
int numberOfmc = 0;
StringBuilder sb = new StringBuilder();
String solutionString = "";
int backtrackState = -1;

public Milkshakes() {
try {
out = new PrintWriter(new FileWriter("B-small-practice.out"));
in = new BufferedReader(new FileReader("B-small-practice.in"));
} catch (IOException e) {
e.printStackTrace();
}
}

public String processSolutionString(String data) {
String output[] = new String[numberOfmc];
data = data.trim();
String choices[] = data.split(" ");
int len = choices.length;
String aux[] = new String[2];
for (int i = 0; i < len; i++) {
aux = choices[i].split(":");
output[Integer.parseInt(aux[0]) - 1] = aux[1];
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < numberOfmc; i++) {
if (output[i] == null) {
output[i] = "0";
}
sb.append(output[i]).append(" ");
}
return sb.toString();

}

public void doitIndp(StringAttr canterminate, String previousDecissions,
int currentStage, int numberOfstages) {
CustomerChoices cc = customerChoices.get(currentStage);
ArrayList ccl = cc.getChoiceList();
int size = ccl.size();
Choice curentChoice = null;
String decissionString = "";
if (currentStage == numberOfstages - 1) {
// solution state

for (int i = 0; i < size; i++) {
curentChoice = ccl.get(i);
decissionString = "";
if (curentChoice.type == 1) {
decissionString = " " + curentChoice.machineNumber + ":"
+ 0;
} else {
decissionString = " " + curentChoice.machineNumber + ":"
+ 1;
}
if (!previousDecissions.contains(decissionString)) {
decissionString = " " + curentChoice.machineNumber + ":"
+ curentChoice.type;
solutionString = processSolutionString(previousDecissions
+ decissionString);
canterminate.setCanTerminate("YES");
return;
}
}
} else {
for (int i = 0; i < size; i++) {
curentChoice = ccl.get(i);
decissionString = "";
if (curentChoice.type == 1) {
decissionString = " " + curentChoice.machineNumber + ":"
+ 0;
} else {
decissionString = " " + curentChoice.machineNumber + ":"
+ 1;
}
if (!previousDecissions.contains(decissionString)) {
decissionString = " " + curentChoice.machineNumber + ":"
+ curentChoice.type;
doitIndp(canterminate,
previousDecissions + decissionString,
currentStage + 1, numberOfstages);
if (canterminate.getCanTerminate() == "YES") {
return;
}
if (canterminate.getCanTerminate() == "BT") {
if (currentStage == backtrackState) {
backtrackState = 0;
canterminate.setCanTerminate("NO");
continue;
} else {
return;
}
}
}
}
if (currentStage != 0) {
int backstate = 0;
previousDecissions = previousDecissions.trim();
String pst[] = previousDecissions.split(" ");

for (; backstate < pst.length; backstate++) {
if (pst[backstate].trim().equals(decissionString.trim())) {
break;
}
}
canterminate.setCanTerminate("BT");
backtrackState = backstate;
}
}
}

/**
* @param args
*/
public static void main(String[] args) {
Milkshakes m = new Milkshakes();
int stages = 0;
try {
int ntc = Integer.parseInt(m.in.readLine().trim());
for (int i = 1; i <= ntc; i++) {
m.customerChoices.clear();
m.solutionString = "";
m.numberOfmc = Integer.parseInt(m.in.readLine().trim());
int malted[] = new int[m.numberOfmc];
for (int l = 0; l < m.numberOfmc; l++) {
malted[l] = -1;
}
stages = Integer.parseInt(m.in.readLine().trim());
System.out.println("-");
System.out.println(m.numberOfmc + ":" + stages);
System.out.println("-");
for (int j = 0; j < stages; j++) {
m.customerChoices.add(new CustomerChoices(m.in.readLine()));
}
StringAttr sattr = new StringAttr("NO");
m.doitIndp(sattr, "", 0, stages);

if (m.solutionString == "") {
m.out.println("Case #" + i + ": IMPOSSIBLE");
System.out.println("Case #" + i + ": IMPOSSIBLE");
} else {
m.out.println("Case #" + i + ": " + m.solutionString.trim());
System.out.println("Case #" + i + ": " + m.solutionString);
}

}
m.out.close();
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

}

}

class Choice {
int machineNumber, type;

public Choice(int machineNumber, int type) {
this.machineNumber = machineNumber;
this.type = type;
}
}

class CustomerChoices {
ArrayList choiceList = new ArrayList();

public ArrayList getChoiceList() {
return choiceList;
}

public void setChoiceList(ArrayList choiceList) {
this.choiceList = choiceList;
}

public CustomerChoices(String choices) {
String inputRequest = choices.trim();
String d[] = inputRequest.trim().split(" ");
int nc = Integer.parseInt(d[0]);
for (int l 

Re: [gcj] java ide

2012-03-28 Thread Samuel Jawahar
Hi any one solved this
http://code.google.com/codejam/contest/32016/dashboard#s=p1

On Wed, Mar 28, 2012 at 12:56 PM, aaroncai  wrote:

> IntelliJ IDEA is the best
>
> http://java.dzone.com/articles/why-idea-better-eclipse
>
>
> 2012/3/28 Sachin Gupta 
>
>> which is the best java IDE for developing programs for codejam..
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To post to this group, send email to google-code@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-code+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to google-code@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.



[gcj] Milkeshake-solved?

2012-03-25 Thread Samuel Jawahar
tor implements Comparator{

 @Override
 public int compare(Choice o1, Choice o2) {
  // TODO Auto-generated method stub
  if(o1.type>o2.type){
   return 1;
  }
  if(o1.typewrote:

> Thanks a lot Ahmed
> Samuel
>
> On Sun, Mar 25, 2012 at 11:10 PM, Ahmed Aly wrote:
>
>> $ is a special character, try the following code, and it should work:
>>
>> String aux="aewwewe$ssdfsdfdf$sdfsdfsdfs$rterter$";
>> System.out.println(aux.split("\\$").length);
>>
>> --
>> Ahmed Aly
>> www.ahmed-aly.com
>>
>> On Sun, Mar 25, 2012 at 10:34 AM, Samuel Jawahar wrote:
>>
>>> code snippet:-
>>> String aux="aewwewe$ssdfsdfdf$sdfsdfsdfs$rterter$";
>>> System.out.println(aux.split("$").length);
>>> outPut:1
>>>
>>>
>>>
>>> On Wed, Mar 21, 2012 at 5:50 PM, mandy  wrote:
>>>
>>>> here is a link to the problem...
>>>> http://code.google.com/codejam/contest/351101/dashboard#s=p1
>>>> Input:-this is a test
>>>> Output:-test a is this
>>>> I'm getting error in output and in while loop is not executing
>>>> properly...
>>>> So pls tell me what's wrong with this code...
>>>> Thanks a lot.
>>>>
>>>> Mine solution is this..
>>>>
>>>> /*
>>>>  * To change this template, choose Tools | Templates
>>>>  * and open the template in the editor.
>>>>  */
>>>> package frame;
>>>>
>>>> import java.util.Scanner;
>>>>
>>>> /**
>>>>  *
>>>>  * @author Pardeep
>>>>  */
>>>> public class Reverse {
>>>>public void test(){
>>>>int n=0,l=0,i=0;
>>>> int j=0,c=0;
>>>> Scanner sc=new Scanner(System.in);
>>>>n=sc.nextInt();//count no of test
>>>> cases
>>>>while(n>0){
>>>>String strn="";
>>>>String str=sc.nextLine();
>>>> l=str.length();
>>>> String[] ar=new String[l];
>>>> j=0;
>>>> int count=0;
>>>> for(i=0;i>>> spaces in string
>>>> if(str.charAt(i)==' '){
>>>> count++;
>>>> }
>>>> }
>>>> i=0;
>>>>for(i=str.length()-1;i>=0;i--){  //reverse the string
>>>> ar[j]=String.valueOf(str.charAt(i));  //store the value
>>>> in array ar[]
>>>>   //System.out.println("while.."+ar[j]+j);
>>>>j+=1; //then increase
>>>> value in array element
>>>>if(str.charAt(i)==' '){  //if space occur
>>>> in string then pop up all array element and add in string variable
>>>> strn
>>>>for(int k=j-1;k>=0;k--){
>>>>strn+=ar[k];
>>>>}
>>>>j=0; // j is again
>>>> set to j=0
>>>>count--;//System.out.println(count); //count is
>>>> decremented
>>>>} //now we
>>>> have reversed the string and store it in string (strn),but not the
>>>> first word of string
>>>>if(count==0){   //if count
>>>> is zero then
>>>>strn+=" ";  //space is
>>>> added to string
>>>>for(int m=0;m<=i;m++){  //variable
>>>> m is initialised to 0 and upto i
>>>>strn+=str.charAt(m);//store
>>>> each char in the string (strn)
>>>>}
>>>>i=-1;
>>>>}
>>>>}c++;
>>>> System.out.println("Case #:"+c
>>>> +strn); //Error:-output is printed (but getting
>>>> space at first position)
>>>>
>>>>n--;
>>>>}
>>>>
>>>>}
>>>>public static void main(String a[]){
>>>>new Reverse().test();
>>>>}
>>>> }
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google Code Jam" group.
>>>> To post to this group, send email to google-code@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> google-code+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/google-code?hl=en.
>>>>
>>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Code Jam" group.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> google-code+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-code?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To post to this group, send email to google-code@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-code+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.



[gcj] Milkshake-solved?

2012-03-25 Thread Samuel Jawahar
e
 public int compare(Choice o1, Choice o2) {
  // TODO Auto-generated method stub
  if(o1.type>o2.type){
   return 1;
  }
  if(o1.typewrote:

> Thanks a lot Ahmed
> Samuel
>
> On Sun, Mar 25, 2012 at 11:10 PM, Ahmed Aly wrote:
>
>> $ is a special character, try the following code, and it should work:
>>
>> String aux="aewwewe$ssdfsdfdf$sdfsdfsdfs$rterter$";
>> System.out.println(aux.split("\\$").length);
>>
>> --
>> Ahmed Aly
>> www.ahmed-aly.com
>>
>> On Sun, Mar 25, 2012 at 10:34 AM, Samuel Jawahar wrote:
>>
>>> code snippet:-
>>> String aux="aewwewe$ssdfsdfdf$sdfsdfsdfs$rterter$";
>>> System.out.println(aux.split("$").length);
>>> outPut:1
>>>
>>>
>>>
>>> On Wed, Mar 21, 2012 at 5:50 PM, mandy  wrote:
>>>
>>>> here is a link to the problem...
>>>> http://code.google.com/codejam/contest/351101/dashboard#s=p1
>>>> Input:-this is a test
>>>> Output:-test a is this
>>>> I'm getting error in output and in while loop is not executing
>>>> properly...
>>>> So pls tell me what's wrong with this code...
>>>> Thanks a lot.
>>>>
>>>> Mine solution is this..
>>>>
>>>> /*
>>>>  * To change this template, choose Tools | Templates
>>>>  * and open the template in the editor.
>>>>  */
>>>> package frame;
>>>>
>>>> import java.util.Scanner;
>>>>
>>>> /**
>>>>  *
>>>>  * @author Pardeep
>>>>  */
>>>> public class Reverse {
>>>>public void test(){
>>>>int n=0,l=0,i=0;
>>>> int j=0,c=0;
>>>> Scanner sc=new Scanner(System.in);
>>>>n=sc.nextInt();//count no of test
>>>> cases
>>>>while(n>0){
>>>>String strn="";
>>>>String str=sc.nextLine();
>>>> l=str.length();
>>>> String[] ar=new String[l];
>>>> j=0;
>>>> int count=0;
>>>> for(i=0;i>>> spaces in string
>>>> if(str.charAt(i)==' '){
>>>> count++;
>>>> }
>>>> }
>>>> i=0;
>>>>for(i=str.length()-1;i>=0;i--){  //reverse the string
>>>> ar[j]=String.valueOf(str.charAt(i));  //store the value
>>>> in array ar[]
>>>>   //System.out.println("while.."+ar[j]+j);
>>>>j+=1; //then increase
>>>> value in array element
>>>>if(str.charAt(i)==' '){  //if space occur
>>>> in string then pop up all array element and add in string variable
>>>> strn
>>>>for(int k=j-1;k>=0;k--){
>>>>strn+=ar[k];
>>>>}
>>>>j=0; // j is again
>>>> set to j=0
>>>>count--;//System.out.println(count); //count is
>>>> decremented
>>>>} //now we
>>>> have reversed the string and store it in string (strn),but not the
>>>> first word of string
>>>>if(count==0){   //if count
>>>> is zero then
>>>>strn+=" ";  //space is
>>>> added to string
>>>>for(int m=0;m<=i;m++){  //variable
>>>> m is initialised to 0 and upto i
>>>>strn+=str.charAt(m);//store
>>>> each char in the string (strn)
>>>>}
>>>>i=-1;
>>>>}
>>>>}c++;
>>>> System.out.println("Case #:"+c
>>>> +strn); //Error:-output is printed (but getting
>>>> space at first position)
>>>>
>>>>n--;
>>>>}
>>>>
>>>>}
>>>>public static void main(String a[]){
>>>>new Reverse().test();
>>>>}
>>>> }
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google Code Jam" group.
>>>> To post to this group, send email to google-code@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> google-code+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/google-code?hl=en.
>>>>
>>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Code Jam" group.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> google-code+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-code?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To post to this group, send email to google-code@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-code+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.



Re: [gcj] String split on $ is not working

2012-03-25 Thread Samuel Jawahar
Thanks a lot Ahmed
Samuel

On Sun, Mar 25, 2012 at 11:10 PM, Ahmed Aly  wrote:

> $ is a special character, try the following code, and it should work:
>
> String aux="aewwewe$ssdfsdfdf$sdfsdfsdfs$rterter$";
> System.out.println(aux.split("\\$").length);
>
> --
> Ahmed Aly
> www.ahmed-aly.com
>
> On Sun, Mar 25, 2012 at 10:34 AM, Samuel Jawahar wrote:
>
>> code snippet:-
>> String aux="aewwewe$ssdfsdfdf$sdfsdfsdfs$rterter$";
>> System.out.println(aux.split("$").length);
>> outPut:1
>>
>>
>>
>> On Wed, Mar 21, 2012 at 5:50 PM, mandy  wrote:
>>
>>> here is a link to the problem...
>>> http://code.google.com/codejam/contest/351101/dashboard#s=p1
>>> Input:-this is a test
>>> Output:-test a is this
>>> I'm getting error in output and in while loop is not executing
>>> properly...
>>> So pls tell me what's wrong with this code...
>>> Thanks a lot.
>>>
>>> Mine solution is this..
>>>
>>> /*
>>>  * To change this template, choose Tools | Templates
>>>  * and open the template in the editor.
>>>  */
>>> package frame;
>>>
>>> import java.util.Scanner;
>>>
>>> /**
>>>  *
>>>  * @author Pardeep
>>>  */
>>> public class Reverse {
>>>public void test(){
>>>int n=0,l=0,i=0;
>>> int j=0,c=0;
>>> Scanner sc=new Scanner(System.in);
>>>n=sc.nextInt();//count no of test
>>> cases
>>>while(n>0){
>>>String strn="";
>>>String str=sc.nextLine();
>>> l=str.length();
>>> String[] ar=new String[l];
>>> j=0;
>>> int count=0;
>>> for(i=0;i>> spaces in string
>>> if(str.charAt(i)==' '){
>>> count++;
>>> }
>>> }
>>> i=0;
>>>for(i=str.length()-1;i>=0;i--){  //reverse the string
>>> ar[j]=String.valueOf(str.charAt(i));  //store the value
>>> in array ar[]
>>>   //System.out.println("while.."+ar[j]+j);
>>>j+=1; //then increase
>>> value in array element
>>>if(str.charAt(i)==' '){  //if space occur
>>> in string then pop up all array element and add in string variable
>>> strn
>>>for(int k=j-1;k>=0;k--){
>>>strn+=ar[k];
>>>}
>>>j=0; // j is again
>>> set to j=0
>>>count--;//System.out.println(count); //count is
>>> decremented
>>>} //now we
>>> have reversed the string and store it in string (strn),but not the
>>> first word of string
>>>if(count==0){   //if count
>>> is zero then
>>>strn+=" ";  //space is
>>> added to string
>>>for(int m=0;m<=i;m++){  //variable
>>> m is initialised to 0 and upto i
>>>strn+=str.charAt(m);//store
>>> each char in the string (strn)
>>>}
>>>i=-1;
>>>}
>>>}c++;
>>> System.out.println("Case #:"+c
>>> +strn); //Error:-output is printed (but getting
>>> space at first position)
>>>
>>>n--;
>>>}
>>>
>>>}
>>>public static void main(String a[]){
>>>new Reverse().test();
>>>}
>>> }
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Code Jam" group.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> google-code+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-code?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To post to this group, send email to google-code@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-code+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to google-code@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.



[gcj] String split on $ is not working

2012-03-25 Thread Samuel Jawahar
code snippet:-
String aux="aewwewe$ssdfsdfdf$sdfsdfsdfs$rterter$";
System.out.println(aux.split("$").length);
outPut:1



On Wed, Mar 21, 2012 at 5:50 PM, mandy  wrote:

> here is a link to the problem...
> http://code.google.com/codejam/contest/351101/dashboard#s=p1
> Input:-this is a test
> Output:-test a is this
> I'm getting error in output and in while loop is not executing
> properly...
> So pls tell me what's wrong with this code...
> Thanks a lot.
>
> Mine solution is this..
>
> /*
>  * To change this template, choose Tools | Templates
>  * and open the template in the editor.
>  */
> package frame;
>
> import java.util.Scanner;
>
> /**
>  *
>  * @author Pardeep
>  */
> public class Reverse {
>public void test(){
>int n=0,l=0,i=0;
> int j=0,c=0;
> Scanner sc=new Scanner(System.in);
>n=sc.nextInt();//count no of test
> cases
>while(n>0){
>String strn="";
>String str=sc.nextLine();
> l=str.length();
> String[] ar=new String[l];
> j=0;
> int count=0;
> for(i=0;i spaces in string
> if(str.charAt(i)==' '){
> count++;
> }
> }
> i=0;
>for(i=str.length()-1;i>=0;i--){  //reverse the string
> ar[j]=String.valueOf(str.charAt(i));  //store the value
> in array ar[]
>   //System.out.println("while.."+ar[j]+j);
>j+=1; //then increase
> value in array element
>if(str.charAt(i)==' '){  //if space occur
> in string then pop up all array element and add in string variable
> strn
>for(int k=j-1;k>=0;k--){
>strn+=ar[k];
>}
>j=0; // j is again
> set to j=0
>count--;//System.out.println(count); //count is
> decremented
>} //now we
> have reversed the string and store it in string (strn),but not the
> first word of string
>if(count==0){   //if count
> is zero then
>strn+=" ";  //space is
> added to string
>for(int m=0;m<=i;m++){  //variable
> m is initialised to 0 and upto i
>strn+=str.charAt(m);//store
> each char in the string (strn)
>}
>i=-1;
>}
>}c++;
> System.out.println("Case #:"+c
> +strn); //Error:-output is printed (but getting
> space at first position)
>
>n--;
>}
>
>}
>public static void main(String a[]){
>new Reverse().test();
>}
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to google-code@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.



Re: [gcj] Accouncing Google Code Jam 2010!

2009-11-22 Thread samuel jawahar
how meny rounds u cleared in this year?,hope u will be clear more rounds in
10

On Fri, Nov 20, 2009 at 1:01 AM, Raphael Ribas wrote:

> Now that we have the accouncing, I can`t wait for the annoucement!
>
>
> On Thu, Nov 19, 2009 at 5:12 PM, Bartholomew Furrow wrote:
>
>> There's one more thing that we announced at the award ceremony: Code Jam
>> 2010!  We'll be announcing official dates early next year, so keep
>> practicing, stay tuned and spread the word.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "google-codejam" group.
>> To post to this group, send email to google-c...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-code+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-codejam" group.
> To post to this group, send email to google-c...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=.
>

--

You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-c...@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=.




Re: [gcj] Re: Announcing the winner of Google Code Jam 2009

2009-11-18 Thread samuel jawahar
I am taking this opportunity to great The Google Code Jame Hero ACRush
I don't know IITans participated or not

Regards
Samuel Jawahar


On Tue, Nov 17, 2009 at 3:50 PM, Rajkarn Singh wrote:

> Congratulations...ACRush :-)
>
>
> On Mon, Nov 16, 2009 at 4:22 PM, yupeng.chen  wrote:
>
>> Congratulation to ACRush
>>
>> On Nov 15, 7:37 am, Bartholomew Furrow  wrote:
>> > Announcing the winner and champion of Google Code Jam 2009: China's Lou
>> > TianCheng, *ACRush*!  He takes home $5,000 and the title of Code Jam
>> > champion!
>> >
>> > In second place came China's Qi ZiChao (*qizichao*); and our third-place
>> > finisher was Japan's Iwata Yoichi (*wata*).
>> >
>> > You can check out the scoreboard and the problems at:
>> >
>> >
>> http://code.google.com/codejam/contest/scoreboard?c=311101http://code.google.com/codejam/contest/dashboard?c=311101
>> <http://code.google.com/codejam/contest/dashboard?c=311101#>
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "google-codejam" group.
>> To post to this group, send email to google-c...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-code+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=.
>>
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-codejam" group.
> To post to this group, send email to google-c...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=.
>

--

You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-c...@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=.




Re: [gcj] languages on the T-shirt

2009-11-11 Thread samuel jawahar
Who is the Winner?

On Sun, Nov 8, 2009 at 3:59 PM, Christoph Dürr  wrote:

>
> If you were one of the first 500, then you won a cute T-shirt. On its
> back are lines from different programming languages. Do you found out
> which languages ?
>
> --~--~-~--~~~---~--~~
> You received this message because you are subscribed to the Google Groups
> "google-codejam" group.
> To post to this group, send email to google-code@googlegroups.com
> To unsubscribe from this group, send email to
> google-code+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en
> -~--~~~~--~~--~--~---
>
>

--

You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-c...@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=.




[gcj] Re: how to solve this?

2009-10-12 Thread samuel jawahar
hello one request
if any one know how to test the Topcoder problems offline please help me
currently marathin56 is open
i wanted to test my solution

Regards
Jawahar

On Mon, Oct 12, 2009 at 4:41 PM, Brats  wrote:

>
> Hey .. here is a problem I saw somewhere on net. Can anyone give me
> some ideas on its algo ?
>
> There is a tray that contains a row of "s" slots where biscuits may be
> placed. You can have atmost one biscuit per slot. You and your friend
> play a game with it. Each of you get to pick biscuits in turns. You
> can pick atmost "b" biscuits in a single turn provided they are in
> consecutive slots with no gaps (empty slots) in between (but you have
> to pick atleast one in your turn). Whoever picks the last biscuit wins
> the game.
>
> You are given a snapshot of the game and its your turn. Assuming that
> from this point onwards, both the players play optimally. Find out if
> you can win the game. And if yes, what is your next move? If there are
> multiple options for the next move, choose the one where you pick the
> highest number of biscuits in the next turn. If still there are
> multiple options, choose the one where you take the leftmost biscuit
> among them.
>
> As input, you will be given 't' which indicates the number of test
> cases. For each case, you will be given s ( 1<=s<=2000 ), b
> ( 1<=b<=20 ) seperated by space and the next line will contain s
> characters that are either '0' or '1' representing each of the s
> slots. '0' indicates that a biscuit is not present at that particular
> slot and '1' indicates that a biscuit is present.
>
> As output, print "yes" or "no" indicating if you can win and if the
> answer is yes, print a string of s characters of either '0' or '1'
> that indicates whether a biscuit is absent or present at the
> particular slot after you have played your turn.
>
> Sample input:
> 3
> 3 2
> 111
> 8 3
> 10110111
> 8 4
> 
>
> Sample output:
> yes 101
> no
> yes 1111
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---



[gcj] Re: T-Shirts for top 1000?

2009-09-28 Thread samuel jawahar
Hello this is completely not related to this context
but hope i will get some help
how to add new class to next JDK release
Regards
Jawahar

On Mon, Sep 28, 2009 at 7:22 PM, Grant Kot  wrote:

> i vote that everyone in the world except code jam participants get
> t-shirts.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---



[gcj] Re: Next Code Jam

2009-09-14 Thread samuel jawahar
U have to wait for one year,if u really intersted to coding participate in
topcoder
topcoder.com

On Mon, Sep 14, 2009 at 12:32 PM, Sravan wrote:

>
> When will the next Code Jam be? Is it yearly?
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---



[gcj] Re: Dynamic Programming

2009-09-10 Thread samuel jawahar
Hi Anil ,
Have completed the topcoder Marathon match problem?
jawahar
On Thu, Sep 10, 2009 at 8:07 PM, Anil Kishore  wrote:

> You may wanna try the Problem in Todays TopCoder SRM ,
> http://www.topcoder.com/stat?c=problem_statement&pm=10620
>
> <http://www.topcoder.com/stat?c=problem_statement&pm=10620>Its a good
> problem. Give it a try :) ,, Don't worry, we are there to explain in case.
>
> - Anil Kishore,
>   IIIT-Hyderabad.
>
>
> On Thu, Sep 10, 2009 at 6:52 PM, samuel jawahar 
> wrote:
>
>> Dynamic programing gives the effective way of recursion, with table that
>> contains the previous results
>> Regards
>> Jawahar
>>
>>
>> On Thu, Sep 10, 2009 at 5:55 PM, amit jain  wrote:
>>
>>> thanx buddy
>>>
>>> On Thu, Sep 10, 2009 at 2:11 PM, Mayank Jaiswal wrote:
>>>
>>>> Hi amit,
>>>>
>>>> I'll try to help you.
>>>> Recall the definition of dynamic programming.
>>>> *Dynamic programming is a method of solving complex problems by
>>>> breaking them down into simpler steps.
>>>> *
>>>> So, when solving a problem, think that whether you are solving same
>>>> subproblem again and again or not. If yes, just find out a way in which you
>>>> can store the result of smaller problems and use it further in the 
>>>> algorithm
>>>> .
>>>>
>>>> By the term *optimal substructure*, we just mean that when you realise
>>>> your bigger problem to be consisted of similar smaller subproblems, the
>>>> solution to this subproblem  will contribute to optimal solution of parent
>>>> bigger problem.. it sounds confusing and complex ...i know. Just forget
>>>> this. Practice a few problems  Cormen (Introduction to algorithms) is a
>>>> good book to learn.
>>>>
>>>>
>>>> Solving some problems will automatically give you a feel of what to do
>>>>  its not a big deal as it sounds to be. Best of luck!
>>>>
>>>> Cheers,
>>>> Mayank
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Sep 10, 2009 at 1:55 PM, Anil Kishore wrote:
>>>>
>>>>>
>>>>> If you think of it as some standard step-by-step thinking, then it may
>>>>> not work most of the time. By more practice, you will develop the art
>>>>> of DPing ;) . . . Its all about, 'remember your past to your memory
>>>>> capacity'
>>>>>
>>>>> May be its something like this. ,
>>>>> -> Hmm the Problem looks good , lemme imagine as a big picture
>>>>> -> I see, we need to solve this way (think as if you are explaining the
>>>>> answer to your friend)
>>>>> -> Oh, I am doing the same kind of things and need to solve similar
>>>>> sub-problems
>>>>> -> Aha!, its recursion . . I knew it ! , lemme write the function
>>>>> corresponding to the recurrence relation
>>>>> -> oh .. wait, am I calling the function more than once, with same
>>>>> parameters.. yaya, lemme memoize
>>>>> -> Aaah!, i figured out the order in which the subproblems are solved .
>>>>> .
>>>>> -> Aha !, its DP . . I knew it ! :p
>>>>>
>>>>> If you are in doubt, you can simply memoize (even if its not needed).
>>>>> May be someone who can solve advanced DP in less time, can explain
>>>>> better.
>>>>>
>>>>> - Anil Kishore
>>>>>
>>>>>
>>>>> On Thu, Sep 10, 2009 at 1:41 PM, amit jain  wrote:
>>>>>
>>>>>> okk
>>>>>> how do you think optimal substructure step ?
>>>>>> On Thu, Sep 10, 2009 at 1:34 PM, Hawston LLH wrote:
>>>>>>
>>>>>>> i guess only practice more and get more familiar with it is the only
>>>>>>> useful trick if there is any. :)
>>>>>>>
>>>>>>> On Thu, Sep 10, 2009 at 3:57 PM, amit jain wrote:
>>>>>>>
>>>>>>>> u know we have not enough time during competition and sol of dp
>>>>>>>> looks like they will take 1 complete day..
>>>>>>>>  now a days i m spending my whole day to solve a single dp problem
>>>>>>>> like we had in qualification round.
>&

[gcj] Re: Dynamic Programming

2009-09-10 Thread samuel jawahar
Dynamic programing gives the effective way of recursion, with table that
contains the previous results
Regards
Jawahar

On Thu, Sep 10, 2009 at 5:55 PM, amit jain  wrote:

> thanx buddy
>
> On Thu, Sep 10, 2009 at 2:11 PM, Mayank Jaiswal wrote:
>
>> Hi amit,
>>
>> I'll try to help you.
>> Recall the definition of dynamic programming.
>> *Dynamic programming is a method of solving complex problems by breaking
>> them down into simpler steps.
>> *
>> So, when solving a problem, think that whether you are solving same
>> subproblem again and again or not. If yes, just find out a way in which you
>> can store the result of smaller problems and use it further in the algorithm
>> .
>>
>> By the term *optimal substructure*, we just mean that when you realise
>> your bigger problem to be consisted of similar smaller subproblems, the
>> solution to this subproblem  will contribute to optimal solution of parent
>> bigger problem.. it sounds confusing and complex ...i know. Just forget
>> this. Practice a few problems  Cormen (Introduction to algorithms) is a
>> good book to learn.
>>
>>
>> Solving some problems will automatically give you a feel of what to do
>>  its not a big deal as it sounds to be. Best of luck!
>>
>> Cheers,
>> Mayank
>>
>>
>>
>>
>>
>> On Thu, Sep 10, 2009 at 1:55 PM, Anil Kishore wrote:
>>
>>>
>>> If you think of it as some standard step-by-step thinking, then it may
>>> not work most of the time. By more practice, you will develop the art of
>>> DPing ;) . . . Its all about, 'remember your past to your memory capacity'
>>>
>>> May be its something like this. ,
>>> -> Hmm the Problem looks good , lemme imagine as a big picture
>>> -> I see, we need to solve this way (think as if you are explaining the
>>> answer to your friend)
>>> -> Oh, I am doing the same kind of things and need to solve similar
>>> sub-problems
>>> -> Aha!, its recursion . . I knew it ! , lemme write the function
>>> corresponding to the recurrence relation
>>> -> oh .. wait, am I calling the function more than once, with same
>>> parameters.. yaya, lemme memoize
>>> -> Aaah!, i figured out the order in which the subproblems are solved . .
>>> -> Aha !, its DP . . I knew it ! :p
>>>
>>> If you are in doubt, you can simply memoize (even if its not needed).
>>> May be someone who can solve advanced DP in less time, can explain
>>> better.
>>>
>>> - Anil Kishore
>>>
>>>
>>> On Thu, Sep 10, 2009 at 1:41 PM, amit jain  wrote:
>>>
 okk
 how do you think optimal substructure step ?
 On Thu, Sep 10, 2009 at 1:34 PM, Hawston LLH  wrote:

> i guess only practice more and get more familiar with it is the only
> useful trick if there is any. :)
>
> On Thu, Sep 10, 2009 at 3:57 PM, amit jain  wrote:
>
>> u know we have not enough time during competition and sol of dp looks
>> like they will take 1 complete day..
>>  now a days i m spending my whole day to solve a single dp problem
>> like we had in qualification round.
>> and i read out both clrs and as well as topcoder link
>> so plz suggest me useful trick to solve them...
>> thanks in advance..
>> On Wed, Sep 9, 2009 at 11:10 PM, Kaushalya Madhawa > > wrote:
>>
>>> This is good!
>>> http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=dynProg And
>>> refering CLRS will be helpful
>>> Regards,
>>> Kaushalya Madhawa
>>> http://kaumad.wordpress.com
>>> http://most-wanted-stuff.blogspot.com
>>>
>>> twitter: http://twitter.com/kau_mad
>>> skype: kau.mad
>>> gtalk: kau.mad
>>>
>>>
>>>
>>> On Wed, Sep 9, 2009 at 3:27 PM, Sagar Shah 
>>> wrote:
>>>
 Can anyone please suggest me some good tutorial/book to learn
 Dynamic Programming?

 Thanks
 Sagar Shah



>>>
>>>
>>>
>>
>>
>>
>
>
>



>>>
>>>
>>>
>>
>>
>> --
>> Mayank Jaiswal
>> B.Tech
>> Final Year Student
>> Computer Science and Engineering
>> Indian Institute of Technology, Kharagpur
>>
>> D-220, Nehru Hall of Residence
>> +91 97344 28874
>> http://www.linkedin.com/in/msjaiswal
>>
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---



[gcj] Re: Where can I check my choice of Round One ?

2009-09-06 Thread samuel jawahar
Hello any one received the invitation for the second round
Regards
Jawahar

On Mon, Sep 7, 2009 at 6:46 AM, Chen Mingcheng  wrote:

>
> Dear Administrator:
>
>Since I would be free all day, I nearly made the choice randomly,
> and now I forget what is my choice.
>Will there be any letter to notify those with importance ?
>Thank you.
>
> Yours sincerely,
> linyufly
> September 7th, 2009
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---



[gcj] Re: TestCases

2009-09-04 Thread samuel jawahar
how meny point u got?

On Fri, Sep 4, 2009 at 1:35 PM, xakee  wrote:

>
> Hi ,
>
> I could not qualify. I did all three small problems. For the first
> large one, I did not know I would have just 8 minutes to respond, and
> my solution timed out (was taking too long). On largeB, my code ran
> fine and i was pretty confident about it being right but later i got
> to know that it failed system test. Same on largeC. Is there a way to
> know which test cases on the large problem failed? :(
>
> Regards,
> Zaki
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---



[gcj] Re: Scoreboard features.

2009-09-04 Thread samuel jawahar
Hello how meny points are required to go for next round?

On Fri, Sep 4, 2009 at 11:34 AM, Rajat  wrote:

>
> Wouldn't it be great if the scoreboard had some filter features. We
> could make great use of filtering out users by their preferred
> programming language. Or we would love to have a scoreboard which
> would show users from a selected country only.
>
> If not others, at least, grouping by countries, and programming
> language choices would have been really good for the scoreboard.
>
> @Code Jam Team: Would it take a lot to introduce these features. Its
> just a humble request (and not only mine). However, i would also like
> to mention that the current status is also fine, rather great. But we
> would love to be able to download solutions of the language we want,
> and see "how people from our country are participating", "where do i
> stand among users in my country"..
>
> Thanks and regards,
>
> Rajat. :)
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---



[gcj] Re: thanks

2009-08-31 Thread samuel jawahar
Hello please tell the start and end time of the contest in india, in india
times
Regards
Jawahar

On Thu, Aug 27, 2009 at 6:42 AM, sun eghost  wrote:

> hello! everyone, nice to meet you!
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---



Re: Does Google give a chance for recruitment for successful contestants of CodeJam?

2009-08-16 Thread samuel jawahar
If u r from any IIt or above u can hope,or if u r a Turing

On Sun, Aug 16, 2009 at 1:44 PM, Mani  wrote:

>
> I want to know the opportunities given , if any?
> And how much candidates manage to get those?
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---



Re: Hi,jam.Can you give me some examples about C program.

2009-08-14 Thread samuel jawahar
any one in this mail chain is TOPCODE?

On Fri, Aug 14, 2009 at 5:12 PM, token0  wrote:

>
> The second is right.
> The questions are always the same.
> Inputs and outputs are not different for C and C++.
> You can always choose the language you use. For example you can solve
> a part of the question with C and another part with Javascript.
> You only have to submit the output, and the code you used
> (.cpp, .c, ...) to get the output.
> Jam only asks for "preferred programming language" to have some
> statistics, you are not forced to use the language you selected.
>
> To get solutions,  in http://code.google.com/codejam/contest/
> click Practice Contest, Full scoreboard, Solution Download, and choose
> a file.
>
> For example, in Practice Contest, try to solve Old Magician. One
> solution is
> http://codepad.org/ifN7eFOL
> compile it, click 'Download A-small.in' and run the program. It will
> create a A-small-practice.out file - submit it.
> In a normal contest, you must also submit the source code (usually
> the .cpp file).
>
> If you don't understand the question, maybe http://translate.google.com/
> will help.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---



Re: Is there any coder from Israel Here?

2009-08-12 Thread samuel jawahar
R u Jew ?

On Wed, Aug 12, 2009 at 5:37 PM, Raphael Fogel  wrote:

>
> I am looking for an Israeli coder for a blog post
>
> Best,
> Raphael Fogel
> www.startupmania.co.il
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---



Re: Program Testing

2009-08-06 Thread samuel jawahar

when wll be the code jam?

On 8/5/09, Hugo Benicio  wrote:
> Precisely :)
>
> On Wed, Aug 5, 2009 at 2:21 PM, Aditya Bhiday
> wrote:
>
>> Yes, I meant compiler. Sorry for the mistake. The idea is that if you use
>> a
>> CLI to run your compiled code then it is easier and much more
>> straightforward to redirect input and output than from a IDE. Macintosh
>> does
>> have a linux-like terminal and the redirection operators work just fine.
>>
>>
>> --
>> Regards,
>> Aditya Bhiday
>>
>> >
>>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~--~~~~--~~--~--~---