Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

又是更新问题qwq

Posted by KatrineYang at 2016-09-30 06:04:12 on Problem 1378
#include <iostream>
#include <stdio.h>
using namespace std;

int n,m,k,h;

int nList[10086][55];
int mList[55][520];

int main() {
	while(1){
		scanf("%d%d%d", &n,&m,&k);
		//cout << n << m << k << endl;
		//if(n==-1) break;
		int nNum[10086] = {0};
		int mNum[55] = {0};
		for(int i = 0; i < m; i++){
			scanf("%d", &mNum[i]);
			for(int j = 0; j < mNum[i]; j++){
				scanf("%d", &mList[i][j]);
				nList[mList[i][j]][nNum[mList[i][j]]] = i;
				nNum[mList[i][j]]++;
			}
		}
		bool used[55] = {0};
		int nNum_[10086];
		for(int i = 0; i < n; i++) nNum_[i] = nNum[i];
		for(int i = 0; i < k; i++){
			int huai;
			scanf("%d", &huai);
			for(int j = 0; j < nNum_[huai]; j++){
				int cb = nList[huai][j];
				if(used[cb]) continue;
				used[cb] = 1;
				for(int l = 0; l < mNum[cb]; l++){
					nNum[mList[cb][l]]--;
				}
			}
		}
		int cnt = 0;
		for(int i = 0; i < n; i++){
			if(nNum[i]) cnt++;
		}
		cout << n-cnt << endl;
		//printf("%d\n", n-cnt);
		scanf("%d%d%d", &h,&h,&h);
		if(!(~h)) break;
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator