来源:蜘蛛抓取(WebSpider)
时间:2011-10-21 00:22
标签:
pupils是什么意思
这是个机器人猖狂的时代,请输一下验证码,证明咱是正常人~HDU 5285 wyh2000 and pupil (DFS染色判二分图 + 贪心)
时间: 12:42:15
&&&& 阅读:81
&&&& 评论:
&&&& 收藏:0
标签:&&&&&&&&&
wyh2000 and pupil
Time Limit:
MS (Java/Others)&&&&Memory Limit: 36 K (Java/Others)
Total Submission(s): 1040&&&&Accepted Submission(s): 331
Problem Description
Young theoretical computer scientist wyh2000 is teaching his pupils.
Wyh2000 has n pupils.Id of them are from 1
order to increase the cohesion between pupils,wyh2000 decide to divide them into 2 groups.Each group has at least 1 pupil.
Now that some pupils don‘t know each other(if a
doesn‘t know b,then
doesn‘t know a).Wyh2000
hopes that if two pupils are in the same group,then they know each other,and the pupils of the first group must be as much as possible.
Please help wyh2000 determine the pupils of first group and second group. If there is no solution, print &Poor wyh&.
In the first line, there is an integer
indicates the number of test cases.
For each case, the first line contains two integers
indicate the number of pupil and the number of pupils don‘t konw each other.
In the next m lines,each line contains 2 intergers
x,y(x&y),indicates
don‘t know y
don‘t know x,the
pair (x,y)
will only appear once.
T≤10,0≤n,m≤100000
For each case, output the answer.
Sample Input
Sample Output
题目链接:
题目大意:一些人要分成两组,(这群人真的好累啊,一天到晚被分来分去),给出他们之间的不认识关系,两个不认识的人不能分到一组,且每组都要至少有一个人,问分完后两组人数的最大可能值和最小可能值
题目分析:题意化简一下,就是求几个独立的二分图(可能有单点不过不碍事)合成一个大二分图,使得大二分图两侧点数差的绝对值最大,显然这里用贪心思想,对每个二分图,我把点数大的那一侧的全部并起来作为大二分图的一侧,另一侧用n减即可,判断二分图和记录点数采用的是DFS染色法,注意几个wa点,n&2时肯定没法分,还有m等于0时,显然可以有n个平凡图,这种特殊情况下,因为每组至少有一个人,直接n-1和1即可
#include &cstdio&
#include &cstring&
#include &algorithm&
int const MAX = 100005;
int head[MAX], color[MAX], num[2];
bool vis[MAX],
struct EDGE
}e[MAX * 2];
void Add(int u, int v)
e[cnt].v =
e[cnt].next = head[u];
head[u] = cnt ++;
void DFS(int u, int col)
color[u] =
num[col] ++;
for(int i = head[u]; i != -1; i = e[i].next)
int v = e[i].v;
if(vis[v])
if(color[v] == color[u])
DFS(v, col ^ 1);
int main()
scanf(&%d&, &T);
while(T --)
memset(head, -1, sizeof(head));
memset(color, -1, sizeof(color));
memset(vis, false, sizeof(vis));
scanf(&%d %d&, &n, &m);
for(int i = 0; i & i++)
scanf(&%d %d&, &u, &v);
Add(u, v);
Add(v, u);
printf(&Poor wyh\n&);
if(m == 0)
printf(&%d 1\n&, n - 1);
int ans = 0;
for(int i = 1; i &= i++)
if(!vis[i])
memset(num, 0, sizeof(num));
DFS(i, 0);
ans += max(num[0], num[1]);
printf(&Poor wyh\n&);
printf(&%d %d\n&, ans, n - ans);
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:&&&&&&&&&原文:http://blog.csdn.net/tc_to_top/article/details/
&&国之画&&&& &&&&&&
&& &&&&&&&&&&&&&&
鲁ICP备号-4
打开技术之扣,分享程序人生!君,已阅读到文档的结尾了呢~~
USINGDRAMATOTEACHYOUNGLEARNERSlnguge drama personliztion exmple children pupils
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
USINGDRAMATOTEACHYOUNGLEARNERS
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口当前位置:
>>>阅读理解。 The Greenest School in Britain The pupils and tea..
阅读理解。
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& The Greenest School in Britain&&&&& The pupils and teachers at Fairfield School think it's worth looking after the environment! This is whatthey've been doing: &&&& Growing vegetables &&&&& Fairfield School pupils started their own vegetable garden. Both children and teachers plant and water the seeds (种子), then I hey pick the vegetables, which are used in school meals. Now they can all enjoy healthy food at lunchtime. "School dinners are tastier than ever before!" says one pupil. &&&&& Recycling &&&& The Fairfield pupils don't just bring their books to school-they bring their rubbish too! There are recyclingbins (回收箱) in the playground for cans, plastic bottles, batteries and paper. The teachers give a prize every month to the pupil who's tried the hardest to recycle. &&&& Planting trees "This used to be one of the least beautiful areas of the city with no green areas, says the headteacher Lynne Johnson. "Now every child has planted their own tree, which he or she looks after during the week. They've made the view from the classroom more beautiful! &&&& Finding cleaner ways to get around &&&& Everyone walks or cycles to Fairfield School! "When the roads are busy, it's faster to ride bikes than to go by car anyway," says one pupil. Even the teachers don't use their cars. "We won't encourage our pupils to lookafter the environment if we don't do it ourselves!" says one teacher.
1. Every month the pupil who has done the best to recycle will __________ from the teachers.2. Neither the __________ nor the __________ in Fairfield school go to school by car. 3. The pupils have made the view from the classroom more beautiful by __________. 4. From the passage we know that the teachers in this school set a good __________ to &&& the pupils in protecting the environment.5. They use the vegetables which are __________ and picked by themselves in school meals.
题型:阅读理解难度:中档来源:宁夏自治区中考真题
1. get / receive / win a prize2. teachers, students / pupils 或 students / pupils, teachers 3. planting trees 4. example 5. grown(答答案不唯一)
马上分享给同学
据魔方格专家权威分析,试题“阅读理解。 The Greenest School in Britain The pupils and tea..”主要考查你对&&科教类阅读&&等考点的理解。关于这些考点的“档案”如下:
现在没空?点击收藏,以后再看。
因为篇幅有限,只列出部分考点,详细请访问。
科教类阅读
科普类的阅读:科普类的阅读理解包含介绍科学知识、社会知识的短文。阅读这类短文时,要以事实为中心进行思考,抓住事物的特征、用途、相互关系等。如果是介绍社会现象的文章,要掌握所谈现象的内涵。答题技巧:1. 加强整体意识,把握文章的主要内容。在阅读的时候可给段落标上序号,并给重要的句子和&& 关键词做上记号,尤其是各段中心句,为答题提供更快捷更多的信息源。 2. 审清题干,发觉和把握试题中有效的提示性信息,确认命题的角度、阅读范围和答题方式。 3. 定位阅读,强化对应意识。同时要注意原文利用和自我加工相结合。
发现相似题
与“阅读理解。 The Greenest School in Britain The pupils and tea..”考查相似的试题有:
16374486175116171567869741288031