So easy

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 991    Accepted Submission(s): 547

Problem Description

Small W gets two files. There are n integers in each file. Small W wants to know whether these two files are same. So he invites you to write a program to check whether these two files are same. Small W thinks that two files are same when they have the same integer set.
For example file A contains (5,3,7,7),and file B contains (7,5,3,3). They have the same integer set (3,5,7), so they are same.
Another sample file C contains(2,5,2,5), and file D contains (2,5,2,3).
The integer set of C is (2,5),but the integer set of D is (2,3,5),so they are not same.
Now you are expected to write a program to compare two files with size of n.
 

Input

Multi test cases (about 100). Each case contain three lines. The first line contains one integer n represents the size of file. The second line contains n integers a1,a2,a3,…,an - represents the content of the first file. The third line contains n integers b1,b2,b3,…,bn - represents the content of the second file.
Process to the end of file.
1≤n≤100
1≤ai,bi≤1000000000
 

Output

For each case, output "YES" (without quote) if these two files are same, otherwise output "NO" (without quote).
 

Sample Input

3
1 1 2
1 2 2
4
5 3 7 7
7 5 3 3
4
2 5 2 3
2 5 2 5
3
1 2 3
1 2 4
 

Sample Output

YES
YES
NO
NO
 
水题……
 //2016.8.12
#include<iostream>
#include<cstdio>
#include<set> using namespace std; int main()
{
int n;
while(cin>>n)
{
set<int> seta;
set<int> setb;
int a, b;
bool fg = true;
for(int i = ; i < n; i++)
{
scanf("%d", &a);
seta.insert(a);
}
for(int i = ; i < n; i++)
{
scanf("%d", &b);
setb.insert(b);
}
if(seta.size()!=setb.size())
fg = false;
else{
set<int>::iterator it;
for(it = seta.begin(); it != seta.end(); it++)
{
if(setb.count(*it)==)
fg = false;
}
}
if(fg)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
} return ;
}

HDU5058的更多相关文章

随机推荐

  1. window下查看端口命令

    原文:http://blog.csdn.net/ldl22847/article/details/7181210 http://blog.csdn.net/xinxin19881112/article ...

  2. DedeCMS新建模型字段【附件样式】修改方法

    当我们在系统模型中添加了一个自定义附件类型字段的时候,例如我在后台添加一个名为"fujian"的附件类型的字段,字段的实际内容为:'/uploads/soft/2245/1-255 ...

  3. w3c学习总结1

    1.根据 HTML5 规范,在没有其他合适标签更合适时,才应该把 <b> 标签作为最后的选项.HTML5 规范声明:应该使用 <h1> - <h6> 来表示标题,使 ...

  4. 转 mybatis javaType与jdbcType对应

    java.sql.Types 值 Java 类型 IBM DB2 Oracle Sybase SQL Informix IBM Content Manager   BIGINT java.lang.l ...

  5. HttpServletRequest.getServletContext()一直提示找不到,而引出的问题

    开发j2ee项目的时候,需要用到servlet-api,如果使用了maven,web项目可以在pom.xml中手动加入所需jar包,达到与依赖j2ee libarary同样的功能.可问题来了: 1. ...

  6. 17.4.3 使用MulticastSocket实现多点广播(4)

    17.4.3  使用MulticastSocket实现多点广播(4) 通过UserInfo类的封装,所有客户端只需要维护该UserInfo类的列表,程序就可以实现广播.发送私聊信息等功能.本程序底层通 ...

  7. Android 4.0 ICS SystemUI浅析——StatusBar结构分析

    Android 4.0 ICS SystemUI浅析——StatusBar结构分析 分类: Android2012-06-30 14:45 23687人阅读 评论(8) 收藏 举报 androidsi ...

  8. CentOS x 64 MooseFS 学习

    一.MFS 简介.... MooseFS(Moose File System,mfs)是一种分布式文件系统,它将数据分布在网络中的 不同服务器上,支持FUSE,客户端可以作为一个 普通的Unix 文件 ...

  9. jQuery学习笔记(二)

    1. 基本选择器 #id      ("#one") .class  $(".two") element (根据给定的元素名匹配元素) $("div& ...

  10. 微信小程序-未接入app.json错误

    微信小程序建立新项目之后会出现app.json文件未接入错误如下图: 一般是因为在下图添加新项目,项目目录这一列,如果不事先建立一个空的文件夹,直接选择则不会出现quickstartup界面 所以在建 ...