Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
啥STL都不用啊,125ms 1176K#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator