### 12394 - Peer Review

Posted:

**Sat May 19, 2012 7:55 pm**Hello!

I receive WA for this problem.

Could Anybody explane why this negative case has 3 problems:

UCM 2 3

UAM 1 2

UPM 2 2

0 0

Maybe anybody could provide any valid cases?

Here is my code

I receive WA for this problem.

Could Anybody explane why this negative case has 3 problems:

UCM 2 3

UAM 1 2

UPM 2 2

0 0

Maybe anybody could provide any valid cases?

Here is my code

Code: Select all

```
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
class Main {
public static void main(String[] args) {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line;
try {
while ((line = reader.readLine()) != null) {
StringTokenizer tokenizer = new StringTokenizer(line);
int numberOfReviews = Integer.parseInt(tokenizer.nextToken());
int numberOfPapers = Integer.parseInt(tokenizer.nextToken());
if (numberOfPapers == 0 && numberOfReviews == 0) {
return;
}
String[][] reviews = new String[numberOfPapers + 1][numberOfReviews + 1];
for (int i = 1; i <= numberOfPapers; i++) {
String s = reader.readLine();
StringTokenizer authorTokenizer = new StringTokenizer(s);
String author = authorTokenizer.nextToken();
reviews[i][0] = author;
int j = 1;
while (authorTokenizer.hasMoreTokens()) {
reviews[i][j++] = authorTokenizer.nextToken();
}
}
int[] papersReviewCounts = new int[numberOfPapers + 1];
int errors = 0;
for (int i = 1; i < reviews.length; i++) {
String[] review = reviews[i];
for (int i1 = 1, reviewLength = review.length; i1 < reviewLength; i1++) {
String reviewAuthorId = review[i1];
int authorId = Integer.parseInt(reviewAuthorId);
papersReviewCounts[authorId]++;
if (reviewAuthorId == null) {
errors++;
continue;
}
if (reviews[authorId][0].equals(review[0])) {
errors++;
continue;
}
}
}
for (int i = 1, papersReviewCountsLength = papersReviewCounts.length; i < papersReviewCountsLength; i++) {
int papersReviewCount = papersReviewCounts[i];
if (papersReviewCount < numberOfReviews) {
errors++;
}
}
switch (errors) {
case 0:
System.out.println("NO PROBLEMS FOUND");
break;
case 1:
System.out.println("1 PROBLEM FOUND");
break;
default:
System.out.println(errors + " PROBLEMS FOUND");
break;
}
}
} catch (IOException e) {
}
}
}
```