CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Forums
    • Blog
    • Wiki
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
    • Event Calendar
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » July 2011 Long Contest » Most Popular Friend

Most Popular Friend

Problem code: LOKBIL

  • All Submissions

All submissions for this problem are available.

Anna Hazare is a well known social activist in India.

On 5th April, 2011 he started "Lokpal Bill movement".

Chef is very excited about this movement. He is thinking of contributing to it. He gathers his cook-herd and starts thinking about how our community can contribute to this.

All of them are excited about this too, but no one could come up with any idea. Cooks were slightly disappointed with this and went to consult their friends.

One of the geekiest friend gave them the idea of spreading knowledge through Facebook. But we do not want to spam people's wall. So our cook came up with the idea of dividing Facebook users into small friend groups and then identify the most popular friend in each group and post on his / her wall. They started dividing users into groups of friends and identifying the most popular amongst them.

The notoriety of a friend is defined as the averaged distance from all the other friends in his / her group. This measure considers the friend himself, and the trivial distance of '0' that he / she has with himself / herself.

The most popular friend in a group is the friend whose notoriety is least among all the friends in the group.

Distance between X and Y is defined as follows:
Minimum number of profiles that X needs to visit for reaching Y's profile(Including Y's profile). X can open only those profiles which are in the friend list of the current opened profile. For Example:
- Suppose A is friend of B.
- B has two friends C and D.
- E is a friend of D.

Now, the distance between A and B is 1, A and C is 2, C and E is 3.

So, one of our smart cooks took the responsibility of identifying the most popular friend in each group and others will go to persuade them for posting. This cheeky fellow knows that he can release his burden by giving this task as a long contest problem.

Now, he is asking you to write a program to identify the most popular friend among all the friends in each group. Also, our smart cook wants to know the average distance of everyone from the most popular friend.

Input

Friends in a group are labelled with numbers to hide their Facebook identity. The first line of input contains the number of groups in which users are divided. First line of each group contains the number of friends that belong to that group. ith line of each group contains the space separated friend list of 'i'. You are assured that each friend's profile can be accessed by the profile of every other friend by following some sequence of profile visits.

Output

Your output contains the most popular friend name label along with the average distance (space separated) from all other friends (including himself / herself) in six digits of precision. There might be multiple most popular friend, in that case output the friend labelled with least number.

Note:

Each person in a group have atleast one friend and he/she cannot be in his/her own friend list.
Number of friends in a group cannot be more than 100.
There are atmost 100 groups.

Example

Input:
1
6
3
5
1 4
3 5 6
2 4 6
4 5

Output:
4 1.166667

Author: ashwin_jain
Date Added: 14-06-2011
Time Limit: 1 sec
Source Limit: 50000 Bytes
Languages: ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC


  • Submit

Comments

  • Login or Register to post a comment.

sumone plz explain the

skygar @ 1 Jul 2011 03:11 PM
sumone plz explain the meaning of "ith line of each group contains the space separated friend list of 'i'."

@skygar: ith line lists all

praveen97uma @ 1 Jul 2011 03:30 PM
@skygar: ith line lists all the friends who are friends of a user with name 'i'

@praveen: thanks

skygar @ 1 Jul 2011 03:53 PM
@praveen: thanks

any one can describe the

ar3_ar @ 1 Jul 2011 03:57 PM
any one can describe the output.. please i need it..

what we hav to print if there

amnsinghl @ 1 Jul 2011 03:59 PM
what we hav to print if there are more than one people having minimum average distance

Its written in the last line

ashwin_adm @ 1 Jul 2011 04:30 PM
Its written in the last line of output that friend with the least label should be printed in that case..

am new to codechef can anyone

crazyjairam @ 1 Jul 2011 04:41 PM
am new to codechef can anyone help how to understand the given input...am not clear with the terminology of the ith line and all.....

You have bug in tests - for

EgorK @ 1 Jul 2011 05:29 PM
You have bug in tests - for some test one of people is on his own friend list. See diff between my last 2 submits

I absolutely agree with

