Page 1 of 1

12394 - Peer Review

Posted: Sat May 19, 2012 7:55 pm
by sith
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

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) {
        }
    }
}

Re: 12394 - Peer Review

Posted: Tue May 22, 2012 12:36 am
by brianfry713
each paper has problems in that case. Try this input

Code: Select all

2 3
UCM 2 3
UCM 1 3
UCM 1 2
0 0
AC output:

Code: Select all

3 PROBLEMS FOUND

WA

Posted: Wed Jan 29, 2014 9:46 pm
by Yusif
Do I get it wrong?
I assume that
1) if paper i is reviewed less than twice the violation is with paper i, (correct is " if paper i is reviewed more or less than K times the violation is with paper i,")
2) if author j reviews paper i more than once the violation is with paper i,
3) if author j collaborating with author i reviews paper i the violation is with paper i.

Code: Select all

AC.
Thanks Brian!

Re: 12394 - Peer Review

Posted: Thu Jan 30, 2014 2:48 am
by brianfry713
Input:

Code: Select all

3 4
A 1 1 1
B 1 3 4
C 1 2 4
D 1 2 3
0 0
AC output: 4 PROBLEMS FOUND
if paper i is reviewed more or less than K times the violation is with paper i,

Re: 12394 - Peer Review

Posted: Sat Feb 15, 2014 2:06 pm
by uDebug
AC output: 4 PROBLEMS FOUND
I'm trying to make sure I understand the problems here. So, the four problems in the above case are:

(1) Paper A is not being reviewed by several scientists (just by Scientist #1).
(2) Scientist #1 is reviewing a paper with a person they collaborated with (themselves, in this case).
(3) Scientist #1 is reviewing a paper more than once.
(4) Paper A has got exactly 1 distinct review (instead of 3).

Correct?

Re: 12394 - Peer Review

Posted: Sat Feb 15, 2014 10:47 pm
by piyukr
I too have a doubt on this question.
for input:

2 3
UCM 2 3
UAM 1 2
UPM 2 2
0 0

the AC output is 3 problems.
Shouldn't there be 5 problems? which are..
1.) paper 1 reviewed only once.
2.) paper 3 reviewed only once.
3.)paper 2 reviewed more then twice (in total).
4.)paper 2 reviewed more then once by the same scientist.
5.)Scientist 2 is reviewing his own paper.

Re: 12394 - Peer Review

Posted: Tue Feb 18, 2014 8:34 pm
by brianfry713
For each test case, your program should output NO PROBLEMS FOUND (if all rules are being followed) or P PROBLEMS FOUND, where P is the number of rule violations found (counting at most 1 violation per paper).