Team SelectionProblem code: TEAMSEL |
One of the cherished customs of my childhood was choosing up sides for a cricket game. We did it this way: The two bullies of our gully would appoint themselves captains of the opposing teams, and then they would take turns picking other players. On each round, a captain would choose the most capable (or, towards the end, the least inept) player from the pool of remaining candidates, until everyone present had been assigned to one side or the other. The aim of this ritual was to produce two evenly matched teams and, along the way, to remind each of us of our precise ranking in the neighbourhood pecking order.
We all believed this was the fairest process, but does it ensure the fairest selection of players with evenly matched teams? We believed so, but then there were times when, as the game progressed we realized that the other team was stronger than ours and may be an exchange of a couple of players between the teams would have made them balanced. That scope of improvement seemed to be there...
Here, we need to find a way to create two evenly balanced teams for any game(or as evenly balanced as possible considering the strength of each player). A set of players must be divided into two teams. Each player must be on one team or the other; the number of player on the two teams must not differ by more than 1; each player will have a skill-point associated with him. The total skill-points of the players on each team should be as nearly equal as possible.(The absolute difference of the sum of skill-points of players in each team should be the least).
Input
The first line of input will contain the number of test cases 'T'(1<=T<=100). This is followed by 'T' test cases. Each test case starts with a blank line, followed by N, the total number of players. N lines will follow with the first line giving the skill-point of person 1; the second line, the skill-point of person 2; and so on. Each skill-point shall be an integer between 1 and 450. There shall be at most 100 players in all(1<=N<=100).
Output
Your output should be exactly '2T-1' lines. The output for each test case should be followed by a blank line, except the output for the last test case. Each odd numbered line should contain 2 numbers: the total skill-points of the players on one team, and the total skill-points of the players on the other team. Print the smaller sum first.
Example
Input: 4 3 90 200 100 10 2 3 10 5 8 9 7 3 5 2 10 1 1 1 1 1 1 1 1 1 9 8 87 100 28 67 68 41 67 1 Output: 190 200 27 27 5 13 229 230
| Date: | 2009-05-20 |
| Time limit: | 5s |
| Source limit: | 50000 |
| Languages: | C C99 strict C++ PAS gpc PAS fpc JAVA NICE JAR C# C#2 NEM ST ASM D FORT ADA BASH PERL PYTH RUBY LUA ICON PIKE PHP SCM guile SCM qobi LISP sbcl LISP clisp HASK CAML CLPS PRLG WSPC BF ICK |
Comments
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
HELP
Program should read from standard input and write to standard output. After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:
- Accepted
Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark. - Time Limit Exceeded
Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach. - Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output. - Runtime Error
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section. - Compilation Error
Your code was unable to compile. When you see this icon, click on it for more information.
If you are still having problems, see a sample solution here.

Fetching successful submissions

