백준 알고리즘 1269번 : 대칭 차집합
링크
https://www.acmicpc.net/problem/1269
Sol1) Set
#include <bits/stdc++.h>
#define X first
#define Y second
#define pb push_back
#define sz(a) int((a).size())
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
using namespace std;
using ll = long long;
using ull = unsigned long long;
using dbl = double;
using ldb = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using wector = vector<vector<int>>;
using tiii = tuple<int,int,int>;
int main() {
fastio;
set<int> a,b;
int n,k; cin >> n >> k;
for(int i = 0; i < n; i++){
int t; cin >> t; a.insert(t);
}
for(int i = 0; i < k; i++){
int c; cin >> c; b.insert(c);
}
int ans = 0;
for(auto i = a.begin(); i != a.end(); i++){
if(b.find(*i) == b.end()) ans++;
}
for(auto i = b.begin(); i != b.end(); i++){
if(a.find(*i) == a.end()) ans++;
}
cout << ans << "\n";
return 0;
}
Author And Source
이 문제에 관하여(백준 알고리즘 1269번 : 대칭 차집합), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@inwooleeme/백준-알고리즘-1269번-대칭-차집합저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)