pasin30055 @ 1 Jul 2011 05:41 PM
I absolutely agree with EgorK.

I also agree with EgorK.

jyotesh @ 1 Jul 2011 06:17 PM
I also agree with EgorK.

Thanx Egork , u saved some of

sushilnath @ 1 Jul 2011 06:19 PM
Thanx Egork , u saved some of my time !!!

in the sample input, user 5

garggaurav1995 @ 1 Jul 2011 06:45 PM
in the sample input, user 5 is on three friendlists. That means there are 3 ways he can reach any user. Do we take the shortest distance to calculate the average?

@admin: all the groups will

login_test @ 1 Jul 2011 07:03 PM
@admin: all the groups will have friend list starting from 1. Means person 1 is guaranteed to exist in all the groups? Or everyone will appear in all groups? I should say the problem description and the sample case given is really poor. It can't even clear the problem description. Please help.

plz anyone describe testcase

rijin @ 1 Jul 2011 07:13 PM
plz anyone describe testcase

Is friendship mutual?

arjunarul @ 1 Jul 2011 07:30 PM
Is friendship mutual?

wot is 3 5 1 4 3 5 6 2 4

rijin @ 1 Jul 2011 07:47 PM
wot is 3 5 1 4 3 5 6 2 4 6 4 5

yes, the test cases are not

aseem_pandey @ 1 Jul 2011 07:50 PM
yes, the test cases are not proper.

Is friendship mutual? From

pratikmoona @ 1 Jul 2011 08:30 PM
Is friendship mutual? From the example explained in the problem statement, it seems so. Could anyone confirm?

@pratikmoona yes

migdal @ 1 Jul 2011 09:07 PM
@pratikmoona yes

Must we put away unuseful

victorjavadore @ 1 Jul 2011 09:30 PM
Must we put away unuseful zeroes (e.g. 0.25 instead of 0.250000) in the average notoriety ?

plz explain d test case after

tj91 @ 1 Jul 2011 09:35 PM
plz explain d test case after 1 wats that 6 3 and 5

after 1 that 6 indicates

tj91 @ 1 Jul 2011 09:37 PM
after 1 that 6 indicates there are 6 ppl ind group??????????????

sorry got it

tj91 @ 1 Jul 2011 09:39 PM
sorry got it

I don't have much issues with

gultus @ 1 Jul 2011 09:42 PM
I don't have much issues with the problem description but the input section could have been written in a better way. Specially the point that pratik has raised friendships are mutual has to be mentioned.

Also I was wondering why the

gultus @ 1 Jul 2011 09:48 PM
Also I was wondering why the upload option has been disabled. I had to spend considerable amount of time figuring out what I had done wrong when I fixed the code on my local file andpasted an old piece of copied code and was still getting a WA. Had a quite little laugh after I noticed the silly mistake though.

What is the minimum number of

login_test @ 1 Jul 2011 11:05 PM
What is the minimum number of people a group can have? 0 ??

@ EgorK : "You have bug in

rijin @ 2 Jul 2011 12:37 AM
@ EgorK : "You have bug in tests - for some test one of people is on his own friend list." .....in this case the avg. will reduce? then is there is any meaning of mutual frnd?

@login_test: What is the

ritesh_gupta @ 2 Jul 2011 01:10 AM
@login_test: What is the minimum number of people a group can have is 1...

@login_test:::the minimum

ritesh_gupta @ 2 Jul 2011 01:11 AM
@login_test:::the minimum number of people a group can have is 1...

@ admin::I believe Java judge

ritesh_gupta @ 2 Jul 2011 01:24 AM
@ admin::I believe Java judge has bcome vry sorry..I tried this problem in Java and got TLE badly...Then with the same logic ,i wrote code in c++ ,it got accepted

I think I have problems with

victorjavadore @ 2 Jul 2011 03:27 AM
I think I have problems with the output format. Is this kind of output right ? 1 0.000000 4 1.166667 4 1.250000 2 0.833333 1 1.000000 (There were 5 test cases, of course.)

