HDU 4194 Peer Review


For scienti c conferences, scientists submit papers presenting their ideas, and then review each other's papers to make sure only good papers are presented at the conference. Each paper must be reviewed by several scientists, and scientists must not review papers written by people they collaborate with (including themselves), or review the same paper more than once. 
 You have been asked to write a program to check if your favorite conference is doing things right. Whether a paper is being reviewed too much, too little, or by the wrong people - the organizers must know before it is too late!


The fi rst line in each test case has two integers, K (1<=K<=5) and N (1<=N<=1000). K is the number of reviews that each paper will receive, while N is the number of papers to be reviewed. The conference only accepts papers with a single author, and authors can only present a single paper at the conference. 
 Each of the next N lines describes an author and includes the name of the institution to which the author belongs, followed by the list of the K papers he or she has been requested to review. It is assumed that researchers from the same institution collaborate with each other, where as researchers from diff erent institutions don't. All institution names are shorter than 10 characters, and contain only upper or lowercase letters and no whitespace. Since we have as many papers as authors, papers are identi ed by their author's index; paper 1 was written by the first author in the list, and paper N was written by the last author. 
 The end of the test cases is marked with a line containing K = 0 and N = 0. You should generate no output for this line.


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). If there is exactly one rule violation overall, your program should output 1 PROBLEM FOUND.

Sample Input

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

Sample Output




#define rep(i,j,k) for (int i = j; i <= k; i++)
#define per(i,j,k) for (int i = j; i >= k; i--)
#define loop(i,j,k) for (int i = j;i != -1; i = k[i])
#define lson x << 1, l, mid
#define rson x << 1 | 1, mid + 1, r
#define ff first
#define ss second
#define mp(i,j) make_pair(i,j)
#define pb push_back
#define pii pair<int,LL>
#define inone(x) scanf("%d", &x)
#define intwo(x,y) scanf("%d%d", &x, &y)
using namespace std;
const int N = 1e3+5;
const int mod=1e9+7;
int n, m, a[N][10],f[N],c[N];
string s[N];

int main()
        rep(i,1,n) f[i]=c[i]=0;
            rep(j,0,m-1) inone(a[i][j]);
                if(j&&a[i][j]==a[i][j-1]) f[a[i][j]]=1;
                if (s[a[i][j]]==s[i]) f[a[i][j]]=1;
                else c[a[i][j]]++;
        int ans=0;
        rep(i,1,n) ans+=f[i]|(c[i]!=m);
        if (ans>1) printf("%d PROBLEMS FOUND\n",ans);
        else if (ans==1) printf("%d PROBLEM FOUND\n",ans);
        else printf("NO PROBLEMS FOUND\n");
    return 0;

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/jtjy568805874/article/details/53097380
文章标签: HDU
想对作者说点什么? 我来说一句

Best kept secrets of peer code review

2009年07月15日 2.05MB 下载