题目连接

http://acm.hdu.edu.cn/showproblem.php?pid=5058

So easy

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
$a_1, a_2, a_3, \ldots, a_n$ - represents the content of the first file. The third line contains n integers $b_1, b_2, b_3, \ldots, b_n$ - represents the content of the second file.
Process to the end of file.
$1 \leq n \leq 100$
$1 \leq a_i , b_i \leq 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

刷些水题打发时间。。

 #include<cstdio>
#include<set>
using std::set;
set<int> A, B;
int main() {
int n, v;
while (~scanf("%d", &n)) {
for (int i = ; i < n << ; i++) {
scanf("%d", &v);
if (i < n) A.insert(v);
else B.insert(v);
}
if (A == B) puts("YES");
else puts("NO");
A.clear(), B.clear();
}
return ;
}

hdu 5058 So easy的更多相关文章

  1. HDU 5572 An Easy Physics Problem (计算几何+对称点模板)

    HDU 5572 An Easy Physics Problem (计算几何) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5572 Descripti ...

  2. BestCoder12 1001.So easy(hdu 5058) 解题报告

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5058 (格式有点问题,为了方便阅读---整个复制下来吧) 题目意思:给出两个长度都为 n 的集合你,问 ...

  3. hdu 5475 An easy problem(暴力 || 线段树区间单点更新)

    http://acm.hdu.edu.cn/showproblem.php?pid=5475 An easy problem Time Limit: 8000/5000 MS (Java/Others ...

  4. HDU 5475 An easy problem 线段树

    An easy problem Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pi ...

  5. 数据结构(主席树):HDU 4729 An Easy Problem for Elfness

    An Easy Problem for Elfness Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65535/65535 K (J ...

  6. HDU 4565 So Easy(矩阵解公式)

    So Easy [题目链接]So Easy [题目类型]矩阵解公式 &题解: 感觉这种类型的题都是一个套路,这题和hdu 2256就几乎是一样的. 所以最后2Xn就是答案 [时间复杂度]\(O ...

  7. hdu 5058 set应用

    http://acm.hdu.edu.cn/showproblem.php?pid=5058 set应用 水题 #include <cstdio> #include <cstdlib ...

  8. HDU 2132 An easy problem

    http://acm.hdu.edu.cn/showproblem.php?pid=2132 Problem Description We once did a lot of recursional ...

  9. HDU 5650 so easy 数学

    so easy 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5650 Description Given an array with n integ ...

随机推荐

  1. 【LeetCode】21. Merge Two Sorted Lists

    题目: Merge two sorted linked lists and return it as a new list. The new list should be made by splici ...

  2. oracle学习系列之四 (视图)

    视图视图是数据库中特有的对象.视图用于存储查询,但不会存储数据(物化视图除外).这是视图和数据表的重要区别.可以利用视图进行查询,插入,更新和删除数据.Oracle有如下四种视图(关系视图,内嵌视图, ...

  3. Python 编程规范-----转载

    Python编程规范及性能优化 Ptyhon编程规范 编码 所有的 Python 脚本文件都应在文件头标上 # -*- coding:utf-8 -*- .设置编辑器,默认保存为 utf-8 格式. ...

  4. sql server 2008 R2 配置开启远程访问

  5. Exceeded maximum number of retries. Exceeded max scheduling attempts 3 for instance

    Exceeded maximum number of retries. Exceeded max scheduling attempts 3 for instance

  6. php 单例设计模式 example

    <?php class User { //静态变量保存全局变量 private static $_instance=null; //私有化构造函数,防止外界实例化对象 private funct ...

  7. 七个你可能不了解的CSS单位

    我们很容易无法摆脱的使用我们所熟悉的CSS技术,当新的问题出现,这样会使我们处于不利的地位. 随着Web继续的发展,对新的解决方案的需求也会继续增大.因此,作为网页设计师和前端开发人员,我们别无选择, ...

  8. [视频]MAC OS 技巧之如何更新及重装MAC系统

    mac os是当今最好用的桌面操作系统,但再好的系统也有新版本发布的一天,或者被极客的你尝试各种设置而配置混乱了,这时我们就要进行系统更新或者重装了. 系统更新 Mac OS有新版本推出时,会自动在A ...

  9. NotePad++相关设置

    Notepad++去掉红色下划线: 插件->DSpellCheck->Auto-check Document 前面的勾去掉 Notepad++自动换行: 视图(View)——>自动换 ...

  10. 模拟新浪微博textarea,刷新页面输入信息保留

    今天我们的产品经理提出一个新需求,模拟新浪微博textarea框,输入内容刷新页面保留信息. 我是用的方法是Html5 LocalStorage存储的,开始计划用cookie.或mysql存储,尝试了 ...