(There are new lines instead

victorjavadore @ 2 Jul 2011 03:28 AM
(There are new lines instead of blanks, the post broke it)

(And only after the "float"

victorjavadore @ 2 Jul 2011 03:29 AM
(And only after the "float" numbers, of course. Sorry for triple post. :s)

Thank you! In a group with

login_test @ 2 Jul 2011 07:46 AM
Thank you! In a group with only 1 member, is a blank line after 1 guaranteed in test cases??

does the label of friends in

codeprav @ 2 Jul 2011 08:33 AM
does the label of friends in each group starts with 1

seperate output for each

codeprav @ 2 Jul 2011 08:36 AM
seperate output for each group

@ all : 1 3 '1 2 3' '1 2

rijin @ 2 Jul 2011 10:53 AM
@ all : 1 3 '1 2 3' '1 2 3' '1 2 3' wot happend in this case, is it possible input?

Sorry for late replies.

ashwin_adm @ 2 Jul 2011 01:26 PM
Sorry for late replies. @garggaurav1995: yes, shortest should be considered. @arjunarul, @assen_pandey: yes, friendship is mutual @login_test: Minimum number of group members are 2. @ritesh_gupta: Problem is well tested with java. @victorjavadore: There are no extra new lines in test cases, and yes 1 0.000000 4 1.166667 4 1.250000 2 0.833333 1 1.000000 is correct output. @codeprav: yes, labels start with 1. Yes, you need to give separate output for each group. @rijin: No, this is not a possible input test case, as friend 1 can not in the friend list of friend 1.

Getting wrong answer. What

prakash1529 @ 2 Jul 2011 01:29 PM
Getting wrong answer. What should be the format of output in case of multiple friends with same average distance. For the below ex 1 3 2 3 3 1 1 2 Which of the following is the correct format ?? 1 0.666667 2 0.666667 3 0.666667 or 1 2 3 0.666667 ???

Can input lines have spaces

LGod @ 2 Jul 2011 03:00 PM
Can input lines have spaces at the begin?

@prakash1529 : I think it

victorjavadore @ 2 Jul 2011 03:50 PM
@prakash1529 : I think it sould be simply '1 0.666667'.

ppl please post your test

baruntar @ 2 Jul 2011 05:00 PM
ppl please post your test cases too... it will help other understand too... my test cases are 3n 3n 2 3n 1 3n 1 2n 1n n 6n 3n 5n 1 4n 3 5 6n 2 4 6n 4 5, and i got outputs as 3 0.666667n 1 0.000000n 4 1.666667n (ignore spaces after n, just to make it readable).... but i am getting wrong answer....

@victorjavadore: Hey thanks a

prakash1529 @ 2 Jul 2011 05:18 PM
@victorjavadore: Hey thanks a lot :) It worked like a charm with your suggestion :)

@baruntar: Your output for

prakash1529 @ 2 Jul 2011 05:22 PM
@baruntar: Your output for the first group is not correct. It must be 1 0.666667 and not 3 0.666667 . Read my doubt 4 posts above and cleared by victor.

Hey, it is mentioned that

rraahhuul @ 2 Jul 2011 05:39 PM
Hey, it is mentioned that "ith line of each group contains the space separated friend list of 'i' " . But while taking input, how will i be able to make out whether a number read was in the same line or in the next one ?? I havent seen variable number of space separated arguments on code-chef before. please help.

@rraahhuul We can take the

ambujpandey @ 2 Jul 2011 07:17 PM
@rraahhuul We can take the entire line as a string, using 'gets' I suppose. Then we can take out the numbers.

can we see the test cases for

roheet @ 2 Jul 2011 08:28 PM
can we see the test cases for our submission? how can people see their output?

@rrahuuul : '\n' is the

prakash1529 @ 2 Jul 2011 09:08 PM
@rrahuuul : 'n' is the distinction between ith line and (i+1)th line :) So look for it.

is it possible that distances

amnsinghl @ 2 Jul 2011 10:11 PM
is it possible that distances b/w two people is infinite i.e. there is no way for a person to go to some person?

