Skip to content

Commit f6e832f

Browse files
authored
Merge pull request #412 from xirc/atcoder/abc091
AtCoder/ABC091
2 parents 86a155c + 8bba1fb commit f6e832f

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

atcoder/abc091/A/main.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
int main() {
8+
ios_base::sync_with_stdio(false);
9+
cin.tie(0); cout.tie(0);
10+
11+
int A, B, C;
12+
cin >> A >> B >> C;
13+
auto ans = (A + B >= C) ? "Yes" : "No";
14+
cout << ans << endl;
15+
16+
return 0;
17+
}

atcoder/abc091/B/main.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
int main() {
8+
ios_base::sync_with_stdio(false);
9+
cin.tie(0); cout.tie(0);
10+
11+
int N, M;
12+
string s;
13+
14+
map<string,int> netp;
15+
16+
cin >> N;
17+
for (int i = 0; i < N; ++i) {
18+
cin >> s;
19+
netp[s]++;
20+
}
21+
cin >> M;
22+
for (int i = 0; i < M; ++i) {
23+
cin >> s;
24+
netp[s]--;
25+
}
26+
27+
int maxp = 0;
28+
for (auto const& e : netp) {
29+
maxp = max(maxp, e.second);
30+
}
31+
cout << maxp << endl;
32+
33+
return 0;
34+
}

atcoder/abc091/C/main.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
int N;
8+
vector<pair<int,int>> rs, bs;
9+
10+
int solve() {
11+
// x asc, y asc
12+
sort(bs.begin(), bs.end());
13+
// y desc x desc
14+
sort(rs.begin(), rs.end(), [](auto const& lhs, auto const& rhs) {
15+
if (lhs.second != rhs.second) return lhs.second > rhs.second;
16+
return lhs.first > rhs.first;
17+
});
18+
19+
int count = 0;
20+
vector<bool> used(N, false);
21+
for (int i = 0; i < N; ++i) {
22+
for (int j = 0; j < N; ++j) {
23+
if (used[j]) continue;
24+
if (bs[i].first <= rs[j].first) continue;
25+
if (bs[i].second <= rs[j].second) continue;
26+
used[j] = true;
27+
++count;
28+
break;
29+
}
30+
}
31+
return count;
32+
}
33+
34+
int main() {
35+
ios_base::sync_with_stdio(false);
36+
cin.tie(0); cout.tie(0);
37+
38+
cin >> N;
39+
rs.assign(N, { 0, 0 });
40+
bs.assign(N, { 0, 0 });
41+
for (int i = 0; i < N; ++i) {
42+
cin >> rs[i].first >> rs[i].second;
43+
}
44+
for (int i = 0; i < N; ++i) {
45+
cin >> bs[i].first >> bs[i].second;
46+
}
47+
cout << solve() << endl;
48+
49+
return 0;
50+
}

0 commit comments

Comments
 (0)