首页 > 代码库 > hdu 5058
hdu 5058
#include <iostream> #include <fstream> #include <vector> #include <cstdio> #include <string> #include <cstring> #include <cstdlib> #include <algorithm> #include <set> using namespace std; #ifdef DEBUG ifstream in; ofstream out; #endif #ifdef DEBUG #define CIN in #define COUT out #else #define CIN cin #define COUT cout #endif set<int> lftTable; set<int> rhtTable; int main(void) { #ifdef DEBUG string buffer; CIN.open("in", ios::in); COUT.open("out", ios::out); while(getline(CIN, buffer)) COUT << buffer << "\n"; COUT << "Out Put" << "\n"; CIN.close(); CIN.open("in", ios::in); #endif int cnt, tmp; while(CIN >> cnt){ lftTable.clear(); rhtTable.clear(); for(int idx = 0; idx < cnt; idx++){ CIN >> tmp; lftTable.insert(tmp); } for(int idx = 0; idx < cnt; idx++){ CIN >> tmp; rhtTable.insert(tmp); } int flag = 0; do{ if(lftTable.size() != rhtTable.size()) break; set<int>::iterator lft_iter = lftTable.begin(); set<int>::iterator rht_iter = rhtTable.begin(); while(lft_iter != lftTable.end() && *lft_iter == *rht_iter){ lft_iter++; rht_iter++; } if(lft_iter == lftTable.end()) flag = 1; }while(0); COUT << ( flag ? "YES" : "NO") << endl; } return 0; }
hdu 5058
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。