题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2094

注意每组数据处理前,map要清空。

 #include<cstdio>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<stdbool.h>
#include<time.h>
#include<stdlib.h>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<vector>
using namespace std;
#define clr(x,y) memset(x,y,sizeof(x))
#define sqr(x) ((x)*(x))
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define LL long long
#define INF 0x3f3f3f3f
#define A first
#define B second
const int N=+;
int n,cnt,num,t,head[N],f[N],d[N];
char a[N],b[N];
map<string,int> all; void init()
{
num=;
clr(d,);
all.clear();
}
void solve()
{
int p=;
for(int i=;i<=num;i++) {
if(!d[i]) p++;
}
if(p!=) printf("No\n");
else printf("Yes\n"); }
int main()
{
while(~scanf("%d",&n)) {
if(!n) break;
getchar();
init();
while(n--) {
scanf("%s%s",a,b);
if(!all[a]) all[a]=++num;
if(!all[b]) all[b]=++num;
d[all[b]]++;
}
solve();
} return ;
}

最新文章

  1. 帆布指纹识别(canvas fingerprinting)
  2. Linux下Tomcat服务器重启与关闭
  3. [转载] Android Bander设计与实现 - 设计篇
  4. discuz!安装遇到问题的解决方案
  5. 统计:P值 &amp; α值
  6. swift流行UI库(github)
  7. Velocity语法大全
  8. JAVA &amp; Android 系统环境变量配置
  9. (C++)STL排序函数sort和qsort的用法与区别
  10. N皇后摆放问题
  11. Nested Loop,Sort Merge Join,Hash Join
  12. Eclipse 中使用Genymotion 作为模拟器的步骤
  13. AngularJS中ng-options简单用法及预选项失败的原因
  14. ios 检测屏幕方向
  15. 学习java线程学习笔记
  16. django ajax练习
  17. CodePen最佳实例分享
  18. 2013-8:SDCE大会笔记
  19. Filebeat 模块与配置
  20. UI设计教程分享:字体变形—阴阳收缩法

热门文章

  1. udp之nat穿透的困惑
  2. directive 指令
  3. Abstract Factory模式的几个要点
  4. TVS管
  5. Altium Designer规则
  6. zoj2314 经典 无源汇有上下界最大流 并输出可行流
  7. 开始使用Logstash
  8. to_char函数引发的不走索引
  9. POJ1061青蛙的约会(扩展欧几里德算法)
  10. Display number of replies in disscussion board