@amnsinghl::Read the last

ritesh_gupta @ 2 Jul 2011 11:21 PM
@amnsinghl::Read the last statement of INPUT "You are assured that each friend's profile can be accessed by the profile of every other friend by following some sequence of profile visits."So cant be infinite

output for different groups

mehankit7 @ 3 Jul 2011 01:21 AM
output for different groups is line separated or space separated?

Getting tle..wondering if bfs

evanescent @ 3 Jul 2011 05:19 AM
Getting tle..wondering if bfs is non-optimal here or I m doing smthin silly to cause tle?

Getting wrong answer. Cannot

pkvprakash_86 @ 3 Jul 2011 01:05 PM
Getting wrong answer. Cannot spot why.

can I get the test case which

pkvprakash_86 @ 3 Jul 2011 01:08 PM
can I get the test case which gave wrong answer?

Yea.. I got the bug.

pkvprakash_86 @ 3 Jul 2011 01:19 PM
Yea.. I got the bug.

Hello, I have been trying to

rj_rohit @ 3 Jul 2011 02:23 PM
Hello, I have been trying to solve this but getting WA again and again. Can anyone please check 589611 submission id and let me know what am i missing?

What is the meaning of the

aasthamittal @ 3 Jul 2011 03:22 PM
What is the meaning of the source limit? MB of RAM? Kb of RAM?

hi,my submission id is

aadibmsit @ 3 Jul 2011 04:29 PM
hi,my submission id is 589734,may I know for which test case it is getting failed.

@admin Can we actually use

ambujpandey @ 3 Jul 2011 05:04 PM
@admin Can we actually use gets or getline to take the entire line as input? Would it work here? Would the string so obtained have a '/0' at the end?

FOR SUBMISSION IN JAVA - MOST

tsubhasis @ 3 Jul 2011 07:31 PM
FOR SUBMISSION IN JAVA - MOST OF THE TIME IT SAYS "TIME LIMIT EXCEEDED". PARTICIPATION FROM JAVA COMMUNITY WILL SHRINK DAY BY DAY!!!

hmm...generated a100*100

evanescent @ 3 Jul 2011 07:39 PM
hmm...generated a100*100 random test case sequence...runs on my machine under 1s...gives tle here....io is buffered..wondering wat can be done now...

@ all : 1 3 '2 3' '1 3' '1 2'

rijin @ 3 Jul 2011 09:20 PM
@ all : 1 3 '2 3' '1 3' '1 2' wot is ouput of this case?

@tsubhasis:Infact i got same

ritesh_gupta @ 3 Jul 2011 09:21 PM
@tsubhasis:Infact i got same problem in java..use same logic that u used in java and code in c or c++,it will definitely pass the judge....me 2 had the same proble (TLE) but got accepted when i switched to c++ frm java for dis problem

hey what will be the distance

hpahuja @ 3 Jul 2011 09:34 PM
hey what will be the distance bw the nodes of disconnected trees in the graph?

@rijin It is 1 0.666667,

ambujpandey @ 3 Jul 2011 09:42 PM
@rijin It is 1 0.666667, isn't it.

@ambu : thx, but its all

rijin @ 3 Jul 2011 09:47 PM
@ambu : thx, but its all same for all nodes, then y 1?

@rijin "There might be

ambujpandey @ 3 Jul 2011 09:48 PM
@rijin "There might be multiple most popular friend, in that case output the friend labelled with least number. "

Fed up of getting WA. Formed

ambujpandey @ 3 Jul 2011 09:56 PM
Fed up of getting WA. Formed several test cases arbitrarily and getting correct answers for them on my PC. Could using 'gets()' may be a problem on codechef? Can the admin please check my solution and tell whether it is PRINTING something or not, so i can be assured that there is a problem with my algorithm and not Input/Output mechanism.

@hpahuja the graph is

migdal @ 3 Jul 2011 11:29 PM
@hpahuja the graph is connected

@ambujpandey try taking input

