#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
set<int>v[];
int a[];
int vis[];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,m;
cin>>n>>m;
for(int i=;i<=m;++i){
int x,y;
cin>>x>>y;
v[x].insert(y);
v[y].insert(x);
}
int k;
cin>>k;
for(int i=;i<=k;++i){
int num;
cin>>num;
if(num==){
cout<<"Area "<<i<<" needs help.";
cout<<"\n";
continue;
}
for(int j=;j<=num;++j)
cin>>a[j];
int flag=;
for(int k=;k<=num;++k){
for(int j=;j<=num;++j){
if(k==j)
continue;
if(!v[a[k]].count(a[j])){
flag=;
}
}
}
if(flag){
cout<<"Area "<<i<<" needs help.";
cout<<"\n";
continue;
}
memset(vis,,sizeof(vis));
for(int j=;j<=num;++j){
for(auto it:v[a[j]])
++vis[it];
}
int ans=;
for(int j=;j<=n;++j)
if(vis[j]==num){
ans=j;
break;
}
if(ans){
cout<<"Area "<<i<<" may invite more people, such as "<<ans<<".";
cout<<"\n";
continue;
}
cout<<"Area "<<i<<" is OK.";
cout<<"\n";
}
return ;
}

2019冬季PAT甲级第三题的更多相关文章

  1. 2019冬季PAT甲级第四题

    #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; typedef struct node{ ...

  2. 2019冬季PAT甲级第二题

    #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; typedef struct{ int ...

  3. 2019冬季PAT甲级第一题

    #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ][]; ][]; ]; string ...

  4. 2019秋季PAT甲级_备考总结

    2019 秋季 PAT 甲级 备考总结 在 2019/9/8 的 PAT 甲级考试中拿到了满分,考试题目的C++题解记录在这里,此处对备考过程和考试情况做一个总结.如果我的方法能帮助到碰巧点进来的有缘 ...

  5. PAT甲级训练刷题代码记录

    刷题链接:https://www.patest.cn/contests/pat-a-practise 1001 #include <iostream> #include <stdio ...

  6. 2019秋季PAT甲级_C++题解

    2019 秋季 PAT (Advanced Level) C++题解 考试拿到了满分但受考场状态和知识水平所限可能方法不够简洁,此处保留记录,仍需多加学习.备考总结(笔记目录)在这里 7-1 Fore ...

  7. PAT甲级 Dijkstra 相关题_C++题解

    Dijkstra PAT (Advanced Level) Practice Dijkstra 相关题 目录 <算法笔记>重点摘要 1003 Emergency (25) <算法笔记 ...

  8. PAT甲级 散列题_C++题解

    散列 PAT (Advanced Level) Practice 散列题 目录 <算法笔记> 重点摘要 1002 A+B for Polynomials (25) 1009 Product ...

  9. PAT甲级 二叉树 相关题_C++题解

    二叉树 PAT (Advanced Level) Practice 二叉树 相关题 目录 <算法笔记> 重点摘要 1020 Tree Traversals (25) 1086 Tree T ...

随机推荐

  1. 2020 Plan

    1. English IELTS  7.0 IELTS word 3271,  10 words diff 2 Grammar framework IELTS writing Friends foll ...

  2. 2020年,最新NGINX的ngx_http_geoip2模块以精准禁止特定国家或者地区IP访问

    1.0 geoip2核心识别库 安装geoip2 lib步骤: cd /usr/local/src .tar.gz wget https://github.com/maxmind/libmaxmind ...

  3. centos8 apache+mysql+php

    apache安装 dnf install httpd httpd-tools 开机启动 systemctl enable httpd 立即启动 systemctl start httpd 查看状态 s ...

  4. [JSOI2010] 连通数 - 强连通分量,缩点

    复习一下手工 tarjan #include <bits/stdc++.h> using namespace std; vector <int> g[2005],scc[200 ...

  5. spring boot MySQL Public Key Retrieval is not allowed

    建议在链接url处添加对应的属性 jdbc:mysql://localhost:3306/book?allowPublicKeyRetrieval=true&useSSL=false 

  6. JVM学习-环境构建

    想学习JVM,java虚拟机的底层原理.下面介绍下怎么将Java文件compiler成字节码,然后反编译为二进制查看分析. 一.JavaClass.java文件: package com.gqz.ja ...

  7. 使用在react hooks+antd ListView简单实现移动端长列表功能

    import React, { useState, useEffect } from "react" import { ListView } from "antd-mob ...

  8. tp3.2框架关闭日志记录

    在config.php中阿计入如下配置: 'LOG_RECORD' => false, // 默认不记录日志 'LOG_TYPE' => 'File', // 日志记录类型 默认为文件方式 ...

  9. 转载:android audio policy

    Audio policy basic:https://www.cnblogs.com/CoderTian/p/5705742.html Set volume flow:https://blog.csd ...

  10. Echat 地图样式格式

    1.白色 mapStyle: { styleJson: [{ 'featureType': 'water', 'elementType': 'all', 'stylers': { 'color': ' ...