feat(codeforces): more div. 3 as

This commit is contained in:
Barrett Ruth 2025-12-02 23:51:33 -05:00
parent c565027c13
commit cdf73b9909
136 changed files with 1155 additions and 1 deletions

View file

@ -0,0 +1,5 @@
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 100
BreakBeforeBraces: Allman
PointerAlignment: Left

70
codeforces/1042/2131a.cc Normal file
View file

@ -0,0 +1,70 @@
#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() {
u32 n;
cin >> n;
u32 ans = 0;
vector<i32> a(n), b(n);
for (auto& e : a) cin >> e;
for (auto& e : b) cin >> e;
for (u32 i = 0; i < n; ++i) {
ans += max(0, a[i] - b[i]);
}
println("{}", ans + 1);
}
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,13 @@
4
2
7 3
5 6
3
3 1 4
3 1 4
1
10
1
6
1 1 4 5 1 4
1 9 1 9 8 1

View file

@ -0,0 +1,4 @@
3
1
10
7

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,10 @@
3
2
11
00
2
01
01
4
1010
1101

View file

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

View file

@ -0,0 +1,9 @@
4
2 3
1 3
3 6
5 1 4
2 100
2 100
5 15
1 2 3 4 5

View file

@ -0,0 +1,4 @@
3
24
118143737
576

View file

@ -0,0 +1,11 @@
5
4 15
4 7 9 15
4 10
1 2 4 8
5 15
6 10 11 12 15
5 15
6 10 11 14 15
6 10000
30 238 627 1001 1495 7429

View file

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