migdal @ 3 Jul 2011 11:32 PM
@ambujpandey try taking input by scanning character by character

I think test cases have been

KK123 @ 4 Jul 2011 12:01 AM
I think test cases have been modified so that a person is not on his/her friend list.... @ambuj Pandey... gets() works fine on codechef... or else u can try something like: do{ scanf("%d", &m); // add it to ur DS ch = getchar(); }while(ch != 'n');

@ambuj: its backslash n in

KK123 @ 4 Jul 2011 12:02 AM
@ambuj: its backslash n in the while condition

@KK123 Thanks, but still

ambujpandey @ 4 Jul 2011 01:20 AM
@KK123 Thanks, but still getting WA. I wonder where I'm going wrong. Its a simple graph problem. Seems like I'll have to wait for 11th for this.

@ambuj : use ideone.com to

mkagenius @ 4 Jul 2011 02:48 AM
@ambuj : use ideone.com to try your program, it uses same engine as cc, i.e sphere.

is it possible to solve this

matavanga @ 4 Jul 2011 03:13 AM
is it possible to solve this problem in python within timelimit?

Beware of the hideous extra

ziyao_wei @ 4 Jul 2011 07:41 AM
Beware of the hideous extra empty lines between the groups... Costs me more than 2 hours for this.

what is output format for

bittu_it @ 4 Jul 2011 10:02 AM
what is output format for more than 1 group ............i consider ........enter a new line between each group and output.......is am i correct

rj_rohit -> Incorrect

ashwin_adm @ 4 Jul 2011 10:18 AM
rj_rohit -> Incorrect output aadibmsit -> Output format is not correct check tsubhasis -> Java solutions are accepted for this problem. You can still can do some optimization in your CODE. check ambujpandey-> There is a small bug in your solution. :)

@admin: can you tell me

baruntar @ 4 Jul 2011 11:03 AM
@admin: can you tell me whether I am getting error due to output format or logic??

@ashwin_adm Couldn't find the

ambujpandey @ 4 Jul 2011 11:58 AM
@ashwin_adm Couldn't find the bug at all. Checked the lower bounds. Checked the solution for groups with upto 10 friends. I find the algorithm sound. Yet... :(

@aswin_admin: what is the run

bittu_it @ 4 Jul 2011 12:45 PM
@aswin_admin: what is the run time error in my Program ID 590662. It run on my PC

In the question we have "Now,

urbaddy @ 4 Jul 2011 12:55 PM
In the question we have "Now, the distance between A and B is 1, A and C is 2, C and E is 3. " is it correct ? Is it not " A and E is 3" ? Someone help me to understand..

@urbaddy: Yes , it is

bittu_it @ 4 Jul 2011 01:16 PM
@urbaddy: Yes , it is correct, to visit C to E , it follow the path, C-->B, B-->D, D-->E, so total path is equal to 3. And "A and E is 3" is also correct, it follow path, A-->B, B-->D, D-->E

@ashwin_adm:thanks for your

aadibmsit @ 4 Jul 2011 01:22 PM
@ashwin_adm:thanks for your replly. Which of the following is right formate 1 1.166667 2 1.166667(space used bet group) Or 1 1.166667new line 2 1.166667

@admin:can u please give

evanescent @ 4 Jul 2011 01:40 PM
@admin:can u please give example for io format when there are more than one test cases..

@bb_1: Explain the test case,

gentleman @ 4 Jul 2011 02:28 PM
@bb_1: Explain the test case, please?

plz suggest some typical test

ridder @ 4 Jul 2011 11:59 PM
plz suggest some typical test cases for this problem.......i have tried some and my soln works fine on my system.....Thnx in advance

if anyone cud tell the prob

ridder @ 5 Jul 2011 12:02 AM
if anyone cud tell the prob in my code my id is 591505

I Need Bit Help In taking

kooljay999 @ 5 Jul 2011 03:18 AM
I Need Bit Help In taking input (c++)..to store how many friends ' i 'has is a prob .. (as each may have different number of friends) i was using vector ............but it is not standard and i m unable to find an alternative.. I know rest coding just need help taking Input... Please Give me Hint what should I use to store it.... plz ASAP

