initial commit

This commit is contained in:
Barrett Ruth 2025-01-07 00:54:22 -06:00
commit 7aacde99f4
12 changed files with 296 additions and 0 deletions

48
usaco/blocks.cc Normal file
View file

@ -0,0 +1,48 @@
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define sz(x) static_cast<int>((x).size())
#define FOR(x) for (size_t i = 0; i < (x).size(); ++i)
#ifndef LOCAL
#define dbg(x) cerr << #x << " = " << (x) << '\n'
#else
#define dbg(x)
#endif
#define PROBLEM_NAME "blocks"
void solve() {
int N;
cin >> N;
vector<int> ans(26, 0);
for(int i = 0; i < N; ++i) {
string left, right;
cin >> left >> right;
vector<int> count_left(26, 0);
for(char c : left) count_left[c - 'a']++;
vector<int> count_right(26, 0);
for(char c : right) count_right[c - 'a']++;
for(int j = 0; j < 26; ++j) {
ans[j] += max(count_left[j], count_right[j]);
}
}
for(int count : ans) {
cout << count << '\n';
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
freopen(PROBLEM_NAME ".in", "r", stdin);
freopen(PROBLEM_NAME ".out", "w", stdout);
solve();
return 0;
}

4
usaco/blocks.in Normal file
View file

@ -0,0 +1,4 @@
3
fox box
dog cat
car bus

26
usaco/blocks.out Normal file
View file

@ -0,0 +1,26 @@
2
2
2
1
0
1
1
0
0
0
0
0
0
0
2
0
0
1
1
1
1
0
0
1
0
0