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

啥STL都不用啊,125ms 1176K

Posted by KatrineYang at 2016-11-06 11:50:47 on Problem 2664
#include <iostream>
#include <stdio.h>
using namespace std;

bool cat[10005][105];

int main() {
	int k,m;
	while(1){
		scanf("%d",&k);
		if(!k) break;
		scanf("%d",&m);
		for(int i = 0; i < 10000; i++){
			for(int j = 0; j < m; j++){
				cat[i][j] = 0;
			}
		}
		int chosen[105];
		int mn[105];
		for(int i = 0; i < k; i++) scanf("%d",&chosen[i]);
		for(int i = 0; i < m; i++){
			int g;
			scanf("%d%d",&g,&mn[i]);
			for(int j = 0; j < g; j++){
				int d;
				scanf("%d",&d);
				cat[d][i] = 1;
			}
		}
		int act[105] = {0};
		for(int i = 0; i < k; i++){
			int kh = chosen[i];
			for(int i = 0; i < m; i++){
				if(cat[kh][i]){
					act[i]++;
				}
			}
		}
		bool ky = 1;
		for(int i = 0; i < m; i++){
			if(act[i] < mn[i]){
				ky = 0;
				printf("no\n");
				break;
			}
		}
		if(ky){
			printf("yes\n");
		}
	}
	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