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

68
codeforces/966/a.cc Normal file
View file

@ -0,0 +1,68 @@
#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
// }}}
void solve() {
string s;
cin >> s;
if (s.size() >= 3 && s.substr(0, 2) == "10" && stoi(s.substr(2, s.size())) >= 2 && s[2] != '0') {
println("YES");
} else {
println("NO");
}
}
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,8 @@
7
100
1010
101
105
2033
1019
1002

View file

@ -0,0 +1,7 @@
NO
YES
NO
YES
NO
YES
NO

View file

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

View file

@ -0,0 +1,4 @@
NO
YES
YES
NO

View file

@ -0,0 +1,19 @@
3
5
3 5 2 1 3
2
abfda
afbfa
2
1 2
3
ab
abc
aa
4
5 -3 5 -3
4
aaaa
bcbc
aba
cbcb

View file

@ -0,0 +1,9 @@
YES
NO
YES
NO
NO
NO
YES
NO
YES

View file

@ -0,0 +1,13 @@
4
6
3 5 1 4 3 2
LRLLLR
2
2 8
LR
2
3 9
RL
5
1 2 3 4 5
LRLRR

View file

@ -0,0 +1,4 @@
18
10
0
22

View file

@ -0,0 +1,16 @@
5
3 4 2
9
1 1 1 1 1 1 1 1 1
2 1 1
2
5 7
20 15 7
9
4 1 4 5 6 1 1000000000 898 777
1984 1 1
4
5 4 1499 2004
9 5 5
6
6 7 14 16 16 6

View file

@ -0,0 +1,5 @@
21
12
49000083104
3512
319

View file

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

View file

@ -0,0 +1,7 @@
12
14
5
-1
17
80
35

View file

@ -0,0 +1,36 @@
7
5 5
100 20 80
1 5 30 100
1 2 20 50
2 3 20 50
3 4 20 50
4 5 20 50
2 1
100 50 60
1 2 55 110
4 4
100 40 60
1 2 30 100
2 4 30 100
1 3 20 50
3 4 20 50
3 3
100 80 90
1 2 1 10
2 3 10 50
1 3 20 21
3 2
58 55 57
2 1 1 3
2 3 3 4
2 1
12 9 10
2 1 6 10
5 5
8 5 6
2 1 1 8
2 3 4 8
4 2 2 4
5 3 3 4
4 5 2 6

View file

@ -0,0 +1,7 @@
0
-1
60
80
53
3
2

View file

@ -0,0 +1,44 @@
3
5
1 2 5 905 2000000
15
- 2
? 2
? 1
- 1
? 1
+ 4
+ 2
? 2
+ 6
- 4
+ 7
? 2
? 3
? 4
? 2000000
5
3 4 5 6 8
9
? 5
- 5
? 5
+ 1
? 2
- 6
- 8
+ 6
? 5
5
6 7 8 9 10
10
? 5
- 6
? 4
- 10
+ 5
- 8
+ 3
+ 2
- 3
+ 10

View file

@ -0,0 +1,3 @@
2 2 1 6 3 8 8 2000001
9 9 9 7
1 1

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