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;
}
...
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:
The program currently outputs "sequence nai" for those cases. Implementing a quick and dirty fix causes the judge to accept. :-)