feat(codeforces): more div3 as

This commit is contained in:
Barrett Ruth 2025-12-13 20:44:14 -06:00
parent 5dac8c409f
commit 20f847575d
40 changed files with 523 additions and 0 deletions

View file

@ -0,0 +1,17 @@
BasedOnStyle: LLVM
IndentWidth: 4
UseTab: Never
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: None
AllowShortBlocksOnASingleLine: Never
AllowShortEnumsOnASingleLine: false
AllowShortCaseExpressionOnASingleLine: false
BreakBeforeBraces: Attach
ColumnLimit: 100
AlignAfterOpenBracket: Align
BinPackArguments: false
BinPackParameters: false

71
codeforces/988/a.cc Normal file
View file

@ -0,0 +1,71 @@
#include <bits/stdc++.h> // {{{
#include <version>
#ifdef __cpp_lib_ranges_enumerate
#include <ranges>
namespace rv = std::views;
namespace rs = std::ranges;
#endif
#pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f64 = double;
using f128 = long double;
#if __cplusplus >= 202002L
template <typename T> constexpr T MIN = std::numeric_limits<T>::min();
template <typename T> constexpr T MAX = std::numeric_limits<T>::max();
#endif
#ifdef LOCAL
#define db(...) std::print(__VA_ARGS__)
#define dbln(...) std::println(__VA_ARGS__)
#else
#define db(...)
#define dbln(...)
#endif
// }}}
vector<u32> f(21);
void solve() {
u32 n;
cin >> n;
f.assign(f.size(), 0);
u32 a;
for (u32 i = 0; i < n; ++i) {
cin >> a;
++f[a];
}
println("{}", accumulate(begin(f), end(f), 0, [](auto acc, auto x) {
return acc + x / 2;
}));
}
int main() { // {{{
std::cin.exceptions(std::cin.failbit);
#ifdef LOCAL
std::cerr.rdbuf(std::cout.rdbuf());
std::cout.setf(std::ios::unitbuf);
std::cerr.setf(std::ios::unitbuf);
#else
std::cin.tie(nullptr)->sync_with_stdio(false);
#endif
u32 tc = 1;
std::cin >> tc;
for (u32 t = 0; t < tc; ++t) {
solve();
}
return 0;
}
// }}}

View file

@ -0,0 +1,11 @@
5
1
1
2
2 2
2
1 2
4
1 2 3 1
6
1 2 3 1 2 3

View file

@ -0,0 +1,5 @@
0
1
0
1
3

View file

@ -0,0 +1,11 @@
5
3
1 1 2
11
3 3 4 5 6 7 8 9 9 10 11
8
8 4 8 3 8 2 8 1
6
2 1 4 5 3 3
8
1 2 6 3 8 5 5 3

View file

@ -0,0 +1,5 @@
1 1
3 3
2 3
4 1
1 6

View file

@ -0,0 +1,3 @@
2
3
8

View file

@ -0,0 +1,2 @@
-1
1 8 7 3 6 2 4 5

View file

@ -0,0 +1,27 @@
4
2 5 50
7 14
30 40
2 2
3 1
3 5
18 2
22 32
4 3 50
4 6
15 18
20 26
34 38
1 2
8 2
10 2
1 4 17
10 14
1 6
1 2
1 2
16 9
1 2 10
5 9
2 3
2 2

View file

@ -0,0 +1,4 @@
4
-1
1
2

View file

@ -0,0 +1,14 @@
2
5
4
0
1
2
2
0

View file

@ -0,0 +1,13 @@
? 1 5
? 2 4
? 4 5
? 3 5
! 01001
? 1 2
! IMPOSSIBLE

View file

@ -0,0 +1,19 @@
6
5 5 3
7 7 7 7 7
1 2 3 4 5
9 5 9
2 4 6 8 10 8 6 4 2
1 2 3 4 5 6 7 8 9
2 10 2
1 1
1 20
2 10 1
69696969 420420420
1 20
2 10 2
10 15
1 19
2 2 2
1000000000 1
1 3

View file

@ -0,0 +1,6 @@
2
2
-1
6969697
15
1000000000

View file

@ -0,0 +1,2 @@
5
2 6 3 4 6

View file

@ -0,0 +1 @@
5

View file

@ -0,0 +1,2 @@
5
4 196 2662 2197 121

View file

@ -0,0 +1 @@
2

View file

@ -0,0 +1,2 @@
7
3 6 8 9 11 12 20

View file

@ -0,0 +1 @@
7

View file

@ -0,0 +1,2 @@
2
2 3

View file

@ -0,0 +1 @@
0