The checker for this problem has been updated, and all submissions have been rejudged.
In the previous version, due to an error in passing arguments for the contestant's output and the answer files, outputting -1 was incorrectly judged as correct for all test cases that have a valid solution.