12394 - Peer Review

All about problems in Volume 123. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
sith
Learning poster
Posts: 72
Joined: Sat May 19, 2012 7:46 pm

12394 - Peer Review

Post by sith » 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

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

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 12394 - Peer Review

Post by brianfry713 » Tue May 22, 2012 12:36 am

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
Check input and AC output for thousands of problems on uDebug!

Yusif
New poster
Posts: 27
Joined: Tue Jun 25, 2013 2:24 am

WA

Post by Yusif » Wed Jan 29, 2014 9:46 pm

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!
Last edited by Yusif on Thu Jan 30, 2014 8:45 pm, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 12394 - Peer Review

Post by brianfry713 » Thu Jan 30, 2014 2:48 am

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,
Check input and AC output for thousands of problems on uDebug!

User avatar
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 12394 - Peer Review

Post by uDebug » Sat Feb 15, 2014 2:06 pm

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?
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.

piyukr
New poster
Posts: 17
Joined: Sun Jan 26, 2014 10:35 am

Re: 12394 - Peer Review

Post by piyukr » Sat Feb 15, 2014 10:47 pm

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.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 12394 - Peer Review

Post by brianfry713 » Tue Feb 18, 2014 8:34 pm

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).
Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 123 (12300-12399)”