@kooljay : read KK123 @ 4 Jul

rijin @ 5 Jul 2011 05:07 AM
@kooljay : read KK123 @ 4 Jul 2011 12:01 AM

@rijin : Thanks :)

kooljay999 @ 5 Jul 2011 06:05 AM
@rijin : Thanks :)

Are you certain there isn't a

pratikmoona @ 5 Jul 2011 08:47 AM
Are you certain there isn't a stray space or a newline in the code? Other could you please check my last submission and tell me if the problem is in the algorithm (which it shouldn't be!) or in the I/O?

i just submitted @pratikmoona

rijin @ 5 Jul 2011 08:54 AM
i just submitted @pratikmoona : think abt problem and we can't read normal way read char via ; and dont forget this there is more than one test case ;

I have tried reading the

pratikmoona @ 5 Jul 2011 09:03 AM
I have tried reading the input in many different ways. The whole input for a given user as a string and then parsing it, reading numbers till I encounter a newline character.

And I have also tried it with

pratikmoona @ 5 Jul 2011 09:07 AM
And I have also tried it with multiple test cases.

@bittu_it: Refer

ashwin_adm @ 5 Jul 2011 09:10 AM
@bittu_it: Refer http://www.codechef.com/wiki/faq @aadlbmsit @evanescent: 1 1.166667new line 2 1.166667 is correct @pratikmoona: Input is correct as written in Input para

@Admin: I know it is not

pratikmoona @ 5 Jul 2011 09:19 AM
@Admin: I know it is not right to ask, but could you please tell me if my output is completely wrong, or is it slightly off for some particular case(s)?

@migdal.@hpahuja or

hungrycoder @ 5 Jul 2011 12:38 PM
@migdal.@hpahuja or @ambujpandey what u guyz mean by a graph problem????I was thinking in some other way....but whenever I was implementing on ideone it was giving runtime error....I am a new learner ..so if there is any alternative approach then pls just give me a hint....pls

I am pretty sure that i I

hungrycoder @ 5 Jul 2011 12:41 PM
I am pretty sure that i I come up with sigsegv ,I will get tle...coz my algo is a recursive one....not much moderated....I need a different algo....

@KK123 thanx buddy,your post

durgesh333 @ 5 Jul 2011 07:43 PM
@KK123 thanx buddy,your post help me ,i ran my code at ideone.com & caught bugs. thanx a lot.

@mkagenious sorry it's u

durgesh333 @ 5 Jul 2011 07:53 PM
@mkagenious sorry it's u thanx buddy,your post help me ,i ran my code at ideone.com & caught bugs. thanx a lot.

@Admin: Could you please go

pratikmoona @ 5 Jul 2011 11:02 PM
@Admin: Could you please go through my submissions? The algorithm's implementation cannot be wrong! I have tried and tested it a lot... Is my choice of the algorithm wrong completely or what? I also wish to confirm a few things, Will the friend list of any user "i" contain all its friends or a subset of them, i.e., if friendship is mutual, and say, i has friends j, k, l then will j, k, l definitely be there in the line corresponding to i or is that not necessary?

@admin plz help me i m

amnsinghl @ 5 Jul 2011 11:30 PM
@admin plz help me i m getting wrong answer again and again my sollution id is 588802

@admin bug sorted out sorry

amnsinghl @ 6 Jul 2011 11:10 AM
@admin bug sorted out sorry for my above statement

gets() is working fine for

manoharsingh23 @ 6 Jul 2011 07:48 PM
gets() is working fine for this problem!! No complaints :)

plz help! if friends of 1 are

amnsinghl @ 6 Jul 2011 10:31 PM
plz help! if friends of 1 are 2 3 4 then in the input is it necessary that 1 is entered while entering the friend list of 2, 3 & 4

Hi ,I have been trying this

siddharth_l @ 7 Jul 2011 12:42 AM
Hi ,I have been trying this program for a lot of time but getting WA again and again.Can someone pls tell me what i am missing?submission id is 594044.plss help