I am not sure why my solution is not being accpeted.
Its working perfectly on my system. Is there a way to know how you give the input and match the output?
What should the program do when the wrong input is provided?
lets say the skill point entered is 500, what should be the expected behaviour?
If possible, then mail the Input data for which the code is failed.
It is not possible to mail the input data as of now. If you have any particular problems, post in the forums for hints about the approach.
I second the need for input data or at least output data. For what I can tell my solution works. But not sure what input data is causing it to produce incorrect results. Also what should be output if team size is 1? I line with 0 x where x is skill points or a line with just x?
@jeremy Print the smaller number first.
I tried to solve TEAMSEL problem using Min-Max algorithm. Program ran for 0.35 seconds and it produced wrong output. while the counter on the process bar on right side has gone to (8). Does it mean that it gave wrong output for 8th test case ???
That's not necessary. Even if it fails one test case, you get the status as WA.
I did some experiment with
I did some experiment with
Your code is run on multiple
Your code is run on multiple input files. If your code has not produced the correct answer for a file, the time reported is the time at that point.
The first file is likely to be small input cases, which is why your code only takes 0.74 seconds to virtually complete it before throwing the exception. If you put the exception on the 101st case (which doesn't exist, ie you'll never throw an exception) it is getting onto other more complicated input files and running out of time on those.
So you'll need to work on improving your algorithm to work with large test cases.
The fact there are multiple input files + that the time reported is the sum of all input files is mentioned in the FAQ which you should read.
I did read the relevant FAQ
Hi Admin, As per problem
Team 1 has 2 players with
Team 1 has 2 players with scores 100 and 90 and Team2 has 1 player with score 200.
but player with score 3 has
Read the input specifications
Read the input specifications again. 3 is the number of players and not the strength value of one of the players.
Its working perfectly on my
Its working perfectly on my system. I have tried few test cases on my system everything works fine. Can you please give me the hint where my code fails? is it for all the test cases or just few? or Is it because of the boundry conditions? is it because of time? Could you give me any hint, that can help me to find the root cause.
Its working perfectly on my
Its working perfectly on my system. I have tried few test cases on my system everything works fine. Can you please give me the hint where my code fails? is it for all the test cases or just few? or Is it because of the boundry conditions? is it because of time? Could you give me any hint, that can help me to find the root cause.
Thanks
Uvaraj
You can try brute-forcing
You can try brute-forcing through small samples and checking out if the answers match. We can't give specific help regarding this problem as we use it for recruitment purposes.
Questions rules and
Questions rules and given answers are not matching :
Team 1 :200
Team 2: 90,100
isn' t rule number 1 broken ? why 3 is not selected ?
are we allowed to break any rule?
In another Question :
how come is the output
5 13
i can see there are 11 players
and to me output seems to be :
14 14
3 is the number of players
3 is the number of players and not one of the players.
can i have test case input
can i have test case input file for this problem.
currently it is not possible
currently it is not possible to give you the input file for the problem. The major reason for this being that people can hardcode the values if the input file is made public.
My solution is not being
My solution is not being accepted (even not processed) with this error message, as soon as i press the submit button:
warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 1: parser error : Start tag expected, '<' not found in /var/www/html/codechefbeta/codechef/sites/all/modules/codechef_judge/codechef_judge.module on line 48.
I could not understand if something is wrong with my code, as it is running fine on my computer. Need your kind guidance.
Regards,
Nimesh
Hi Admin, The error soon
Hi Admin,
The error soon after pressing the submit key is this:
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /var/www/html/codechefbeta/codechef/sites/all/modules/codechef_judge/codechef_judge.module:48 Stack trace: #0 /var/www/html/codechefbeta/codechef/sites/all/modules/codechef_judge/codechef_judge.module(48): SimpleXMLElement->__construct('admin<br />?<b>...') #1 /var/www/html/codechefbeta/codechef/modules/node/node.module(673): codechef_judge_nodeapi(Object(stdClass), 'validate', Array, NULL) #2 /var/www/html/codechefbeta/codechef/modules/node/node.module(809): node_invoke_nodeapi(Object(stdClass), 'validate', Array) #3 /var/www/html/codechefbeta/codechef/modules/node/node.pages.inc(65): node_validate(Array, Array) #4 /var/www/html/codechefbeta/codechef/includes/form.inc(766): node_form_validate(Array, Array) #5 /var/www/html/codechefbeta/codechef/includes/form.inc(714): form_execute_handlers('validate', Array, Array) #6 /var/www/html/codechefbeta/codechef/includes/form.inc(579): _form_validate(Array, Array, 'answer_node_for...') in /var/www/html/codechefbeta/codechef/sites/all/modules/codechef_judge/codechef_judge.module on line 48
Thanks and Regards,
Nimesh
Hi Admin, Does the time limit
Hi Admin,
Does the time limit = 5 sec mean that a java code should take at most 10 Seconds to resolve a file consisting of 100 test cases of 100 players in each test case?
Thanks in advance for the help.
Nimesh
My code submission results in
My code submission results in a compile error. Can I get the compilation error. The code compiles and runs fine on my machine. I have Java 1.6.0_11 on my system. Please help.
I have submitted the code and
I have submitted the code and it is working pretty well on my system for all the inputs, I don't understand why it failing here, any clue on this??
@Ankur Check
I have submitted the code for
and i have used the latest c#
or can i get the the test
You have to read the input
Can u tel me where my
Currently we cannot do that
Its working on my
I dont under stand why these
I dont under stand why these kind of NP complete problems, code chef used to post.
what all you are looking for a very good heuristic ???
I dont under stand why these
I dont under stand why these kind of NP complete problems, code chef used to post.
what all you are looking for a very good heuristic ???
I dont under stand why these
I dont under stand why these kind of NP complete problems, code chef used to post.
what all you are looking for a very good heuristic ???
Nope, we aren't looking for
Nope, we aren't looking for that.
The solution I submitted
The solution I submitted failed with a runtime error. I ran this program against lots of test cases. I am not able to reproduce a "crash". The program exits with the return code '1' in case of a boundary check fail. Is this OK or should I handle invalid input some other way?
Thank you,
-- Vijay
Hi, I there any way to know
Hi,
I there any way to know for which case my submissions are going wrong.
Is it the format or the value of the output?
No, currently it is not
No, currently it is not possible. The output format is specified in the problem statement. If you stick to those specifications, you shouldn't have any problems.
From the input it seems that
From the input it seems that 1 player is also a valid situation - for e.g. if there is only one player with 10 points, then the answer would be 0 10. Is this true? If no then the input condition needs to be 1 < N <= 100
The input specifications are
The input specifications are correct :)
For the following
For the following input
1
5
1
2
3
-15
2
----------------------------
Should I consider -15 as 1.. or should I skip(ignore) -15 and again ask for input?
The problem statement clearly
The problem statement clearly says each skill point in the input will be between 1 and 450.
Hi, What shoulbe be the
Hi,
What shoulbe be the output if we have only one player with his weight as 1
0 1
or just
1
I understand that the smallest number needs to be printed first, bit since the other does not exists at all in this case, is it required to print the 0
Regards,
Nandish
It tells you to print out two
It tells you to print out two numbers always; since there are no players in one team, you print a 0.
Thanks Stephen, I have
Thanks Stephen,
I have executed the program for many test cases and it works fine with all inputs, I donno where its going wrong. I am running short of test cases.Any trivial test case if you guys can share will be much appreciated. Hope this is not against the contest rule.
Hi Admin, I have compiled my
Hi Admin,
I have compiled my program on VC++, Dev C++ and Linux g++ compiler.
The same code gave two different results on VC++ and (Linux and Dev C++), though it may look a bit strange.
The input
1 5 27 108 9 207 54 gave : 198 207 on (Linux and Dev C++). which is wrong I guess, and for the same input on VC++ I got: 189 216 which is correct. Can you please advise me on this. My recent submission has the code onwhich I am facing this issue
Regards,
Nandish
When I was captain of a pool
When I was captain of a pool team some years ago, our opponents would play their people in order of strength (let's say 5 4 3 2 1). It didn't take a genius to work out that if we put in our worst player first, we'd always have an advantage, ie we would play 1' 5' 4' 3' 2', so that the games were 5 vs 1', 4 vs 5', 3 vs 4', 2 vs 3' and 1 vs 2'.
Actually the details were *slightly* more complex; we'd actually use 2 duffers against their best players to get a more reliable 3:2 advantage, and they generally also played in reverse order so that their best player & captain would play last, since against most teams, the last game was the decider. With us it was a throw-away in their favor but they'd already lost by then.
We got away with this several times before they got wise to us and adapted.
A more interesting problem would be programming the above strategy against a team that learns and adapts even during a single set of games in a match.
Karmarkar-Karp.
Karmarkar-Karp.
Do not post code here. This
Do not post code here. This is a recruitment problem, so we expect people to come up with solutions themselves.
"currently it is not possible
"currently it is not possible to give you the input file for the problem. The major reason for this being that people can hardcode the values if the input file is made public. "
Absolutely. Plus a blind pass/fail is far better at making you look at all your code (like the pascal validation suite used to do).
Since partitioning *is* an NP-complete problem, if the tests were random it is possible that some test solution has a less good value than one our code may provide. Since they are sure they have definitive answers for all tests, the conclusion must be that 1) all tests over a certain size that are from random data have a difference <= 1; and 2) if there are any tests of a size beyond that which can be brute-forced where the difference is > 1, then they're not random but carefully constructed edge cases, probably based on a smaller subset of data that *was* brute-forced and then added to in a controlled way.
I suspect that many solutions (mine included) are right for all small sets and most if not all random large sets, but not for some of these edge cases. if that is indeed what is going on, it would be cool if people could post some edge cases and we can compare what results we get.
FYI I'm playing with a sort of 'reverse bully' algorithm for the simple greedy part of the computation, pairing off the best and the worst as I mentioned in the post above. This has the benefit of giving you a wide range of differences between all the pairs, which gives you more data to work with, than the simple bully case where all the differences between pairs are minimal. It seems to converge on a best answer much faster in the average case. (Not taking any randomisation/hill climbing etc into account, just looking at the basic unit of computation)
The fact that a general form
The fact that a general form of this problem is NP-complete means nothing. The input constraints are small enough that any input that complies with the constraints should be solvable by the right algorithm inside the time limit.
Stephen, if you mean taking
Stephen, if you mean taking advantage of the constraints to do a knapsack implementation, that was my first thought, but since the folks here keep mentioning that it's used as a recruitment question, I dismissed that option: no-one would want to hire a programmer who proposed a solution with two such obvious flaws. The first flaw, relatively minor, being that the solution doesn't scale when the customer comes back with a modified spec, requiring a complete rewrite; the second being more significant - do you give your customer what he asks for or what he needs? This customer clearly needs to partition the players into 2 teams. The knapsack solution doesn't do that, it just tells you the difference in strength between the two teams but not the teams themselves. Admittedly this is exactly what is asked for in the question, but it is straining the limits of the artificial environment of test questions to believe that this is what is really wanted. I guess your average 'take the money and run' consulting company is happy when they get the opportunity to do multiple rewrites, but I wouldn't want to work for them :-)
Whether this is used as a
Whether this is used as a recruitment question or not, it is a problem in the practice section on Codechef, and every single question here and the thousands on the other online judge websites are all designed for the same purpose; you have to output exactly what is required and nothing more; it is nothing to do with scalability or, in this case, exactly what the teams are. It's just the way all programming competitions are run.
(I may well be wrong, and I haven't even solved this problem myself, but I just would be extremely surprised if this problem was so drastically different from the other thousands that are out there.)
Hi, my program passed with
Hi,
my program passed with all the test cases -wotever i tried..
but failed here - got WA.
can somebody post here some more/many diffirent testcases?
is the program supposed to
is the program supposed to check the values of t,n & skill point to check is it within its specified limit .
i am using scanf to take values or is it taken from a file.
The problem statement tells
The problem statement tells you what range the input lies in. The problem statement isn't going to tell you something that is wrong :P
You read and write from standard input + standard output.
is the program supposed to
is the program supposed to check the values of t,n & skill point to check is it within its specified limit .
i am using scanf to take values or is it taken from a file.
Hi, I am not able to see the
Hi,
I am not able to see the successful submissions for this problem(infact for any other problem). It gives the below message
"Oops, we couldn't seem to load the successfull submission. Try again soon."
Thanks
Hi, I am not able to see the
Hi,
I am not able to see the successful submissions for this problem(infact for any other problem).
It is giving the below message.
"Oops, we couldn't seem to load the successfull submission. Try again soon."
Thanks
@ Admin: what o/p shuld d
@ Admin:
what o/p shuld d program give if d value of 't' or 'n' or skill point is out of bound??
@ Admin: what o/p shuld d
@ Admin:
what o/p shuld d program give if d value of 't' or 'n' or skill point is out of bound??
And which one shuld be used
a)Is codeblocks on windows fine or
b)Linux(i have ubuntu) is preferred
The problem statement tells
The problem statement tells you the input values are within that range. If they weren't going to be in that range, it wouldn't have told you so :P
Hi Admin, I am new to this
Hi Admin,
I am new to this site.
When I submit my solution, it says "time limit exceeded". But when, by mistake I submit the same solution with my DEBUG flag on i.e. some debug messages are printed, then it says "incorrect solution" very shortly. But I would expect even in later case, the time limit to exceed. How is it possible? I was assuming that first you let the whole output to get generated and then match the output, and hence in both the cases it should give "time limit exceeded". But do you simultaneously also check for correctness of whatever output has generated so far, while the program is still running?
Thanks,
There could be multiple input
There could be multiple input files. The judge reports what happens with the first incorrect input file, so it is easy to get the results you said.
@ Admin: i am gettin correct
Yeah sure, send us the link.
Yeah sure, send us the link.
I have submitted my solution
I have submitted my solution but the result was wrong answer. Can you provide a partial test case file. For example with some 60 to 70 test cases. Not the one used to verify the answer.
Thanks & Regards
Sundaram. D
It would not be too difficult
It would not be too difficult to create sample test cases on your own.
Hi Anirudha, does exceeding
Hi Anirudha,
does exceeding the time limit mean u answer is wrong. Or can i assume that for some of the test cases it passed but the time taken was much more than the requirement.
TLE means that your program
TLE means that your program took more than the stipulated time limit to produce a result. Please don't assume anything other than this.
Codechef keep showing me
Codechef keep showing me runtime errors, I have checked and tested my solution on my local system with wide array of tests and all seems to pass without any issue. I know you can't share the test cases but atleast can you send across the exception thrown.
Please make sure that you are
Please make sure that you are taking input in accordance with the input specs. And that you are returning 0 at the end.
My program cannot return 0 as
My program cannot return 0 as its written in java. I am taking input in accordance and am throwing an exception whenever wrong input is made. For an example in my local environment this is the input I am entering
3
1
100
3
10
10
450
5
1
1
1
1
450
Output:
0 100
20 450
3 451
is this not the desired behavior? I have checked extensively with the edge cases and on the boundaries without failure in my dev environment. It would be good if you can send more informative error logs. At this point everything on my environment is working and everything on the codechef is failing, which makes me think wheter its a problem wiht my code or a limitation of your engine.
Hi Admin, I understand that
Hi Admin,
I understand that this problem is used for recruitment purpose. My solution works for all the cases that I have tried. To be honest I am trying to break my solution for two months. It passes for all the test cases I have used. Would be great if atleast one failing test case is sent.
I had posetd some issues on 1st Nov,2009 06:32:59. which was not answered. Any help would be greatly appreciated.
Regards,
Nandish
Hi Admin,I understand that
Hi Admin,
I understand that this problem is used for recruitment purpose. My solution works for all the cases that I have tried. To be honest I am trying to break my solution for two months. It passes for all the test cases I have used. Would be great if atleast one failing test case is sent.
I had posetd some issues on 1st Nov,2009 06:32:59. which was not answered. Any help would be greatly appreciated.
Regards,
Nandish
We use g++. So make sure you
We use g++. So make sure you get correct answers using that. I have no idea about VC++. Generating random test cases might not be a good idea for this problem. Test it against corner cases which you might think would fail.
to admin... i have a doubt
to admin...
i have a doubt about the output..
is the output of each test cases should be printed together at the end or individual for each test case..?
for each test case output should follow the input or the output for each test case should come at last together.
It makes no difference
It makes no difference whatsoever. There is no way the judge can tell at what time you are printing things out, only the output matters.
How the input file has to be
How the input file has to be provided to the script(ant particular convention)? I mean will it be provided, as command line arguement or what? Also is there any specific name for the output file to be generated?
You must use standard
You must use standard input/output streams.
Oh is that compulsory? In my
Oh is that compulsory? In my code I assumed that an input file will be provided while running the script & an output file will be generated corresponding to that. Could that be cause of Runtime Error.
Yes, it is compulsory.
Yes, it is compulsory.
Hi Admin, I have not
Hi Admin,
I have not recieved any reply for my earlier query at 19th Dec,2009 17:44:16. I am still getting a NZEC, which I am sure should not be the case considering th eamount of test cases I have tried. If there is some input which is crashing it it would be of great help if you can provide me with that.
Regards,
Praveen
Hi Admin, I have small
Hi Admin,
I have small doubt.
According to the problem output should be 2t-1 lines.
So for the last output do I need to do println("result") or print("result"); ?
@for others One more typical test case( I guess):
1
9
100
120
265
215
100
100
300
200
30
output:
715 715
@Praveen - of course it would
@Praveen - of course it would be a great help if you were given the test case. That is exactly why you will not be given the test case. You have to debug your code yourself.
@R C R K - println. Though if it is using a standard judge it should make no difference.
While registering I choosed
While registering I choosed python as my prefered language, can I change the language preference now?
Click 'Account' at the top
Click 'Account' at the top right of the screen.
Time shown for my code is
Time shown for my code is 0.00 and I get the wrong answer message. How is that possbile? I dont understand, how come the run time be 0.00.
Why are we not able to submit
Why are we not able to submit our solutions? Is the site under maintenance?
Regards,
Nandish
heylo i have written a DP
heylo
i have written a DP approach to this problem and it solves all the test cases that i could come up with
1 player with a team skill ... 100 players with skill 450 all the boundaries are checked and working the judge shows 0.04 secs of running time and then wrong answer ........ NO CLUE whats wrong
neways if the admin can chk it would be greatly helpful id jknair and submission id [160583]
thanks
PS : any test cases that u can think that could break the program ??
As it is a recruitment
As it is a recruitment problem, we cannot give out specific information.
I think as per most of the
I think as per most of the programmers here, I think the example given here doesn't seems to be accurate.
e.g. for the output of, 10,1,1,1,...,1,1,1,1,9 the best output can be 14 14 as it can cover most of the players and yeah it can divide teams in equal number with equal skills.
**Anyway, Can anyone help me to run my program?
I have a input.txt file with the SelectTeam.java class. How can I upload both the files at the same location so that my Class gets the input.txt file correctly.
Thanks a lot,
Kulbhushan
Also my program seems to be
Also my program seems to be working smoothly, if I run in my Eclipse environment for any number of testcases and any numbers of skilled players.
Or do you want me to provide input hardcoded in source??
Kulbhushan
The sample output is correct.
The sample output is correct. As the problem statement mentions, the first number in each set is the number of players; 10 isn't one of the skill points.
You cannot upload a text file; you are to use the standard input/output streams.
The time limit is given as
The time limit is given as 5s. But there are solutions that have greater running time (in C++) and got accepted.
FAQ
FAQ
Please let me know how can I
Please let me know how can I submit my code.
I am reading a file from my bin folder (inputFile for all test cases) and creating a new text file(output file) in bin folder.
Please guide me if I am supposed to use any other way.
You must use standard
You must use standard input/output streams.
I am using standard features
I am using standard features only and reading data from a test file. My question is does the location of the files ( "../input.txt", "../output.txt") will be an issue or should I change it to some other location ?
last message continued... Do
last message continued... Do I need to take input from console and prompt user to input numbers or filepath?
I told you already, use
I told you already, use standard input/output streams. Do not use files.
My Submission Id is 169633
My Submission Id is 169633 and Judges considering it as a wrong answer. The logic seems to work fine for all test cases i could think of. Any insinuation what went wrong (I mean the test case) please.......... :)
Another thing is the solution was taking only 0.12 - 0.15 S on my machine while judges are saying that its taking more than 2 seconds, no idea why... :(
I have formatted my output
I have formatted my output and made it exactly what it should be.
Please tell me if what kind of problem is there in the output is it a logical error which is generating wrong sums?
Is it the output formatting error (not in the proper format)?
or is it the output formatting when using negative cases like cases with decimal, negative or null values?
Cause logically it is passing each and every test case on my system well with in .2 seconds even when I am taking 60 test cases at a time with many different player counts.
Hi Admin, My solution is
Hi Admin,
My solution is working fine and giving correct output for all the test cases. But in code chef it is giving
Wrong Answer. Can you please provide me with the test case for which it is failing?
Is it so (according to what
Is it so (according to what Graham Toal has said) that your judge might pass a solution as correct, which might as well fail for a test case which is also within the input pre-conditions that have been laid down?
Also, i see that my solution is giving a WA with an execution time of 0.00. Does this mean that my solution is failing for some of the smaller test cases at the start?
My solution works for the
My solution works for the given test cases, but says wrong answer when submitted. Can you PLEASE give extra test cases? I'm not asking for the test cases used for evaluation (obviously, as stated earlier, then you could just hard-code).
Thanks
@ Mahul yes, and yes. @
@ Mahul yes, and yes.
@ Vaibhav. No. You are expected to come up with your own test cases; that is part of the problem. You will not be given any.
Getting wrong anwser after
Getting wrong anwser after dealing couple of runtime errors :(. I need to come up with really good input test cases now.
Here is one of the odd test
Here is one of the odd test case. I have been able to produce good output with all the testcases but here is one that is making the output go bad again
1
23
1
1
1
1
1
5
5
5
5
5
5
5
5
8
8
8
8
8
8
8
9
10
450
got the above test case
got the above test case working but still no luck :|
Can u tell me whats wrong
Can u tell me whats wrong with my submission..
its working for all the cases mentioned in the probleam as well as in the comment section..
also it is giving correct result for all the test cases i have tried..
is there something related to the problem output structure i have misinterpreted..
i have read the problem about 10 times..
plz help me out on this one..
my submission id is 174951..
Have tested with test case
Have tested with test case above and also try to input big test cases like with 100 players or something. I am also hard time with but this is your best bet.
@kapil i have tried test
@kapil i have tried test cases of 100 players..
it works fine..
@admin
plz help out..
just tell me is my code failing for any input or is it because of some i/p/ o/p format..
well input and output format
well input and output format is defined in statement. I had the same impression as you but my output is failing for some cases. :| and it still it is.
now i think i need some
now i think i need some optimization of my code..
time limit exceeding..
@kapil actually there was bug in my code..
@kapil. What ouput do you get
@kapil.
What ouput do you get for your 23 element input ??
I have submitted solution
I have submitted solution ID=175623, but it shows wrong answer.
All the testcases mentioned with the problem statement comes out correct on my system.
So is it possible to get the details of testcase(s) which is/are failing when the code is submitted.
Appreciate some details. Thanks
plz take alook at my
plz take alook at my submission 17649..
i think its giving all correct answers..
is it because of some memory issues that my solution isn't working..
or is it really faiiling for some case..
plz reply..
@admin i think i am having
@admin
i think i am having some trouble regarding the input..
please help me..
my algorithm is correct and working for around 100 test cases i have tried..
i have made more than 20 submissions for this..
u have to tell me whats wrong wid my code..
one learns by his mistake..
but for that one had to be aware of what is he doing wrong..
plz check my solution..
Hi Admin, It would be great,
Hi Admin,
It would be great, if, you could tell us, while submitting the solution, for what test case the program failed.
It would be a great help, because right now I am clueless what to do. My program is working for all the test cases I tried. Even the ones mentioned in forum.
Please help.
swapnil
Coming up with your own test
Coming up with your own test cases is part of the problem. You won't be given any.
Hi Admin, problem statement
Hi Admin,
problem statement says:
Your output should be exactly '2T-1' lines.
in the given example T=4
so the output shoudl be 2(4)-1 = 7
but output contains 4 lines.
Please clarify..
Ok sorry for the above
Ok sorry for the above question, I think I got it.
Its including the empty lines as well.
It says time limit exceeded.
It says time limit exceeded. I agree that more optimal solutions may be possible. But is there a way to know how many test cases were passed before time limit exceeded. Also are you checking for 5s as time limit?
hey, there seems to be a bug
hey, there seems to be a bug in the submission page: it does not reset state after submission. I accidentally clicked on the button a few days after I had made a submission (I use session browsing on firefox) and it treated that to be a new submission -actually it should have flagged an error or disabled the submit button till new submit data was provided
what shoudl be the output if
what shoudl be the output if one enters no of players as 1?
is 0 1 the correct answer for this case?
Finally getting desired
Finally getting desired output but now time limit exceeded!!!! i think need to rework the code which seems hopeless
I have feeling that i am
I have feeling that i am really close now getting running time of 0.6 seconds but wrong output must be some really large input or I am still missing something.
Hi Admin, I ran my solution
Hi Admin,
I ran my solution using the method mentioned in the FAQ, i.e. using < in.tx > and out.txt. It used the same test case given in the sample and got the exact same output, however the result shows wrong result. What could be wrong?
Thanks!
Rajesh
@admin in last test case
@admin
in last test case output sholud be
229 250
No it shouldn't.
No it shouldn't.
when I submit the solution it
when I submit the solution
it says solution to this problem cannot be submited in this contest
what does " :( internal error
what does
" :( internal error occurred " mean ?
(No subject)
@admin:kindly help it's
@admin:kindly help
it's always givin TLE
http://www.codechef.com/viewsolution/382577
disregard last.
disregard last.
@admin got the code working
@admin
got the code working for ~90 cases in 0.00 secs
however last few cases are causin some error at 0.03 secs.
i have made the code compatible for large inputs.
you can verify it:
383033
383029
I have test case that
I have test case that produces wrong answer with the currently accepted fastest-solution(by sunilp). I reported this to admin more than 6 months ago. I still see that this solution is listed in the successful submissions.
Hi, This might be more than a
Hi,
This might be more than a help to ask guys here, but I tried two major techniques. DP( which used awful amount of memory but timed out on the above test cases. It had abt 1 sec on a test case of 100 elements and thus could not suffice :-/. ). Then I tried to use a culling based technique, which tried to enumerate options and found the best one. It seems that both are of no great use. Could it be a nice hint for me, that either of my techniques would finally pass the test cases after optimization ? Or that I should start to think aloud and afresh!?
@Admin ,@ Stephen: Please
@Admin ,@ Stephen:
Please check the soln http://www.codechef.com/viewsolution/427650.I checked for many values and it is giving correct values but on judge WA.Is it representation error or its giving wrong values .. PLz Plz check it.
Thank you.
Somebody from Admin Please
Somebody from Admin Please help.... http://www.codechef.com/viewsolution/427650
8 //the number of
8 //the number of players 87 100 28 67 68 41 67 1For the given input
For the given input values
8 //the number of players 87 100 28 67 68 41 67 1ok sorry!!! Just got confused
ok sorry!!! Just got confused somewhere.....
Is it possible to solve this
Is it possible to solve this problem in Polynomial time?? I think its an NP complete problem , isn't it??
Hi Admin The program i
Hi Admin
The program i submitted gives correct solutions for all the test cases i gave. But still i m getting a notification of "wrong answer". Can u please tell me for which test case my program doesn't run. Or what is the problem with it??
Hi Admin, I have run many
Hi Admin,
I have run many test cases, even for skill point upto 10000, but it is not failing for anyone.
Could you please tell just the one test case, that my submission is failing (id # 453376).
Thanks
@Admin What is the time limit
@Admin
What is the time limit for this problem?
At least that can be shared.
i am getting a asymptotic
i am getting a asymptotic time complexity of O(N2 S) where N is the number of players and S is the sum of all skils , but getting TLE , can this be due to the use of STL iterators ?? OR do i need to further reduce asymptotic time complexity ??? Please help
More than one solution can
More than one solution can exist as pointed out by suresh
Oops my solution got
Oops my solution got accepted...
Hi Guys, One imp. test case
Hi Guys,
One imp. test case is,
N=100, and all nos are: 450
@Anil, time limit is
@Anil,
time limit is O(N*S),
somebody please give me a
@admin: the above explained
http://www.cool-smileys.com/i
@admin when I run my program
Are question actually in any
output given to fisrt input
Read the input specifications