View Clarifications

[ Contest Page | Scoreboard | Submissions | Clarifications | Help | Log In ]

General I/O?

Please use standard in and standard out!

Input --
Java: Scanner in = new Scanner(new BufferedReader(new InputStreamReader(;
C: scanf("%d %d", &integer1, &integer2);
C++: int x; cin >> x;

Output --
Java: System.out.println("asdf");
C: printf("%d %d", integer1, integer2);
C++: int x = 5; cout << x << endl;
General Java class names?

Please use the following class names (make sure classes are public):

Problem A - public class A { ... }
Problem B - public class B { ... }
. . .
General What resources can we use?

Anything printed on a paper is acceptable. You can only use language reference sites on Internet.
D - Polynomial Boundaries Is the degree of the polynomial N or N-1? It says N but the number of coefficients implies N-1.

Yes, the degree is N-1. Kent says to blame him. I agree.
D - Polynomial Boundaries never mind, the "minus one" got cut off from my screen and I missed it! :)

Ok, we don't get to blame Kent... so far.
D - Polynomial Boundaries wait, I am bugging you again :)...I think it should say "plus one" instead of "minus one"

We are given N. And N coefficients. So degree is N-1. If degree was N, there would be N+1 coefficients. (Now I see what you are saying, I was not aware of that change)
C - Coverity Crossword by diagonaly do you mean only a single word staring from 0,0 to 7,7?

Words can have different lengths.
E - Strfry Do the diagonal words always start at position (0, 0) of crossword?

General If using Python, how does one read input? Is it simply file io?

Standard input/output.
E - Strfry Can the NULL character be strfried?

E - Strfry To clarify, I am asking whether a word can found which starts at (1,0) and end at (3,2)?
Is it counted as a diagonal word?

Yes and yes.
F - Horn-Blowing Would we have to consider t < 0? If so what should we output?

No, we would not.
E - Strfry Was there something wrong with E (non-C/C++ solutions)

Time limit was set at 1 second per test file by mistake (silly C programmers).

Increased to 4 secs, one team might have been affected (but not by much).
General Is it possible to print the source code?

Unfortunately, no. This will hopefully be addressed next time.
General Is there a version of python preferred? 3.3 or 2.7 etc.?

Our Python is 2.6.6
E - Strfry Is it possible to have an empty string input? If so, how is this handled?

C - Coverity Crossword If there are two of the same words, does it have to be found twice in the crossword????

Each of them has to be found in the crossword. (I know that this did not help but, please, read the problem statement, it is not ambiguous).
General Compilation error for Problem A (team NoName)? illegal start of type
visited = new HashSet<>();
1 error
E - Strfry Always lowercase letters for the words?

It's in the problem statement, and the answer is yes.
C - Coverity Crossword Apparantly your compiler is different from Visual Studio and for strlen we need to include cstring while there is no need for that in visual studio for c++ and for that reason I got compile error and a penalty. I just resubmitted with adding #include and resubmitted and got approved. I guess my penalty should be removed. I have got the same penalty for my first submission of question E too.

I will remove the compile error penalties this time but next time please try to learn the contest environment before the contest.

Note that Visual Studio is an IDE, not a compiler. You should know what it includes by default before compiling.

It is like me complaining that my Java code is not compiled automatically after I save it in gEdit, because that is what Eclipse does.
General What does run-time error mean for submission? (Problem D, Java, Hack Street Boys) We keep getting that error from the judge even though our code compiles and runs fine.

You are reading the input assuming that everything is separated by a single space.

Either use split("s+") or (much much easier), use Scanner's nextInt() method (the only reason I can see why you are using Scanner and BufferedReader directly)
D - Polynomial Boundaries Why is sample correct?

2 3 1
p(x) = 3 + x

Coefficients are given in order a0,a1,...
E - Strfry Why is there incorrect output?

There are at most 1000 testcases in the input, not at most 999. Changing problem statement now, and submissions will be rejudged -- this is Kent's fault. :)
A - Drawing What is the memory limit on Java?

D - Polynomial Boundaries Is a point considered inside if it is between the polynomial and the x axis, or if it is less than the polynomial?

Just less. As is stated in the problem.
F - Horn-Blowing Is there a bound for T?

No. But there is an implicit bound (this is part of the problem).

It will, however, fit into 32-bit signed integer.
B - Batman Begins what is the space limits for this problem?

You have plenty of memory available, if that is what you are asking (C is system, Java half of it, but is more than 1.5GB for sure)

Note that more memory you use, slower the calls.
H - Bitcoin Profits what does the difficulty multiplier mean? is it the difficulty level that a miner requests?

A - Drawing We are getting a runtime error for q A while the code is compiled and run fine. Is that possible that it's a out of memory error or something like that?

I responded to a similar question above, I will make a general statement below.
G - Implication For all variables that aren't mentioned in the "N" statements, do we consider them to be automatically false? For example, in the sample input, c is considered "false". Does this work with other variables (d, e, etc.)?

Yes - read the first paragraph again (I did not get it either).
A - Drawing Since my submission isn't a MLE, could you tell me why I got a RTE in A? (UBC7)

It is a legit RTE. I cannot even say which one it is as not to give hints to people competing for prizes. You can email me at
General Quite a few Java submissions are getting this type of exception:

--== Detected new public class name: D ==--
--== Running ==--
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(
at java.lang.Integer.parseInt(
at java.lang.Integer.parseInt(
at D.main(

REJECT: runtime error

String[] a = s.split("s+");

Numbers can have more than one space between them.

Better yet, use Scanner.nextInt() and next()
General ... java exception...

"s+" actually has two backslashes in front of s. UI removes one every time I update this page.
A - Drawing I *am* using s.nextInt() and I'm getting RTE. Is the judge running Java 6 or is there another reason?

See above (just responded)

And yes, judge is running Java 6 but nothing to do with your error.
A - Drawing I think our problem is different. Where are parsing the input correctly!

int N = Integer.parseInt(in.nextLine());

I don't know if this is it, but that is one of the first lines in your code. At least you can trim the line (and then check if it is empty, are you sure next integer is on the next line?)
E - Strfry Is there a reason why we keep on getting a run-time error with our submission for this problem? Every test case we have tried has worked correctly.

Because you are returning 1 at the end of main().

You have to return 0 (judge looks at that value)

I will mark previous attempts as submission errors.
General Can I solve a problem in clarification requests? I will actually word it as if I were asking a question.


That is a good way to get yourself disqualified.
A - Drawing Must the shape be connected?

Read the problem statement.
A - Drawing could we have mutiple line segments with the same endpoints?
For example:
a b c d
a b c d
or 2:
a b c d
c d a b

There should not be but we have a test file with such cases. Segments should have at most one point in common (in this case they have infinitely many)

We will remove such cases and re-run the judge on all D submissions.

Apologies all, you can blame Kent if you like (I know I will).
A - Drawing Could you please let me know after you run again?

Re-judging is done.
H - Bitcoin Profits What's the computational power for the player here? we now only know the difficulty level for each share and the total number of shares, how can we come up with the optimal difficulty multiplier if we don't know what's the trade-off of having higher difficulty multiplier.


Ok, so - let's say you get a token for each share multiplied by this multiplier. Higher the multiplier, you get more per share (value of multiplier) but all the shares with lesser difficulty are discarded. If you reduce the multiplier, you get more shares, but the multiplier is lower.

So you have to find the "sweet spot" (multiplier that gives you the largest return).
F - Horn-Blowing We are getting runtime error (previously was wrong answer). Is it input parsing error again or something else?

It was a legit exception from a bug in your code.
F - Horn-Blowing By truncated do you mean the floor of the output, or rounding it to the nearest 2 decimal number?

Yes, floor.
D - Polynomial Boundaries Limits are wonky for Problem D...

Some of the test cases have N = 8 again, same as what happened with problem A (< vs <=). Online problem statement has been updated to reflect this.

Again, Kent's fault. :)
F - Horn-Blowing !@#$ F

Probably truncating.

Turns out both judges used exactly the same code (C and Java)


1000x9x 0.111111111111111

we get 0.99,
most people time out,
UBC gets 1.00 quickly

We should have asked for give or take 0.01, probably...

Ultra Cool Programming Contest Control Centre v1.8
Copyright (c) 2005-2010 by Sonny Chan