im sorry for double posting

siddharth_l @ 7 Jul 2011 03:18 AM
im sorry for double posting but can u pls tell me if the error is something to do with floating point comparisons or something else?still not getting it..

@amnsinghi: Yes, 1 should be

ashwin_adm @ 7 Jul 2011 01:01 PM
@amnsinghi: Yes, 1 should be in all the three.

can someone just c my code

hack_world @ 8 Jul 2011 05:28 PM
can someone just c my code and tell me whats wrong with it . just can't understand . am getting WR all the time. my code id is 595485.

@hack_world: no one is going

mkagenius @ 8 Jul 2011 06:31 PM
@hack_world: no one is going to see your code, since this is a competition going on. :(

@admin : i am getting the

hack_world @ 8 Jul 2011 07:43 PM
@admin : i am getting the right output on my PC but WR on codechef .please tell me whether my output format is wrong or what . pls help

I finally lowered my

ambujpandey @ 8 Jul 2011 11:59 PM
I finally lowered my algorithm, unwillingly, and it got accepted.

one minor doubt : output is

anshulgoyal @ 9 Jul 2011 11:34 AM
one minor doubt : output is "most popular friend from each group" OR "most popular friend from each group" i mean number of lines in o/p is "1" OR it is equal to number of groups.. please clarify

@anshulgoyal: The output

hack_world @ 9 Jul 2011 12:25 PM
@anshulgoyal: The output should be one for each group. if n groups are there then n outputs are also there.

@hack_world: thanx for reply

anshulgoyal @ 9 Jul 2011 01:32 PM
@hack_world: thanx for reply

Can someone check my code and

hack_world @ 9 Jul 2011 02:11 PM
Can someone check my code and tell me whether the error is in the format of my output or in the code? id 596207 pls reply fast. anyone

what would be the distance

nakshtra @ 9 Jul 2011 02:14 PM
what would be the distance between A & D in problem statement?

Guys plz can u post ur test

latitude @ 9 Jul 2011 06:24 PM
Guys plz can u post ur test cases , getting Wrong Answer again and again :(

help somebody please....I am

hungrycoder @ 9 Jul 2011 09:10 PM
help somebody please....I am done with the code.....but input is a bit troubling me....i m doing do { scanf("%c",&temp); if(i%2==0) { Arr[k]=toascii(temp)-48; k++; } i++; } while(temp!='n'); but every time its showing sigsegv.....please somebody help me with the inputs....without this portion my code is pretty optimised and working fine.....but i cant handle this issue

its backslash n in the

hungrycoder @ 9 Jul 2011 09:11 PM
its backslash n in the condition

@admin: Can you plz let me

zoobiedoobie @ 9 Jul 2011 10:43 PM
@admin: Can you plz let me know whether bug is in logic or output formatting in my latest soln?

i'm getting tle.i'm using

jay3dec @ 10 Jul 2011 01:50 AM
i'm getting tle.i'm using C.How to test for the worst case here.dat is 100*100?any one...

ok my input problem is solved

hungrycoder @ 10 Jul 2011 02:57 AM
ok my input problem is solved happy :)

hey admin I am getting tle on

hungrycoder @ 11 Jul 2011 01:33 AM
hey admin I am getting tle on submission can u please verify my answer and give me some hints for the improvement of my algorithm?

hey what does tle

hungrycoder @ 11 Jul 2011 01:51 AM
hey what does tle mean????code didnt compile within the stipulated time or code didnt run and produce output within the given time????

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions, CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our programming contest judge accepts solutions in over 35+ programming languages. Preparing for coding contests were never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming challenges that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly coding contest and the shorter format Cook-off coding contest. Put yourself up for recognition and win great prizes. Our programming contests have prizes worth up to Rs.20,000 and $700lots more CodeChef goodies up for grabs.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the CodeChef Forums and Wiki section.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. You can also host a coding contest for your institute on CodeChef, organize an algorithm event and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com