reynir / smallest-subarray

http://uva.onlinejudge.org/external/115/11536.html
0 stars 0 forks source link

Bug in Judge Data #1

Closed jhckragh closed 14 years ago

jhckragh commented 14 years ago

Bombarding the program with random input did not help me uncover any errors. So I decided to check whether other people have had difficulties with the Smallest Sub-Array problem on UVA. This led me to a thread where someone points out that there are actually cases in the judge data where k = 1, contrary to the problem description:

In the judge data, there are cases where K = 1 and for that the result is also 1.

The program currently outputs "sequence nai" for those cases. Implementing a quick and dirty fix causes the judge to accept. :-)

...
/* Read n, m and k */
line = in.readLine();
s = line.split(" ");
n = Integer.parseInt(s[0]);
m = Integer.parseInt(s[1]);
k = Integer.parseInt(s[2]);
if (k == 1) {
    System.out.println("Case " + (j+1) + ": 1");
    continue;
}
...
reynir commented 14 years ago

Nice! I have implemented it and pushed. Thanks