text stringlengths 49 983k |
|---|
#include <bits/stdc++.h>
using namespace std;
char s[1009][512];
char p[1009][512];
int main() {
int i, j, n, m;
cin >> n >> m;
cin.get();
for (i = 1; i <= n; i++) cin >> s[i];
for (j = 1; j <= m; j++) cin >> p[j];
int ega = 0;
for (i = 1; i <= n; i++)
for (j = 1; j <= m; j++)
if (strcmp(s[i], p[j]) == 0) {
ega++;
continue;
}
int pri, sec;
if (ega % 2) {
pri = ega / 2 + 1;
sec = ega / 2;
} else {
pri = sec = ega / 2;
}
n -= ega;
m -= ega;
pri += n;
sec += m;
if (pri > sec)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
map<string, int> mpa, mpb;
cin >> n >> m;
string str;
for (int i = 0; i < n; i++) {
cin >> str;
mpa[str]++;
}
for (int i = 0; i < m; i++) {
cin >> str;
mpb[str]++;
}
if (n > m) {
cout << "YES" << endl;
} else if (n < m)
cout << "NO" << endl;
else {
int c = 0;
for (auto it1 = mpa.begin(), it2 = mpb.begin(); it1 != mpa.end();
it1++, it2++) {
if (it1->second == mpb[it1->first]) c++;
}
if (c % 2)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int m, n, common = 0;
cin >> n >> m;
string s;
vector<string> vs;
for (int i = 0; i < n; i++) {
cin >> s;
vs.push_back(s);
}
for (int i = 0; i < m; i++) {
cin >> s;
if (find(vs.begin(), vs.end(), s) != vs.end()) common++;
}
if (common % 2 == 0) {
if (n - common > m - common)
cout << "YES";
else
cout << "NO";
} else {
if (n - common > m - common - 1)
cout << "YES";
else
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m, count = 0, count1 = 0, count2 = 0;
cin >> n >> m;
string a[n], b[m];
for (long long i = 0; i < n; ++i) {
cin >> a[i];
}
for (long long i = 0; i < m; ++i) {
cin >> b[i];
}
for (long long i = 0; i < m; ++i) {
for (long long j = 0; j < n; ++j) {
if (a[j] == b[i]) {
++count;
}
}
}
if (count % 2 != 0) {
++count1;
}
count1 = count1 + (n - count);
count2 = count2 + (m - count);
if (count1 > count2) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
set<string> s;
cin >> n >> m;
for (int i = 0; i < n; i++) {
string ss;
cin >> ss;
s.insert(ss);
}
int b = 0;
for (int i = 0; i < m; i++) {
string ss;
cin >> ss;
if (s.count(ss)) b++;
}
if (b & 1) n++;
if (n > m)
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m, intercnt = 0;
char aszBuf[1000];
set<string> st;
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%s", aszBuf);
st.insert(aszBuf);
}
for (int i = 0; i < m; i++) {
scanf("%s", aszBuf);
if (st.count(aszBuf) > 0) {
intercnt++;
}
}
m -= (intercnt & 1);
if (n <= m)
printf("NO\n");
else
printf("YES\n");
return;
}
int main() {
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, m, cmn;
string x;
set<string> s;
int main() {
cin >> n >> m;
for (int i = 0; i < n + m; i++) {
cin >> x;
s.insert(x);
}
int l = s.size();
cmn = m + n - l;
if (cmn) {
if (cmn % 2) {
n += (cmn / 2) + 1;
m += cmn / 2;
} else {
n += cmn / 2;
m += cmn / 2;
}
}
if (n > m)
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
string p[n], e[m];
if (n > m) cout << "YES";
if (n < m) cout << "NO";
if (n == m) {
for (int i = 0; i < n; i++) cin >> p[i];
for (int i = 0; i < n; i++) cin >> e[i];
int t = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (p[i] == e[j]) {
t++;
break;
}
}
}
if (t % 2 != 0)
cout << "YES";
else
cout << "NO";
}
}
|
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T mod_v(T num) {
if (num >= 0)
return num % 1000000007;
else
return (num % 1000000007 + 1000000007) % 1000000007;
}
template <class T>
inline T gcd(T a, T b) {
a = abs(a);
b = abs(b);
while (b) b ^= a ^= b ^= a %= b;
return a;
}
template <class T>
T fast_pow(T n, T p) {
if (p == 0) return 1;
if (p % 2) {
T g = mod_v(mod_v(n) * mod_v(fast_pow(n, p - 1)));
return g;
} else {
T g = fast_pow(n, p / 2);
g = mod_v(mod_v(g) * mod_v(g));
return g;
}
}
template <class T>
inline T modInverse(T n) {
return fast_pow(n, 1000000007 - 2);
}
template <class T>
inline void debug(string S1, T S2, string S3) {
cout << S1 << S2 << S3;
}
bool equalTo(double a, double b) {
if (fabs(a - b) <= 1e-9)
return true;
else
return false;
}
bool notEqual(double a, double b) {
if (fabs(a - b) > 1e-9)
return true;
else
return false;
}
bool lessThan(double a, double b) {
if (a + 1e-9 < b)
return true;
else
return false;
}
bool lessThanEqual(double a, double b) {
if (a < b + 1e-9)
return true;
else
return false;
}
bool greaterThan(double a, double b) {
if (a > b + 1e-9)
return true;
else
return false;
}
bool greaterThanEqual(double a, double b) {
if (a + 1e-9 > b)
return true;
else
return false;
}
template <class T>
inline int in(register T& num) {
register char c = 0;
num = 0;
bool n = false;
while (c < 33) c = getchar();
while (c > 33) {
if (c == '-')
n = true;
else
num = num * 10 + c - '0';
c = getchar();
}
num = n ? -num : num;
return 1;
}
int main() {
int n, m;
string s;
in(n), in(m);
int cnt = 0;
int turn = 0;
map<string, int> maps;
for (int i = 0; i < n; i++) {
cin >> s;
maps[s]++;
}
for (int i = 0; i < m; i++) {
cin >> s;
maps[s]++;
if (maps[s] == 2) cnt++;
}
n -= cnt;
m -= cnt;
if (cnt % 2) turn = 1;
if (n == m) {
if (turn == 1)
printf("YES\n");
else
printf("NO\n");
} else {
if (n > m)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 200;
const long long NN = 1e3 + 100;
map<string, long long> b;
string s;
string name[2] = {"YES", "NO"};
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
long long n, m;
cin >> n >> m;
for (long long i = 0; i < n; i++) {
cin >> s;
b[s] = true;
}
long long k = 0;
for (long long i = 0; i < m; i++) {
cin >> s;
if (b[s]) k++;
}
n -= k;
m -= k;
if (k % 2 == 1) {
swap(n, m);
swap(name[0], name[1]);
}
if (n <= m) {
cout << name[1] << "\n";
} else {
cout << name[0] << "\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
unsigned long long B1 = 127;
long long B2 = 197;
long long MOD = 1000000009LL;
int n, m;
char inp[1011];
int L;
set<pair<unsigned long long, long long> > PB;
int PoB = 0, Both = 0, EB = 0;
int main() {
int i, j;
pair<unsigned long long, long long> H;
int mv = 0;
scanf("%d %d", &n, &m);
for (i = 1; i <= n; i++) {
scanf("%s", inp + 1);
L = strlen(inp + 1);
H = make_pair(0, 0);
for (j = 1; j <= L; j++) {
H.first *= B1;
H.first += (unsigned long long)inp[j];
H.second *= B2;
H.second += (long long)inp[j];
H.second %= MOD;
}
PB.insert(H);
}
for (i = 1; i <= m; i++) {
scanf("%s", inp + 1);
L = strlen(inp + 1);
H = make_pair(0, 0);
for (j = 1; j <= L; j++) {
H.first *= B1;
H.first += (unsigned long long)inp[j];
H.second *= B2;
H.second += (long long)inp[j];
H.second %= MOD;
}
if (PB.find(H) != PB.end()) {
Both++;
PB.erase(H);
} else {
EB++;
}
}
PoB = PB.size();
while (1) {
if (Both > 0) {
Both--;
mv ^= 1;
} else {
if (mv == 0) {
if (PoB > 0)
PoB--;
else
break;
} else {
if (EB > 0)
EB--;
else
break;
}
mv ^= 1;
}
}
if (mv == 0) {
printf("NO\n");
} else {
printf("YES\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
while (t--) {
int n, m;
cin >> n >> m;
std::map<string, int> mp;
string str;
for (int i = 0; i < n; ++i) {
cin >> str;
mp[str]++;
}
int common = 0;
for (int i = 0; i < m; ++i) {
cin >> str;
if (mp[str]) ++common;
}
(common & 1) ? ((n >= m) ? cout << "YES\n" : cout << "NO\n")
: ((n > m) ? cout << "YES\n" : cout << "NO\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, e, i, j, n;
int main() {
map<string, long long> m, m1;
cin >> a >> b;
string s;
for (i = 1; i <= a; i++) {
cin >> s;
m[s]++;
}
d = b;
for (i = 1; i <= b; i++) {
cin >> s;
if (m[s] > 0) {
n++;
a--;
d--;
m[s]--;
}
}
if (n % 2 == 1) {
if (d > a)
cout << "NO";
else
cout << "YES";
} else {
if (a > d)
cout << "YES";
else
cout << "NO";
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
if (n < m)
cout << "NO";
else if (m < n)
cout << "YES";
else {
set<string> s;
string str;
for (int i = 0; i < n + m; i++) {
cin >> str;
s.insert(str);
}
int res = n + m - s.size();
if (res % 2 == 0)
cout << "NO";
else
cout << "YES";
}
}
|
#include <bits/stdc++.h>
using namespace std;
char P[1005][505], B[1005][505];
int main() {
int n, m, i, j;
scanf("%d %d", &n, &m);
for (i = 0; i < n; i++) {
scanf("%s", &P[i]);
}
for (i = 0; i < m; i++) {
scanf("%s", &B[i]);
}
for (i = 0; i < n; i++) {
for (j = i + 1; j < n; j++) {
if (strcmp(P[i], P[j]) == 0) n--;
}
}
for (i = 0; i < m; i++) {
for (j = i + 1; j < m; j++) {
if (strcmp(B[i], B[j]) == 0) m--;
}
}
int cnt = 0;
if (n > m)
printf("YES\n");
else if (n < m)
printf("NO\n");
else {
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
if (strcmp(P[i], B[j]) == 0) {
cnt++;
break;
}
}
}
if (cnt % 2)
printf("YES\n");
else
printf("NO\n");
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int n, m;
cin >> n >> m;
set<string> s;
long long int c = n + m;
for (long long int i = 0; i < c; i++) {
string str;
cin >> str;
s.insert(str);
}
c = c - s.size();
if (c % 2 == 1) m--;
if (n > m)
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m;
cin >> n >> m;
set<string> N, M;
string s;
for (int i = 0; i < n; i++) {
cin >> s;
N.insert(s);
}
int cnt = 0;
for (int i = 0; i < m; i++) {
cin >> s;
if (N.count(s)) cnt++;
M.insert(s);
}
if (m > n) {
cout << "NO";
} else if (n > m) {
cout << "YES";
} else {
if (cnt % 2) {
cout << "YES";
} else {
cout << "NO";
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
string a[1005];
string b[1005];
set<string> s;
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> a[i];
s.insert(a[i]);
}
int cnt = 0;
for (int i = 0; i < m; i++) {
cin >> b[i];
if (s.find(b[i]) != s.end()) cnt++;
}
n -= cnt;
m -= cnt;
if (cnt % 2 == 1) n++;
if (n > m) {
cout << "YES" << endl;
return 0;
} else {
cout << "NO" << endl;
return 0;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m) {
map<string, int> mp;
string str;
int cnt = 0;
for (int i = 0; i < n; i++) {
cin >> str;
mp[str]++;
}
for (int i = 0; i < m; i++) {
cin >> str;
mp[str]++;
if (mp[str] == 2) cnt++;
}
if (n > m) {
cout << "YES" << endl;
} else if (m > n) {
cout << "NO" << endl;
} else if (m == n) {
if (cnt == 0)
cout << "NO" << endl;
else if (cnt % 2 == 1)
cout << "YES" << endl;
else if (cnt % 2 == 0)
cout << "NO" << endl;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m) {
string str;
map<string, int> ball;
int Equal = 0;
for (int i = 0; i < n; ++i) {
cin >> str;
ball[str] = 1;
}
for (int i = 0; i < m; ++i) {
cin >> str;
if (ball[str] == 1) ++Equal;
}
int p = n - Equal, b = m - Equal;
if (p > b || (p == b && Equal % 2 == 1))
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n1 = 0, n2 = 0;
map<string, int> mp;
int n, m;
string s;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
cin >> s;
if (mp[s] == 0) {
mp[s] = 1;
n1++;
}
}
int ss = 0;
for (int i = 0; i < m; i++) {
cin >> s;
if (mp[s] == 0) {
mp[s] = -1;
n2++;
} else if (mp[s] == 1) {
mp[s] = -1;
ss++;
}
}
if (n1 - ss / 2 > ss / 2 + n2) {
puts("YES");
} else
puts("NO");
}
|
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
set<string> pol;
set<string> ene;
set<string> sam;
int main() {
ios_base::sync_with_stdio(0);
int n, m;
string str;
while (cin >> n >> m) {
for (int i = 0; i < n; ++i) {
cin >> str;
pol.insert(str);
}
for (int i = 0; i < m; ++i) {
cin >> str;
ene.insert(str);
}
for (auto it = pol.begin(); it != pol.end();) {
if (ene.count(*it)) {
sam.insert(*it);
ene.erase(*it);
pol.erase(it++);
} else {
++it;
}
}
if (pol.size() == ene.size()) {
if (sam.size() & 1) {
cout << "YES\n";
} else {
cout << "NO\n";
}
} else if (pol.size() > ene.size()) {
cout << "YES\n";
} else {
cout << "NO\n";
}
pol.clear();
ene.clear();
sam.clear();
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool isprime(int n) {
for (int i = 2; i * i <= n; ++i) {
if (n % i == 0 && n != i) return false;
}
return true;
}
int32_t main() {
int n, m;
cin >> n >> m;
set<string> st1, st2, st3;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
st1.insert(s);
}
for (int i = 0; i < m; ++i) {
string s;
cin >> s;
st2.insert(s);
}
for (set<string>::iterator iter = st1.begin(); iter != st1.end(); ++iter) {
if (st2.find(*iter) != st2.end()) {
st3.insert(*iter);
}
}
for (set<string>::iterator iter = st3.begin(); iter != st3.end(); ++iter) {
st1.erase(*iter);
st2.erase(*iter);
}
int c1 = st1.size();
int c2 = st2.size();
int c3 = st3.size();
int p = 1;
while (true) {
if (c3) {
--c3;
p = (p == 1 ? 2 : 1);
} else {
if (p == 1) {
if (!c1) {
cout << "NO";
return 0;
}
--c1;
p = 2;
} else {
if (!c2) {
cout << "YES";
return 0;
}
--c2;
p = 1;
}
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
(ios_base::sync_with_stdio(false), cin.tie(nullptr));
int t;
t = 1;
while (t--) {
int n, m;
string s;
cin >> n >> m >> ws;
map<string, int> mp;
for (int i = 0; i < n; i++) {
getline(cin, s);
mp[s]++;
}
int common = 0;
for (int i = 0; i < m; i++) {
getline(cin, s);
if (mp[s] > 0) common++;
}
if (common % 2 != 0) {
if (n > m - 1)
cout << "YES"
<< "\n";
else
cout << "NO"
<< "\n";
} else {
if (n > m)
cout << "YES"
<< "\n";
else
cout << "NO"
<< "\n";
}
}
return EXIT_SUCCESS;
}
|
#include <bits/stdc++.h>
using namespace std;
const double Pi = acos(-1.0);
int N, M;
string a[1001], b[1001];
map<string, int> cnt;
int main() {
if (fopen("data.in", "r")) freopen("data.in", "r", stdin);
cin >> N >> M;
for (int i = 0; i < N; i++) {
cin >> a[i];
cnt[a[i]]++;
}
for (int i = 0; i < M; i++) {
cin >> b[i];
cnt[b[i]]++;
}
int repeat = 0;
for (map<string, int>::iterator it = cnt.begin(); it != cnt.end(); it++)
if (it->second == 2) repeat += 1;
int poly = (repeat + 1) / 2 + N - repeat;
int enem = repeat / 2 + M - repeat;
if (enem >= poly)
cout << "NO" << endl;
else
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long i, j, k, l, m, n, h;
cin >> n >> m;
set<string> s1, s2;
for (i = 0; i < n; i++) {
string s;
cin >> s;
s1.insert(s);
}
k = 0;
for (i = 0; i < m; i++) {
string s;
cin >> s;
if (s1.find(s) != s1.end()) k++;
s2.insert(s);
}
if (k & 1) {
if (n >= m)
cout << "YES";
else
cout << "NO";
} else {
if (n <= m)
cout << "NO";
else
cout << "YES";
}
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
long long n, m;
cin >> n >> m;
string s1[n], s2[m];
set<string> a, b;
for (long long i = 0; i < n; i++) {
cin >> s1[i];
a.insert(s1[i]);
}
long long c = 0;
for (long long i = 0; i < m; i++) {
cin >> s2[i];
if (a.find(s2[i]) != a.end()) {
c++;
}
}
if (c % 2 == 0) {
if (n > m)
cout << "YES" << endl;
else
cout << "NO" << endl;
} else {
if (n >= m)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
signed main() {
long long t = 1;
while (t--) {
solve();
}
}
|
#include <bits/stdc++.h>
int main() {
char s[2000][501];
int n, m, i, h, f = 0, k;
scanf("%d %d", &n, &m);
for (i = 0; i < n; i++) {
scanf("%s", &s[i]);
}
for (h = i; h < n + m; h++) {
scanf("%s", &s[h]);
for (k = 0; k < n; k++) {
if (strcmp(s[k], s[h]) == 0) {
f++;
}
}
}
if (f % 2 == 1) {
n++;
}
if (n <= m) {
printf("NO");
} else {
printf("YES");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
set<string> s;
int main() {
int n, m;
cin >> n >> m;
string tmp;
for (int i = 0; i < n; i++) {
cin >> tmp;
s.insert(tmp);
}
int match = 0;
for (int j = 0; j < m; j++) {
cin >> tmp;
if (s.find(tmp) != s.end()) {
match++;
}
}
n -= (match) / 2;
m -= (match) / 2;
if (match % 2 == 1) {
n++;
}
if (n > m) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
#pragma GCC optimize "-O3"
using namespace std;
map<string, int> mep;
int main() {
ios_base::sync_with_stdio(false);
int n, m, i, j, k, a = 0, b = 0, c = 0, id;
string x;
cin >> n >> m;
for (i = 0; i < n; i++) {
cin >> x;
mep[x] = true;
}
for (i = 0; i < m; i++) {
cin >> x;
if (mep[x] == true) c++;
}
a = n - c;
b = m - c;
int p = (c + 1) / 2, q = c / 2;
if (a + p > b + q)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
vector<bool> isprime(1000001, true);
void sieve() {
for (int i = 2; i * i <= 1000001; i++) {
if (isprime[i] == true) {
for (int j = (i + i); j <= 1000001; j = j + i) {
isprime[j] = false;
}
}
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n;
cin >> m;
map<string, int> ma;
int a = 0, b = 0;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
ma[s]++;
a++;
}
int val = 0;
for (int i = 1; i <= m; i++) {
string s;
cin >> s;
if (ma[s] == 1) {
a = a - 1;
val++;
} else {
b++;
}
}
if (a > b) {
cout << "YES" << '\n';
} else if (a == b && val % 2 == 1) {
cout << "YES" << '\n';
} else {
cout << "NO" << '\n';
}
}
|
#include <bits/stdc++.h>
using namespace std;
set<string> bothSet(set<string>& first, set<string>& second) {
set<string> result;
set<string>::iterator it = second.begin();
while (it != second.end()) {
if (first.count(*it) == 1) {
result.insert(*it);
}
it++;
}
return result;
}
set<string> only(set<string>& first, set<string>& second) {
set<string> result;
set<string>::iterator it1 = first.begin();
while (it1 != first.end()) {
result.insert(*it1);
it1++;
}
set<string>::iterator it2 = second.begin();
while (it2 != second.end()) {
result.erase(*it2);
it2++;
}
return result;
}
void printSet(set<string>& s) {
set<string>::iterator it = s.begin();
while (it != s.end()) {
cout << *it << " ";
it++;
}
}
int main() {
int n, m;
cin >> n >> m;
set<string> s1;
set<string> s2;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
s1.insert(s);
}
for (int i = 0; i < m; i++) {
string s;
cin >> s;
s2.insert(s);
}
set<string> onlyFirst = only(s1, s2);
set<string> onlySecond = only(s2, s1);
set<string> both = bothSet(s1, s2);
if (onlyFirst.size() < onlySecond.size() ||
(onlyFirst.size() == onlySecond.size() && both.size() % 2 == 0)) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, m, c = 0, x, i, j;
scanf("%d %d", &n, &m);
char s1[n][550], s2[m][550];
for (i = 0; i < n; i++) {
scanf("%s", s1[i]);
}
for (i = 0; i < m; i++) {
scanf("%s", s2[i]);
}
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
if (strcmp(s1[i], s2[j]) == 0) {
c++;
}
}
}
n = n - c + (c % 2);
m = m - c;
if (n > m) {
printf("YES");
} else
printf("NO");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
scanf("%d%d", &n, &m);
map<string, int> a, b;
set<string> uni;
vector<string> A, B, AB;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
a[s] = 1;
uni.insert(s);
}
for (int i = 0; i < m; i++) {
string s;
cin >> s;
b[s] = 1;
uni.insert(s);
}
set<string>::iterator it = uni.begin();
for (; it != uni.end(); it++) {
if (a[*it]) {
if (b[*it])
AB.push_back(*it);
else
A.push_back(*it);
} else
B.push_back(*it);
}
int turn = 1;
while (true) {
if (turn & 1) {
if (AB.size())
AB.pop_back();
else if (A.size())
A.pop_back();
else {
cout << "NO";
break;
}
} else {
if (AB.size())
AB.pop_back();
else if (B.size())
B.pop_back();
else {
cout << "YES";
break;
}
}
turn++;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, m;
cin >> n >> m;
map<string, int> m1;
map<string, int> m2;
vector<string> v1, v2, v3;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
v1.push_back(s);
}
for (int i = 0; i < m; i++) {
string s;
cin >> s;
v2.push_back(s);
}
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
if (v1.size() > v2.size()) {
cout << "YES" << endl;
} else if (v1.size() < v2.size())
cout << "NO" << endl;
else {
set_intersection(v1.begin(), v1.end(), v2.begin(), v2.end(),
back_inserter(v3));
if (v3.size() % 2 != 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
set<string> s;
int main() {
int n, m, i, C = 0, p = 0;
string X;
scanf("%d %d ", &n, &m);
for (i = 1; i <= n; i++) {
cin >> X;
s.insert(X);
}
for (i = 1; i <= m; i++) {
cin >> X;
if (s.find(X) != s.end()) C++;
}
while (1) {
if (C)
C--, n--, m--;
else {
if (p == 0) {
if (n)
n--;
else {
printf("NO");
return 0;
}
}
if (p == 1) {
if (m)
m--;
else {
printf("YES");
return 0;
}
}
}
p = 1 - p;
}
return 0;
}
|
#include <bits/stdc++.h>
const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long long MXLL = 4611686018427387903;
const int Sz = 1110111;
using namespace std;
inline void Read_rap() {
ios_base ::sync_with_stdio(0);
cin.tie(0);
}
map<string, int> cnt;
int both;
int f, s;
int n, m;
int main() {
Read_rap();
cin >> n >> m;
for (int i = 1; i <= n; i++) {
string d;
cin >> d;
cnt[d] += 1;
}
for (int i = 1; i <= m; i++) {
string d;
cin >> d;
cnt[d] += 2;
}
for (auto i : cnt) {
if (i.second == 3) both ^= 1;
if (i.second == 1) f++;
if (i.second == 2) s++;
}
if (both) {
if (f >= s)
cout << "YES";
else
cout << "NO";
} else {
if (f <= s)
cout << "NO";
else
cout << "YES";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
map<string, int> q;
int n, m, cnt = 0;
cin >> n >> m;
int ans1 = n, ans2 = m;
while (n--) {
cin >> s;
q[s]++;
}
while (m--) {
cin >> s;
q[s]++;
if (q[s] > 1) cnt++;
}
if (cnt % 2 == 1) ans2 -= 1;
if (ans1 <= ans2)
cout << "NO" << endl;
else
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
;
long long n, m, cmn = 0;
cin >> n >> m;
set<string> p;
set<string> e;
for (int i = 0; i < n; i++) {
string a;
cin >> a;
p.insert(a);
}
for (int i = 0; i < m; i++) {
string a;
cin >> a;
e.insert(a);
if (p.count(a) == 1) cmn++;
}
if (cmn % 2 == 1) n++;
if (n > m)
cout << "YES\n";
else
cout << "NO\n";
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, m;
int cnt = 0;
char word1[1005][505] = {0};
char word2[1005][505] = {0};
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) scanf("%s", &word1[i]);
for (int i = 0; i < m; i++) scanf("%s", &word2[i]);
if (n == m) {
for (int i = 0; i < n; i++) {
for (int k = 0; k < m; k++) {
if (strcmp(word1[i], word2[k]) == 0) {
cnt++;
break;
}
}
}
if (cnt & 1 == 1)
printf("YES\n");
else
printf("NO\n");
} else if (n > m)
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
int main() {
int n, m;
string s;
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> s;
mp[s] = 1;
}
int con = 0;
for (int i = 0; i < m; i++) {
cin >> s;
if (mp[s] == 1) {
con++;
}
}
m -= con;
n -= con;
if (con & 1) {
n++;
}
if (n > m) {
cout << "YES";
} else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
map<string, int> pol;
map<string, int> en;
cin >> n >> m;
int whole = 0;
string j;
for (int i = (0); i < (n); i++) {
cin >> j;
pol[j] = 1;
}
for (int i = (0); i < (m); i++) {
cin >> j;
en[j] = 1;
if (pol[j] == 1) whole++;
}
int p = 0, em = 0;
if (whole % 2 == 0) {
p += whole / 2;
em += whole / 2;
} else {
whole--;
p += whole / 2;
p += 1;
em += whole / 2;
}
for (map<string, int>::iterator it = pol.begin(); it != pol.end(); it++) {
if (en[it->first] == 0) p++;
}
for (map<string, int>::iterator it = en.begin(); it != en.end(); it++) {
if (pol[it->first] == 0) em++;
}
if (p > em)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
;
int p, e;
cin >> p >> e;
int dup = 0;
unordered_map<string, int> um;
for (int i = 0; i < p; i++) {
string s;
cin >> s;
um[s]++;
}
for (int i = 0; i < e; i++) {
string s;
cin >> s;
um[s]++;
if (um[s] == 2) dup++;
}
bool po;
(dup % 2 == 0) ? po = 1 : po = 0;
if (p == e)
(po) ? cout << "NO" : cout << "YES";
else if (p > e)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int cmn = 0;
map<string, int> ma;
for (int i = 0; i < n + m; i++) {
string s;
cin >> s;
if (ma[s] == 0)
ma[s]++;
else
cmn++;
}
if (n < m)
cout << "NO" << endl;
else if (n > m)
cout << "YES" << endl;
else {
if (cmn % 2 == 0) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int ni() {
int val;
scanf("%i", &val);
return val;
}
pair<int, int> npi() {
int valf, vals;
scanf("%i %i", &valf, &vals);
return make_pair(valf, vals);
}
int64_t nll() {
int64_t val;
scanf("%I64d", &val);
return val;
}
char nc() {
char val;
do {
scanf("%c", &val);
} while (val == ' ' || val == '\r' || val == '\n');
return val;
}
string ns() {
static char buff[1024 * 2000];
scanf("%s", buff);
return string{buff};
}
int64_t gcd(int64_t a, int64_t b) {
while (b) {
auto tmp = a % b;
a = b;
b = tmp;
}
return a;
}
int ret(int ans) {
printf("%i\n", ans);
exit(0);
}
int main() {
int n = ni(), m = ni();
set<string> st[2];
for (int i = 0; i < n; ++i) {
auto s = ns();
st[0].emplace(s);
}
for (int i = 0; i < m; ++i) {
auto s = ns();
st[1].emplace(s);
}
int tr = 0;
while (true) {
bool found = false;
string word;
for (auto& wrd : st[tr]) {
if (st[1 - tr].count(wrd)) {
word = wrd;
found = true;
break;
}
}
if (found) {
st[tr].erase(word);
st[1 - tr].erase(word);
} else {
for (auto& wrd : st[tr]) {
word = wrd;
found = true;
break;
}
if (found) {
st[tr].erase(word);
st[1 - tr].erase(word);
} else {
tr = 1 - tr;
break;
}
}
tr = 1 - tr;
}
if (tr == 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<string> data;
for (int i = 0; i != n; ++i) {
string x;
cin >> x;
data.push_back(x);
}
int count{0};
for (int i = 0; i < m; ++i) {
string x;
cin >> x;
for (string j : data) {
if (j == x) ++count;
}
}
n += count % 2;
if (n > m)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
long long a[100009];
int main() {
long long n, m;
cin >> n >> m;
long long i, j;
string s;
map<string, long long> mp1, mp2;
for (i = 0; i < n; i++) {
cin >> s;
mp1[s]++;
}
long long c = 0;
for (i = 0; i < m; i++) {
cin >> s;
if (mp1.find(s) != mp1.end()) {
c++;
}
mp2[s]++;
}
long long x = n - c;
long long y = m - c;
if (x > y) {
cout << "YES";
} else if (x < y) {
cout << "NO";
} else {
if (c % 2 == 0) {
cout << "NO";
} else {
cout << "YES";
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m;
cin >> n >> m;
set<string> s1, s2;
map<string, int> m1, m2;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
m1[s]++;
}
for (int j = 0; j < m; j++) {
string s;
cin >> s;
if (m1[s] == 1) {
m1[s] = 2;
} else {
m1[s] = 3;
}
}
int a = 0, b = 0, c = 0;
for (auto i = m1.begin(); i != m1.end(); i++) {
if (i->second == 1) a++;
if (i->second == 2) b++;
if (i->second == 3) c++;
}
if (b % 2 == 0 && a > c) {
cout << "YES";
}
if (b % 2 == 0 && a <= c) {
cout << "NO";
}
if (b % 2 == 1 && a >= c) {
cout << "YES";
}
if (b % 2 == 1 && a < c) {
cout << "NO";
}
}
signed main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr);
int t = 1;
while (t--) {
solve();
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int Max = 1e3;
string s1[Max], s2[Max];
bool vis1[Max + 10], vis2[Max + 10];
int main() {
cin.sync_with_stdio(false);
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> s1[i];
for (int j = 0; j < m; j++) cin >> s2[j];
int sum1 = 0, sum2 = 0, sum3 = 0;
for (int i = 0; i < n; i++) {
bool flag = true;
for (int j = 0; j < m; j++) {
if (s1[i] == s2[j]) {
sum3++;
flag = false;
break;
}
}
if (flag) sum1++;
}
sum2 = m - sum3;
if (sum3 % 2) sum1++;
if (sum1 > sum2)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m) {
set<string> s1;
string a;
for (int i = 0; i < n; i++) {
cin >> a;
s1.insert(a);
}
for (int i = 0; i < m; i++) {
cin >> a;
s1.insert(a);
}
if (n > m)
cout << "YES" << endl;
else if (n < m)
cout << "NO" << endl;
else {
if ((n + m - s1.size()) % 2 == 1)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
return 0;
}
|
#include <bits/stdc++.h>
const int inf_max = 0x3f3f3f3f;
const long long Linf = 9e18;
const int maxn = 3e7 + 10;
const double eps = 0.0001;
using namespace std;
int n, m, rp, cnt1, cnt2;
set<string> st;
int main() {
while (~scanf("%d%d", &n, &m)) {
string str;
rp = cnt1 = cnt2 = 0;
for (int i = 1; i <= n; i++) {
cin >> str;
st.insert(str);
}
for (int i = 1; i <= m; i++) {
cin >> str;
set<string>::iterator it = st.find(str);
if (it != st.end()) rp++;
}
cnt1 = n - rp;
cnt2 = m - rp;
if (rp % 2) {
if (cnt2 <= cnt1)
printf("YES\n");
else
printf("NO\n");
} else {
if (cnt1 > cnt2)
printf("YES\n");
else
printf("NO\n");
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
int main() {
int n, m, cc = 0;
cin >> n >> m;
for (int i = 1; i <= n + m; i++) {
string s;
cin >> s;
if (!mp[s])
mp[s] = 1;
else
cc = 1 - cc;
}
n += cc;
if (n > m)
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int main() {
int n, m, tmp = 0;
cin >> n >> m;
map<string, bool> mp;
vector<string> poland, enemy;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
poland.push_back(s);
mp[s] = 1;
}
for (int i = 0; i < m; i++) {
string s;
cin >> s;
enemy.push_back(s);
if (mp[s]) tmp++;
}
n -= tmp;
m -= tmp;
if (tmp % 2) n++;
if (n <= m)
cout << "NO" << endl;
else
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<string> Poland, Enemy;
set<string> all;
for (int i = 0; i < n; i++) {
string word;
cin >> word;
Poland.push_back(word);
all.insert(word);
}
for (int i = 0; i < m; i++) {
string word;
cin >> word;
Enemy.push_back(word);
all.insert(word);
}
int common = Poland.size() + Enemy.size() - all.size();
int P = Poland.size() - common;
int E = Enemy.size() - common;
if (P > E)
cout << "YES" << endl;
else if (P < E)
cout << "NO" << endl;
else if (common % 2)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, m, s = 0;
cin >> n >> m;
int i, j, k;
string a[1000], b[1000];
for (i = 0; i < n; i++) {
cin >> a[i];
}
for (i = 0; i < m; i++) {
cin >> b[i];
for (j = 0; j < n; j++) {
if (b[i] == a[j]) {
s++;
}
}
}
s = s & 1;
if (n + s > m)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, m, counter;
string a[1001], b[1001];
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < m; i++) cin >> b[i];
for (int i = 0; i < n; i++)
for (int y = 0; y < m; y++)
if (a[i] == b[y]) counter++;
n -= counter;
m -= counter;
n = n + (counter % 2);
if (n > m)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.sync_with_stdio(0);
int n, m;
cin >> n >> m;
set<string> first;
set<string> second;
int common = 0;
int firstUnique = 0;
int secondUnique = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
first.insert(s);
}
for (int i = 0; i < m; i++) {
string s;
cin >> s;
second.insert(s);
}
for (const string s : first) {
if (second.find(s) != second.end()) {
common++;
} else {
firstUnique++;
}
}
for (const string s : second) {
if (first.find(s) != first.end()) {
} else {
secondUnique++;
}
}
int firstCount = common / 2 + (common % 2) + firstUnique;
int secondCount = common / 2 + secondUnique;
cout << (firstCount > secondCount ? "YES" : "NO") << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int ip[1000010];
void cb() {
ip[0] = ip[1] = 1;
for (int i = 2; i * i <= 1000005; i++) {
if (ip[i]) continue;
for (int j = i + i; j <= 1000005; j += i) ip[j] = 1;
}
}
int main() {
int n, m;
cin >> n >> m;
set<string> wa, wb, ww;
for (int i = 0; i < n; i++) {
string t;
cin >> t;
wa.insert(t);
}
for (int i = 0; i < m; i++) {
string t;
cin >> t;
if (wa.count(t)) {
wa.erase(t);
ww.insert(t);
} else
wb.insert(t);
}
int p = 0;
int sw = ww.size(), sb = wb.size(), sa = wa.size();
while (1) {
if (p) {
if (sw == 0 && sb == 0) {
puts("YES");
return 0;
}
if (sw == 0)
sb--;
else
sw--;
} else {
if (sw == 0 && sa == 0) {
puts("NO");
return 0;
}
if (sw == 0)
sa--;
else
sw--;
}
p ^= 1;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
set<string> pol;
string p[n + 5];
string e[m + 5];
int i;
for (i = 0; i < n; i++) {
cin >> p[i];
pol.insert(p[i]);
}
int com = 0;
for (i = 0; i < m; i++) {
cin >> e[i];
if (pol.find(e[i]) != pol.end()) com++;
}
n -= com;
m -= com;
if (com % 2 == 0) {
if (n > m)
cout << "YES\n";
else
cout << "NO\n";
} else {
m--;
if (n > m)
cout << "YES\n";
else
cout << "NO\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
map<string, int> mp;
int n, m;
cin >> n >> m;
int same = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
mp[s] = 1;
}
for (int i = 0; i < m; i++) {
string s;
cin >> s;
if (mp[s]) same++;
}
n = n - same;
m = m - same;
if (same % 2 == 1)
n >= m ? cout << "YES" : cout << "NO";
else
n > m ? cout << "YES" : cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void Oli() {
int n, m;
cin >> n >> m;
vector<string> b(n);
vector<string> c;
for (int i = 0; i < n; i++) cin >> b[i];
int com = 0;
for (int i = 0; i < m; i++) {
string x;
cin >> x;
bool f = false;
for (int j = 0; j < b.size(); j++) {
if (x == b[j]) {
com++;
b.erase(b.begin() + j);
f = true;
break;
}
}
if (!f) c.push_back(x);
}
bool f = false;
if (com % 2 == 0) {
f = false;
} else
f = true;
if (!f) {
if (b.size() > c.size()) {
f = true;
}
} else {
if (b.size() < c.size()) {
f = false;
}
}
if (f)
cout << "YES";
else {
cout << "NO";
}
}
int main() {
int times = 1;
while (times--) Oli();
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
set<string> st1, st2;
int n, m;
cin >> n >> m;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
st1.insert(s);
}
for (int i = 0; i < m; ++i) {
string s;
cin >> s;
st2.insert(s);
}
set<string> good;
for (auto it : st1)
if (st2.find(it) != st2.end()) good.insert(it);
int c = good.size() % 2;
if (c == 1) {
if (st2.size() <= st1.size())
cout << "YES" << endl;
else
cout << "NO" << endl;
} else {
if (st2.size() < st1.size())
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
const int INF = 1e9 + 123;
using namespace std;
const int MAX_INT = 2 * ((1 << 30) - 1) + 1;
template <class T>
inline const T sqr(const T& x) {
return x * x;
}
double PI = 3.141592653589793238462643383279502884;
long long next_pow_2(long long x) {
if (x < 2) return 1;
long long ans = 1;
do {
ans <<= 1;
} while (ans < x);
return ans;
}
long long gcd(long long a, long long b) {
while (b) {
a %= b;
swap(a, b);
}
return a;
}
long long popcnt(long long mask) {
long long cnt = 0;
while (mask) cnt += mask % 2, mask /= 2;
return cnt;
}
unsigned long long powi(unsigned long long a, unsigned long long b,
long long mod = 1000000007) {
if (b < 2) return b ? a : 1;
return (powi((a * a) % mod, b / 2, mod) * (b % 2 ? a : 1LL)) % mod;
}
long long mod7 = 1000000007;
long long mod9 = 1000000009;
bool isprime(long long n) {
if (n < 2) return 0;
for (long long i = 2; i * i <= n; i++)
if (n % i == 0) return 0;
return 1;
}
int main() {
int n, m, a = 0, b = 0;
cin >> n >> m;
a = n;
b = m;
map<string, int> t;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
t[s]++;
}
for (int i = 0; i < m; i++) {
string s;
cin >> s;
t[s]++;
}
int c = 0;
for (auto it : t) {
if (it.second == 2) {
c++;
}
}
a -= c;
b -= c;
if (c % 2 == 1) {
a += 1;
}
if (a > b) {
cout << "YES";
} else {
cout << "NO";
}
}
|
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 1;
set<int> h1, h2;
char s[502];
int main() {
long long n, m, a = 0, b = 0, c = 0, x;
scanf("%lld%lld", &n, &m);
for (int i = 0; i < n; ++i) {
scanf("%s", s);
x = 0;
for (int j = 0; s[j]; j++) x = (27 * x + s[j] - 'a' + 1) % 1000000007;
h1.insert(x);
}
for (int i = 0; i < m; ++i) {
scanf("%s", s);
x = 0;
for (int j = 0; s[j]; j++) x = (27 * x + s[j] - 'a' + 1) % 1000000007;
if (h1.find(x) != h1.end()) c++;
h2.insert(x);
}
a = int((h1).size()) - c;
b = int((h2).size()) - c;
x = min(a, b);
a -= x;
b -= x;
if (a)
printf("YES\n");
else if (b)
printf("NO\n");
else if (c % 2)
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
set<string> seta;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
seta.insert(s);
}
set<string> setb;
for (int i = 0; i < m; i++) {
string s;
cin >> s;
setb.insert(s);
}
int c = 0;
for (auto p : seta) {
if (setb.find(p) != setb.end()) {
c++;
}
}
int a = n - c;
int b = m - c;
if (c % 2 == 0) {
if (a > b) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
} else {
if (a < b) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, count = 0;
cin >> n >> m;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string x;
cin >> x;
mp[x]++;
}
for (int i = 0; i < m; i++) {
string x;
cin >> x;
mp[x]++;
if (mp[x] > 1) count++;
}
if (n > m)
cout << "YES" << endl;
else if (m > n)
cout << "NO" << endl;
else {
if (count % 2 == 0)
cout << "NO" << endl;
else
cout << "YES" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
map<string, int> M;
map<string, int>::iterator p;
cin >> n >> m;
if (n == m) {
int dup = 0;
string str;
for (int i = 0; i < n; i++) {
cin >> str;
M[str] = 1;
}
for (int i = 0; i < m; i++) {
cin >> str;
if (M.find(str) != M.end()) dup++;
}
if (dup % 2 == 0)
cout << "NO";
else
cout << "YES";
} else if (n > m)
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, m, k, i, j;
string s1[1001], s2[1001];
int main() {
cin >> n >> m;
if (n > m) {
cout << "YES";
return 0;
}
if (m > n) {
cout << "NO";
return 0;
}
for (i = 0; i < n; i++) cin >> s1[i];
for (j = 0; j < m; j++) cin >> s2[j];
for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
if (s1[i] == s2[j]) {
k++;
break;
}
if (k % 2 == 0)
cout << "NO";
else
cout << "YES";
}
|
#include <bits/stdc++.h>
using namespace std;
string s;
set<string> u;
int n, m, cnt;
int main() {
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
cin >> s;
u.insert(s);
}
for (int i = 0; i < m; i++) {
cin >> s;
if (u.find(s) != u.end()) cnt++;
}
n = (n - cnt) + cnt % 2, m = m - cnt;
printf("%s", n > m ? "YES" : "NO");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
set<string> p;
set<string> e;
string str;
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
cin >> str;
p.insert(str);
}
int counter = 0;
for (int i = 0; i < m; i++) {
cin >> str;
if (p.count(str)) {
counter++;
p.erase(str);
} else
e.insert(str);
}
if (p.size() > e.size())
printf("YES\n");
else if (counter % 2 == 1 && p.size() == e.size())
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
string inp;
set<string> pol;
int poland, enemy, shared;
int n, m;
inline bool exists(string s) { return pol.find(s) != pol.end(); }
int main() {
cin >> n >> m;
for (int i = 0; i < n; ++i) {
cin >> inp;
pol.insert(inp);
++poland;
}
for (int i = 0; i < m; ++i) {
cin >> inp;
if (exists(inp)) {
--poland;
++shared;
} else
++enemy;
}
if (shared & 1) {
if (poland == enemy)
cout << "YES\n";
else if (poland > enemy)
cout << "YES\n";
else
cout << "NO\n";
} else {
if (poland == enemy)
cout << "NO\n";
else if (poland > enemy)
cout << "YES\n";
else
cout << "NO\n";
}
}
|
#include <bits/stdc++.h>
using namespace std;
int n, m, i, j;
int main() {
int flag = 0;
string s1[1000];
string s2[1000];
cin >> n >> m;
for (i = 0; i < n; i++) cin >> s1[i];
int k;
for (j = 0; j < m; j++) {
cin >> s2[j];
for (k = 0, i = n - 1; i >= n / 2; k++, i--) {
if (s2[j] == s1[i])
flag++;
else if (s2[j] == s1[k])
flag++;
}
}
if (n > m)
cout << "YES";
else if (n < m)
cout << "NO";
else {
if (flag % 2)
cout << "YES";
else
cout << "NO";
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
string pl[n];
string en[m];
if (n > m)
cout << "YES";
else if (m > n)
cout << "NO";
else {
set<string> s;
int ile = 0;
for (int i = 0; i < n; i++) {
cin >> pl[i];
s.insert(pl[i]);
}
for (int i = 0; i < m; i++) {
cin >> en[i];
if (s.count(en[i])) ile ^= 1;
}
if (ile)
cout << "YES";
else
cout << "NO";
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
unordered_map<string, int> poland;
unordered_map<string, int> enemy;
unordered_map<string, int> both;
string s;
bool win = false;
for (int i = 0; i < n; i++) {
cin >> s;
poland[s]++;
both[s]++;
}
int count = 0;
for (int i = 0; i < m; i++) {
cin >> s;
both[s]++;
if (both[s] == 2) {
both.erase(s);
poland.erase(s);
count++;
} else {
enemy[s]++;
}
}
if (count == 0 || count % 2 == 0) {
if (poland.size() == enemy.size())
cout << "NO";
else if (poland.size() > enemy.size())
cout << "YES";
else
cout << "NO";
} else {
if (poland.size() == enemy.size())
cout << "YES";
else if (poland.size() > enemy.size())
cout << "YES";
else
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, same = 0;
string a[1005], b[1005];
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < m; i++) {
cin >> b[i];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (a[i] == b[j]) same++;
}
}
m -= same % 2;
if (n > m)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
set<string> p;
set<string> a;
set<string> b;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
a.insert(s);
}
for (int i = 0; i < m; ++i) {
string s;
cin >> s;
auto it = b.begin();
it = a.find(s);
if (it != a.end()) {
p.insert(s);
a.erase(s);
} else {
b.insert(s);
}
}
int a1 = a.size();
int b1 = b.size();
if (p.size() % 2 == 1) {
a1++;
}
if (a1 > b1) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
string alist[10000000];
int main() {
set<string> mset;
set<string> mset_1;
int a, b;
cin >> a >> b;
while (a--) {
string c;
cin >> c;
mset.insert(c);
}
int same = 0;
while (b--) {
string c;
cin >> c;
mset.find(c) != mset.end() ? same++ : same = same;
mset_1.insert(c);
}
int length = mset.size();
int length_1 = mset_1.size();
if (same % 2 != 0) length++;
length > length_1 ? cout << "YES" : cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
set<string> sett;
if (n > m) {
cout << "YES";
return 0;
}
if (n < m) {
cout << "NO";
return 0;
}
while (n--) {
string s;
cin >> s;
sett.insert(s);
}
int count = 0;
while (m--) {
string s;
cin >> s;
if (sett.count(s) != 0) count++;
}
if (count % 2 != 0)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int m, n, common = 0;
string x;
cin >> m >> n;
set<string> s;
for (int i = 0; i < m + n; i++) {
cin >> x;
if (s.count(x) == 0)
s.insert(x);
else
common++;
}
if (m - (common / 2) > n - ((common + 1) / 2))
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
vector<string> a;
int main() {
int n, m, knb = 0;
string wor;
cin >> n >> m;
for (int i = 1; i <= n + m; i++) {
cin >> wor;
a.push_back(wor);
}
sort(a.begin(), a.end());
for (int i = 0; i < n + m - 1; i++) {
if (a[i] == a[i + 1]) {
knb++;
}
}
if (knb % 2 == 0) {
if (n - knb <= m - knb) {
cout << "NO";
} else {
cout << "YES";
}
} else {
if (n - knb <= m - knb - 1) {
cout << "NO";
} else {
cout << "YES";
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<string> eb, pb;
int n, m;
scanf("%d %d", &n, &m);
vector<string> intersec, diffpb, diffeb;
pb = vector<string>(n, "");
eb = vector<string>(m, "");
intersec = vector<string>(n + m, "");
diffpb = diffeb = intersec;
for (int i = 0; i < n; i++) cin >> pb[i];
for (int i = 0; i < m; i++) cin >> eb[i];
sort(pb.begin(), pb.end());
sort(eb.begin(), eb.end());
auto it = std::set_intersection(pb.begin(), pb.end(), eb.begin(), eb.end(),
intersec.begin());
intersec.resize(it - intersec.begin());
auto itpb = set_difference(pb.begin(), pb.end(), intersec.begin(),
intersec.end(), diffpb.begin());
auto iteb = set_difference(eb.begin(), eb.end(), intersec.begin(),
intersec.end(), diffeb.begin());
diffeb.resize(iteb - diffeb.begin());
diffpb.resize(itpb - diffpb.begin());
if (intersec.size() % 2 == 0) {
if (diffeb.size() == diffpb.size()) {
printf("NO\n");
} else if (diffeb.size() > diffpb.size())
printf("NO\n");
else
printf("YES\n");
} else {
if (diffeb.size() == diffpb.size()) {
printf("YES\n");
} else if (diffeb.size() > diffpb.size())
printf("NO\n");
else
printf("YES\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long int max(long long int a, long long int b) { return a > b ? a : b; }
long long int min(long long int a, long long int b) {
return a + b - max(a, b);
}
set<int> primes;
int sieve[1000005];
void go() {
for (int i = 2; i < 1000005; i++) {
if (sieve[i] == 0) {
primes.insert(i);
for (int j = 2 * i; j < 1000005; j += i) sieve[j] = 1;
}
}
}
set<int> aSet, bSet;
vector<int> aVec, bVec;
map<string, int> Hash;
int main() {
cin.sync_with_stdio(false);
long long int i, j, n, l, r, m, k, sum = 0, Max = 0, x, y, d;
string str;
long long int ans = 0;
cin >> n >> m;
for (i = 0; i < n; i++) {
cin >> str;
if (Hash.find(str) == Hash.end()) Hash[str] = sum++;
aSet.insert(Hash[str]);
aVec.push_back(Hash[str]);
}
for (j = 0; j < m; j++) {
cin >> str;
if (Hash.find(str) == Hash.end()) Hash[str] = sum++;
bSet.insert(Hash[str]);
bVec.push_back(Hash[str]);
}
int winner = -1;
for (i = 0; i < n + m; i++) {
if (i % 2 == 0) {
for (j = 0; j < aVec.size(); j++) {
if (aSet.find(aVec[j]) != aSet.end() &&
bSet.find(aVec[j]) != bSet.end()) {
aSet.erase(aVec[j]);
bSet.erase(aVec[j]);
break;
}
}
if (j == aVec.size()) {
if (aSet.size() == 0) {
winner = 1;
break;
}
aSet.erase(aSet.begin());
}
} else {
for (j = 0; j < bVec.size(); j++) {
if (aSet.find(bVec[j]) != aSet.end() &&
bSet.find(bVec[j]) != bSet.end()) {
aSet.erase(bVec[j]);
bSet.erase(bVec[j]);
break;
}
}
if (j == bVec.size()) {
if (bSet.size() == 0) {
winner = 0;
break;
}
bSet.erase(bSet.begin());
}
}
}
if (winner == -1) {
if (aSet.size() == 0 && bSet.size() == 0)
winner = (m + n + 1) % 2;
else if (aSet.size() == 0)
winner = 1;
else
winner = 0;
}
if (winner == 0)
cout << "YES";
else if (winner == 1)
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e7 + 10;
const long long Mod = 1e9 + 7;
map<string, bool> s1, s2, s;
int n, m;
int now = 1;
int main() {
std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
string tempString;
cin >> tempString;
s1[tempString] = true;
}
for (int i = 1; i <= m; i++) {
string tempString;
cin >> tempString;
s2[tempString] = true;
}
int n1 = s1.size();
int n2 = s2.size();
for (auto i = s1.begin(); i != s1.end(); i++) {
if (s2[i->first] == true) {
if (now == 1) {
now = 2;
n2--;
} else {
now = 1;
n1--;
}
}
}
if (n1 > n2)
cout << "YES"
<< "\n";
else
cout << "NO"
<< "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, ct = 0;
cin >> n >> m;
string s;
unordered_map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> s;
mp[s] = 1;
}
for (int i = 0; i < m; i++) {
cin >> s;
if (mp[s]) ct++;
}
int val = ct;
int ct1 = n - val;
int ct2 = m - val;
if (val % 2 != 0) {
if (ct2 <= ct1) {
cout << "YES" << endl;
} else
cout << "NO" << endl;
} else {
if (ct2 < ct1) {
cout << "YES" << endl;
} else
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int64_t n, m;
cin >> n >> m;
set<string> po, en, com;
string s;
for (int64_t i = 0; i < n; ++i) {
cin >> s;
po.insert(s);
}
for (int64_t i = 0; i < m; ++i) {
string s;
cin >> s;
if (po.count(s))
com.insert(s), po.erase(po.find(s));
else
en.insert(s);
}
while (1) {
if (com.size() > 0) {
com.erase(com.begin());
} else if (po.size() > 0) {
po.erase(po.begin());
} else if (po.size() == 0)
return cout << "NO", 0;
if (com.size() > 0) {
com.erase(com.begin());
} else if (en.size() > 0) {
en.erase(en.begin());
} else if (en.size() == 0)
return cout << "YES", 0;
}
}
|
#include <bits/stdc++.h>
using namespace std;
set<string> a, b, common;
int main() {
long long n, m;
cin >> n >> m;
long long i;
for (i = 0; i < n; i++) {
string s;
cin >> s;
a.insert(s);
}
for (i = 0; i < m; i++) {
string s;
cin >> s;
b.insert(s);
}
for (auto it : a) {
if (b.find(it) != b.end()) common.insert(it);
}
long long chance = 0;
long long t = 0;
while (1) {
if (chance == 0) {
if (a.size() == 0) {
cout << "NO";
return 0;
}
string tmp;
if (common.size()) {
tmp = *common.begin();
common.erase(common.begin());
} else
tmp = *a.begin();
a.erase(a.find(tmp));
if (b.find(tmp) != b.end()) b.erase(b.find(tmp));
} else {
string tmp;
if (b.size() == 0) {
cout << "YES";
return 0;
}
if (common.size()) {
tmp = *common.begin();
common.erase(common.begin());
} else
tmp = *b.begin();
b.erase(b.find(tmp));
if (a.find(tmp) != a.end()) a.erase(a.find(tmp));
}
chance = chance ^ 1;
}
if (b.size() == 0) cout << "YES";
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m;
string x;
cin >> n >> m;
set<string> pol, ene;
vector<string> glow, flow;
for (int i = 0; i < n; ++i) {
cin >> x;
pol.insert(x);
}
for (int i = 0; i < m; ++i) {
cin >> x;
ene.insert(x);
}
set_difference((pol).begin(), (pol).end(), (ene).begin(), (ene).end(),
back_inserter(glow));
set_difference((ene).begin(), (ene).end(), (pol).begin(), (pol).end(),
back_inserter(flow));
int szg = glow.size();
int szf = flow.size();
if (szg > szf) {
cout << "YES"
<< "\n";
} else if (szf > szg)
cout << "NO"
<< "\n";
else {
if ((n - szg) & 1)
cout << "YES"
<< "\n";
else
cout << "NO"
<< "\n";
}
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
string s1[1000], s2[1000];
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> s1[i];
for (int i = 0; i < m; i++) cin >> s2[i];
int ans = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
if (s1[i] == s2[j]) ans++;
n -= ans / 2;
m -= ans / 2;
if (ans % 2) m--;
if (n > m)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long in() {
int32_t x;
scanf("%d", &x);
return x;
}
const long long maxn = 1e5 + 10;
map<string, bool> mark;
long long both;
int32_t main() {
long long n = in(), m = in();
for (long long i = 0; i < n; i++) {
string s;
cin >> s;
mark[s] = true;
}
for (long long i = 0; i < m; i++) {
string s;
cin >> s;
both += mark[s];
}
bool fl = false;
if (both % 2 == 0) {
fl = true;
}
if (n - fl >= m) return cout << "YES\n", 0;
cout << "NO\n";
}
|
#include <bits/stdc++.h>
using namespace std;
long long l, r, m, k, ans, p = 2, d, x, t, lc, rc, la, ra, lt, rt;
long long n, i, z;
string a[111111], b[111111];
map<string, long long> us;
pair<long long, string> a1[111111], b1[111111];
int main() {
cin >> n >> m;
for (i = 1; i <= n; i++) {
cin >> a[i];
us[a[i]]++;
}
for (i = 1; i <= m; i++) {
cin >> b[i];
us[b[i]]++;
}
for (i = 1; i <= n; i++) {
a1[i].first = us[a[i]];
a1[i].second = a[i];
}
for (i = 1; i <= m; i++) {
b1[i].first = us[b[i]];
b1[i].second = b[i];
}
sort(a1 + 1, a1 + 1 + n);
sort(b1 + 1, b1 + 1 + m);
while (x == 0) {
if (n == 0) {
cout << "NO";
return 0;
}
while (us[a1[n].second] == 0) {
if (n == 0) {
cout << "NO";
return 0;
}
n--;
}
us[a1[n].second] = 0;
n--;
if (m == 0) {
cout << "YES";
return 0;
}
while (us[b1[m].second] == 0) {
if (m == 0) {
cout << "YES";
return 0;
}
m--;
}
us[b1[m].second] = 0;
m--;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
unordered_set<string> first, second, common;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
first.insert(s);
}
for (int i = 0; i < m; ++i) {
string s;
cin >> s;
if (first.find(s) != first.end()) {
first.erase(s);
common.insert(s);
} else {
second.insert(s);
}
}
int turn = 0;
while (!common.empty()) {
turn = 1 - turn;
common.erase(common.begin());
}
while (true) {
if (turn == 0) {
if (first.empty()) {
cout << "NO";
return 0;
}
first.erase(first.begin());
} else {
if (second.empty()) {
cout << "YES";
return 0;
}
second.erase(second.begin());
}
turn = 1 - turn;
}
return 0;
}
|
#include <bits/stdc++.h>
typedef long long ll;
const int maxn = 2e6 + 10;
const int maxval = 1e9 + 10;
using namespace std;
int n, m, idx;
unordered_set<string> shared;
set<string> pol, enem;
bool flag;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
pol.insert(s);
}
for (int i = 0; i < m; i++) {
string s;
cin >> s;
enem.insert(s);
}
for (auto it = pol.begin(); it != pol.end(); it++) {
if (enem.find(*it) != enem.end()) {
shared.insert(*it);
}
}
while (1) {
if (!(idx & 1)) {
if (((int)shared.size())) {
auto it = shared.begin();
pol.erase(*it);
enem.erase(*it);
shared.erase(*it);
} else {
if (!((int)pol.size())) {
cout << "NO"
<< "\n";
return 0;
}
auto it = pol.begin();
pol.erase(*it);
}
} else {
if (((int)shared.size())) {
auto it = shared.begin();
enem.erase(*it);
pol.erase(*it);
shared.erase(*it);
} else {
if (!((int)enem.size())) {
cout << "YES"
<< "\n";
return 0;
}
auto it = enem.begin();
enem.erase(*it);
}
}
idx++;
}
}
|
#include <bits/stdc++.h>
using namespace std;
set<string> p;
int main() {
int n, m, c = 0;
cin >> n >> m;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
p.insert(s);
}
for (int i = 0; i < m; ++i) {
string s;
cin >> s;
if (p.find(s) != p.end()) {
c++;
}
}
cout << (n + c % 2 > m ? "YES\n" : "NO\n") << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
map<string, int> mapPol;
cin >> n >> m;
string str;
int rep = 0;
for (int i = 0; i < n; ++i) {
cin >> str;
mapPol[str]++;
}
for (int i = 0; i < m; ++i) {
cin >> str;
if (mapPol[str]) rep++;
}
int counter = 1;
bool flagPol = false, flagVrag = false;
while (m && n) {
if ((counter & 1) && (rep)) {
rep--;
m--;
if (m == 0) {
flagPol = true;
break;
}
n--;
if (n == 0) {
flagVrag = true;
break;
}
} else if (!(counter & 1) && (rep)) {
rep--;
n--;
if (n == 0) {
flagVrag = true;
break;
}
m--;
if (m == 0) {
flagPol = true;
break;
}
} else if ((counter & 1) && !(rep)) {
n--;
if (n == 0) {
flagVrag = true;
break;
}
} else if (!(counter & 1) && !(rep)) {
m--;
if (m == 0) {
flagPol = true;
break;
}
}
counter++;
}
if (flagPol)
cout << "YES";
else
cout << "NO";
int stop;
cin >> stop;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string str;
set<string> pbSet;
int i = 0, j = 0, k = 0, tmp1 = 0, tmp2 = 0, tmp3 = 0, tmp = 0, tmp4 = 0,
tmp5 = 0, flag = 0;
int common = 0, pbUn = 0, ebUn = 0;
int n, m;
scanf("%d %d\n", &n, &m);
for (i = 0; i < n; i++) {
cin >> str;
pbSet.insert(str);
}
for (i = 0; i < m; i++) {
cin >> str;
if (pbSet.find(str) != pbSet.end())
common++;
else
ebUn++;
}
pbUn = n - common;
if (common % 2 == 0) {
if (pbUn > ebUn)
printf("YES\n");
else
printf("NO\n");
} else {
if (pbUn >= ebUn)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long i, j, k = 0, m = 0, n, t, f = 0, x, z, y, p = 0, ans = 0,
mn = 10000000009, mx = 0;
cin >> n >> m;
vector<string> v, v1;
map<string, long long> mp, np;
string s;
long long common = 0;
for (i = 0; i < n; i++) {
cin >> s;
v.push_back(s);
mp[s]++;
}
for (i = 0; i < m; i++) {
cin >> s;
v1.push_back(s);
np[s]++;
if (np[s] <= mp[s]) common++;
}
x = n - common;
y = m - common;
if (x > y)
cout << "YES";
else if (x == y && (common & 1))
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int const inf = 1000 * 1000 * 1000;
long long const inf64 = 1ll * inf * inf;
int const MAX_VAL = 1000005;
bool prime[MAX_VAL];
int main() {
int n, m;
cin >> n >> m;
vector<string> a(n), b(m);
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < m; i++) cin >> b[i];
sort((a).begin(), (a).end());
sort((b).begin(), (b).end());
int cnt = 0;
for (int i = 0, j = 0; i < n && j < m;) {
if (a[i] < b[j])
i++;
else if (a[i] > b[j])
j++;
else {
cnt++;
i++;
j++;
}
}
int x = n - cnt;
int y = m - cnt;
if (cnt % 2 == 0) {
if (x > y) {
cout << "YES\n";
} else {
cout << "NO";
}
} else {
if (x >= y) {
cout << "YES\n";
} else {
cout << "NO\n";
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
unordered_map<char, int> m1;
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long i, j, k, t, n, a, b, c, m, sum, f, temp;
string s;
{
sum = 0, f = 0, c = 0;
cin >> n >> m;
set<string> s;
string arr[n], brr[m];
for (i = 0; i < n; i++) cin >> arr[i], s.insert(arr[i]);
for (j = 0; j < m; j++) cin >> brr[j], s.insert(brr[j]);
a = s.size();
b = n + m - a;
if ((n + b % 2) > m)
cout << "YES";
else
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double PI = 2 * acos(0.0);
int n;
bool check(int m) {
int i;
for (i = 1; i < m / 2 + 1; i++) {
if (i * (m - i) >= n) return true;
}
return false;
}
int binser(int lo, int hi) {
int mid, ans = INT_MAX;
while (lo <= hi) {
mid = (hi + lo) / 2;
if (check(mid)) {
ans = min(ans, mid);
hi = mid - 1;
} else
lo = mid + 1;
}
return ans;
}
int main() {
cin >> n;
long long m;
cin >> m;
set<string> s, t;
string st;
long long i;
for (i = 0; i < n; i++) {
cin >> st;
s.insert(st);
}
long long k = 0;
for (i = 0; i < m; i++) {
cin >> st;
if (!s.count(st))
t.insert(st);
else {
s.erase(st);
k++;
}
}
if (s.size() > t.size())
cout << "YES";
else if (s.size() < t.size())
cout << "NO";
else {
if (k % 2)
cout << "YES";
else
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, me;
cin >> n >> me;
map<string, long long> m;
for (long long i = 0; i < n; i++) {
string s;
cin >> s;
m[s] += 1;
}
for (long long i = 0; i < me; i++) {
string s;
cin >> s;
m[s] -= 1;
}
long long count1 = 0, count0 = 0, count2 = 0;
for (auto it = m.begin(); it != m.end(); it++)
if ((*it).second == 1)
count1++;
else if ((*it).second == -1)
count2++;
else
count0++;
if (count0 % 2 == 0) {
if (count1 > count2)
cout << "YES";
else
cout << "NO";
return 0;
} else {
if (count1 + 1 > count2)
cout << "YES";
else
cout << "NO";
return 0;
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.