Compare commits
No commits in common. "390ffa1e1c80bf2ed439242ccd866a3c0d7566b8" and "8c9dd821369e1f5ca82269175a9bbc2abfc142ba" have entirely different histories.
390ffa1e1c
...
8c9dd82136
157 changed files with 821 additions and 3720 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -5,4 +5,3 @@
|
||||||
build
|
build
|
||||||
io
|
io
|
||||||
.clangd
|
.clangd
|
||||||
.clang-format
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
# competitive programming
|
|
||||||
|
|
||||||
a collection of my competitive programming solutions categorized as follows:
|
|
||||||
|
|
||||||
- `/kattis`: a few ICPC problems from UVA's "practices"
|
|
||||||
- `/codeforces`: codeforces contests, including every division 4 round
|
|
||||||
- `/cses`: ~100 basic cses problems
|
|
||||||
9
atcoder/042/.clang-format
Normal file
9
atcoder/042/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/1003/.clang-format
Normal file
9
codeforces/1003/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/1006/.clang-format
Normal file
9
codeforces/1006/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/1009/.clang-format
Normal file
9
codeforces/1009/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/1013/.clang-format
Normal file
9
codeforces/1013/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/1016/.clang-format
Normal file
9
codeforces/1016/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/1017/.clang-format
Normal file
9
codeforces/1017/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/1020/.clang-format
Normal file
9
codeforces/1020/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
BasedOnStyle: LLVM
|
BasedOnStyle: LLVM
|
||||||
IndentWidth: 2
|
IndentWidth: 4
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
|
|
||||||
AllowShortIfStatementsOnASingleLine: Never
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
9
codeforces/1029/.clang-format
Normal file
9
codeforces/1029/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/1032/.clang-format
Normal file
9
codeforces/1032/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/1034/.clang-format
Normal file
9
codeforces/1034/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/1037/.clang-format
Normal file
9
codeforces/1037/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -82,4 +82,5 @@ int main() { // {{{
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} // vim: set foldmethod=marker foldmarker={{{{{{,}}}}}}
|
}
|
||||||
|
// }}}
|
||||||
|
|
|
||||||
5
codeforces/1042/.clang-format
Normal file
5
codeforces/1042/.clang-format
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 4
|
||||||
|
ColumnLimit: 100
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
PointerAlignment: Left
|
||||||
9
codeforces/1043/.clang-format
Normal file
9
codeforces/1043/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
5
codeforces/1047/.clang-format
Normal file
5
codeforces/1047/.clang-format
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 4
|
||||||
|
ColumnLimit: 100
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
PointerAlignment: Left
|
||||||
5
codeforces/1059/.clang-format
Normal file
5
codeforces/1059/.clang-format
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 4
|
||||||
|
ColumnLimit: 100
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
PointerAlignment: Left
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
#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 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() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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 >> t;
|
|
||||||
for (u32 t = 0; t < tc; ++t) {
|
|
||||||
solve();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
} // vim: set foldmethod=marker foldmarker={{{,}}}
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
#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 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() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// }}}
|
|
||||||
|
|
||||||
// vim: set foldmethod=marker foldmarker={{{,}}}
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
#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 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() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
} // vim: set foldmethod=marker foldmarker={{{,}}}
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
#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 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() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
} // vim: set foldmethod=marker foldmarker={{{,}}}
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
#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 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;
|
|
||||||
for (u32 i = 1; i <= n; ++i) {
|
|
||||||
print("{}{}", i, " \n"[i==n]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
} // vim: set foldmethod=marker foldmarker={{{,}}}
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
#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 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;
|
|
||||||
u64 x = 0, a;
|
|
||||||
for (u32 i = 1; i <= n; ++i) {
|
|
||||||
cin >> a;
|
|
||||||
x = max(x, a);
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", x * n);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
} // vim: set foldmethod=marker foldmarker={{{,}}}
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
#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 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;
|
|
||||||
vector<i64> a(n);
|
|
||||||
for (auto &e : a)
|
|
||||||
cin >> e;
|
|
||||||
|
|
||||||
sort(begin(a), end(a));
|
|
||||||
a.erase(unique(begin(a), end(a)), end(a));
|
|
||||||
|
|
||||||
u32 ans = 1, streak = 1;
|
|
||||||
|
|
||||||
for (u32 i = 1; i < a.size(); ++i) {
|
|
||||||
if (i > 0 && a[i] - 1 == a[i - 1]) {
|
|
||||||
++streak;
|
|
||||||
} else {
|
|
||||||
ans = max(ans, streak);
|
|
||||||
streak = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ans = max(ans, streak);
|
|
||||||
|
|
||||||
println("{}", ans);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
} // vim: set foldmethod=marker foldmarker={{{,}}}
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
#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 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
|
|
||||||
// }}}
|
|
||||||
|
|
||||||
bitset<2 * 100000 + 1> dirty;
|
|
||||||
void solve() {
|
|
||||||
dirty.reset();
|
|
||||||
u32 n, m;
|
|
||||||
u64 h;
|
|
||||||
cin >> n >> m >> h;
|
|
||||||
vector<pair<u64, u64>> a(n);
|
|
||||||
for (u32 i = 0; i < n; ++i) {
|
|
||||||
cin >> a[i].first;
|
|
||||||
a[i].second = a[i].first;
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 b, c;
|
|
||||||
for (u32 i = 0; i < m; ++i) {
|
|
||||||
cin >> b >> c;
|
|
||||||
--b;
|
|
||||||
if (dirty[b]) {
|
|
||||||
dirty[b] = false;
|
|
||||||
a[b].second = a[b].first;
|
|
||||||
}
|
|
||||||
a[b].second += c;
|
|
||||||
if (a[b].second > h) {
|
|
||||||
dirty.set();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (u32 i = 0; i < n; ++i) {
|
|
||||||
print("{}{}", dirty[i] ? a[i].first : a[i].second, " \n"[i == n - 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;
|
|
||||||
} // vim: set foldmethod=marker foldmarker={{{,}}}
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
#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 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, m, k;
|
|
||||||
string s;
|
|
||||||
|
|
||||||
cin >> n >> m >> k;
|
|
||||||
|
|
||||||
vector<u32> a(n), b(m);
|
|
||||||
|
|
||||||
for (u32 i = 0; i < n; ++i) {
|
|
||||||
cin >> a[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (u32 i = 0; i < m; ++i) {
|
|
||||||
cin >> b[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
cin >> s;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
} // vim: set foldmethod=marker foldmarker={{{,}}}
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
#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 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() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
} // vim: set foldmethod=marker foldmarker={{{,}}}
|
|
||||||
17
codeforces/17/.clang-format
Normal file
17
codeforces/17/.clang-format
Normal 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
|
||||||
4
codeforces/19/.clang-format
Normal file
4
codeforces/19/.clang-format
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
ColumnLimit: 100
|
||||||
|
PointerAlignment: Left
|
||||||
9
codeforces/431/.clang-format
Normal file
9
codeforces/431/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
4
codeforces/479/.clang-format
Normal file
4
codeforces/479/.clang-format
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
ColumnLimit: 100
|
||||||
|
PointerAlignment: Left
|
||||||
17
codeforces/498/.clang-format
Normal file
17
codeforces/498/.clang-format
Normal 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
|
||||||
4
codeforces/506/.clang-format
Normal file
4
codeforces/506/.clang-format
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 4
|
||||||
|
ColumnLimit: 100
|
||||||
|
PointerAlignment: Left
|
||||||
5
codeforces/515/.clang-format
Normal file
5
codeforces/515/.clang-format
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 4
|
||||||
|
ColumnLimit: 100
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
PointerAlignment: Left
|
||||||
4
codeforces/544/.clang-format
Normal file
4
codeforces/544/.clang-format
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
ColumnLimit: 100
|
||||||
|
PointerAlignment: Left
|
||||||
4
codeforces/547/.clang-format
Normal file
4
codeforces/547/.clang-format
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
ColumnLimit: 100
|
||||||
|
PointerAlignment: Left
|
||||||
4
codeforces/550/.clang-format
Normal file
4
codeforces/550/.clang-format
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
ColumnLimit: 100
|
||||||
|
PointerAlignment: Left
|
||||||
4
codeforces/552/.clang-format
Normal file
4
codeforces/552/.clang-format
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
ColumnLimit: 100
|
||||||
|
PointerAlignment: Left
|
||||||
4
codeforces/555/.clang-format
Normal file
4
codeforces/555/.clang-format
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
ColumnLimit: 100
|
||||||
|
PointerAlignment: Left
|
||||||
4
codeforces/560/.clang-format
Normal file
4
codeforces/560/.clang-format
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
ColumnLimit: 100
|
||||||
|
PointerAlignment: Left
|
||||||
17
codeforces/565/.clang-format
Normal file
17
codeforces/565/.clang-format
Normal 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
|
||||||
17
codeforces/570/.clang-format
Normal file
17
codeforces/570/.clang-format
Normal 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
|
||||||
17
codeforces/575/.clang-format
Normal file
17
codeforces/575/.clang-format
Normal 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
|
||||||
4
codeforces/611/.clang-format
Normal file
4
codeforces/611/.clang-format
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
ColumnLimit: 100
|
||||||
|
PointerAlignment: Left
|
||||||
2
codeforces/640/.clang-format
Normal file
2
codeforces/640/.clang-format
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortFunctionsOnASingleLine: Empty
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
#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;
|
|
||||||
vector<u32> a(n);
|
|
||||||
for(auto& e : a) cin >> e;
|
|
||||||
|
|
||||||
u32 ans = 0;
|
|
||||||
|
|
||||||
for (u32 i = 1; i < n; ++i) {
|
|
||||||
u32 A = max(a[i - 1], a[i]);
|
|
||||||
u32 B = min(a[i - 1], a[i]);
|
|
||||||
|
|
||||||
while (B * 2 < A) {
|
|
||||||
++ans;
|
|
||||||
B *= 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", ans);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
#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() {
|
|
||||||
i64 n, m, x;
|
|
||||||
cin >> n >> m >> x;
|
|
||||||
|
|
||||||
i64 row = x % n;
|
|
||||||
if (row == 0)
|
|
||||||
row = n;
|
|
||||||
i64 col = (x + n - 1) / n;
|
|
||||||
|
|
||||||
println("{}", (row - 1) * m + col);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
#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;
|
|
||||||
vector<u32> a(n);
|
|
||||||
map<u32, u32> f;
|
|
||||||
for (auto &e : a) {
|
|
||||||
cin >> e;
|
|
||||||
++f[e];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (u32 i = 0; i < n; ++i) {
|
|
||||||
if (f[a[i]] == 1) {
|
|
||||||
println("{}", i + 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
#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
|
|
||||||
// }}}
|
|
||||||
|
|
||||||
bitset<26> seen;
|
|
||||||
|
|
||||||
void solve() {
|
|
||||||
seen.reset();
|
|
||||||
u32 n;
|
|
||||||
string s;
|
|
||||||
cin >> n >> s;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < n; ++i) {
|
|
||||||
if (seen[s[i]]) {
|
|
||||||
println("NO");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
seen[s[i]] = true;
|
|
||||||
|
|
||||||
while (i + 1 < n && s[i] == s[i + 1]) {
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
println("YES");
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
#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() {
|
|
||||||
i32 n;
|
|
||||||
cin >> n;
|
|
||||||
vector<u32> a(n);
|
|
||||||
for (auto &e : a)
|
|
||||||
cin >> e;
|
|
||||||
|
|
||||||
i32 i = distance(begin(a), max_element(begin(a), end(a)));
|
|
||||||
i32 j = distance(begin(a), min_element(begin(a), end(a)));
|
|
||||||
|
|
||||||
println("{}", min({max(i, j) + 1, n - min(i, j), min(i, j) + 1 + n - max(i, j)}));
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
#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() {
|
|
||||||
i32 x1, y1, x2, y2, x3, y3;
|
|
||||||
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
|
|
||||||
|
|
||||||
i32 ans = abs(y2 - y1) + abs(x2 - x1);
|
|
||||||
if (x1 == x2 && x2 == x3 && min(y1, y2) <= y3 && y3 <= max(y1, y2)) {
|
|
||||||
ans += 2;
|
|
||||||
} else if (y1 == y2 && y2 == y3 && min(x1, x2) <= x3 && x3 <= max(x1, x2)) {
|
|
||||||
ans += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", ans);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
#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;
|
|
||||||
|
|
||||||
array<u32, 3> ans{0, n / 3, n / 3};
|
|
||||||
++ans[n % 3];
|
|
||||||
|
|
||||||
println("{} {}", ans[1], ans[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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
#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 k;
|
|
||||||
cin >> k;
|
|
||||||
|
|
||||||
u32 ans = 1, i = 1;
|
|
||||||
while (i < k) {
|
|
||||||
++ans;
|
|
||||||
if (!(ans % 3 == 0 || ans % 10 == 3)) {
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", ans);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
#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;
|
|
||||||
|
|
||||||
u32 b = 0;
|
|
||||||
for (auto c : s)
|
|
||||||
b += c == 'B';
|
|
||||||
|
|
||||||
if (s.size() % 2 == 0 && b == s.size() / 2) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
#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() {
|
|
||||||
i32 a, b, c;
|
|
||||||
cin >> a >> b >> c;
|
|
||||||
|
|
||||||
println("{} {} {}",
|
|
||||||
max({0, b - a + 1, c - a + 1}),
|
|
||||||
max({0, a - b + 1, c - b + 1}),
|
|
||||||
max({0, b - c + 1, a - c + 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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
#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 a, s;
|
|
||||||
cin >> a >> s;
|
|
||||||
map<char, i32> m;
|
|
||||||
for (u32 i = 0; i < a.size(); ++i) {
|
|
||||||
m[a[i]] = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
i32 ans = 0;
|
|
||||||
for (i32 i = 1; i < s.size(); ++i) {
|
|
||||||
ans += abs(m[s[i]] - m[s[i - 1]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", ans);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
#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.back() - '0') % 2 == 0) {
|
|
||||||
println("0");
|
|
||||||
} else if ((s[0] - '0') % 2 == 0) {
|
|
||||||
println("1");
|
|
||||||
} else {
|
|
||||||
for (auto c : s) {
|
|
||||||
if ((c - '0') % 2 == 0) {
|
|
||||||
println("2");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
println("-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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
#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() {
|
|
||||||
vector<u32> ss(7);
|
|
||||||
for (auto& e : ss) cin >> e;
|
|
||||||
sort(begin(ss), end(ss));
|
|
||||||
|
|
||||||
println("{} {} {}", ss[0], ss[1], ss.back() - (ss[0] + ss[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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/762/.clang-format
Normal file
9
codeforces/762/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
#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;
|
|
||||||
vector<i32> a(n);
|
|
||||||
for (auto &e : a)
|
|
||||||
cin >> e;
|
|
||||||
|
|
||||||
println("{}", *max_element(begin(a), end(a)) - *min_element(begin(a), end(a)));
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
#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() {
|
|
||||||
char c;
|
|
||||||
string s;
|
|
||||||
cin >> s >> c;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < s.size(); ++i) {
|
|
||||||
if (s[i] == c && i % 2 == 0 && (s.size() - i - 1) % 2 == 0) {
|
|
||||||
println("YES");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
#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 a, b;
|
|
||||||
cin >> a >> b;
|
|
||||||
if (b == 0) {
|
|
||||||
println("{}", a + 1);
|
|
||||||
} else if (a == 0) {
|
|
||||||
println("{}", 1);
|
|
||||||
} else {
|
|
||||||
println("{}", 2 * b + a + 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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/784/.clang-format
Normal file
9
codeforces/784/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
#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 x, y;
|
|
||||||
cin >> x >> y;
|
|
||||||
|
|
||||||
if (y % x > 0) {
|
|
||||||
println("0 0");
|
|
||||||
} else {
|
|
||||||
println("1 {}", y / x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
#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 a, b, c, y, x;
|
|
||||||
cin >> a >> b >> c >> x >> y;
|
|
||||||
|
|
||||||
x -= min(x, a);
|
|
||||||
y -= min(y, b);
|
|
||||||
|
|
||||||
if (x > 0) {
|
|
||||||
u32 diff = min(x, c);
|
|
||||||
x -= diff;
|
|
||||||
c -= diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (y > 0) {
|
|
||||||
u32 diff = min(y, c);
|
|
||||||
y -= diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", (x == y && x == 0) ? "YES" : "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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/790/.clang-format
Normal file
9
codeforces/790/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,80 +0,0 @@
|
||||||
#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 a = n / 3, b = n / 3, c = n / 3;
|
|
||||||
|
|
||||||
switch (n % 3) {
|
|
||||||
case 0:
|
|
||||||
++b;
|
|
||||||
--c;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
b += 2;
|
|
||||||
--c;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
++a;
|
|
||||||
b += 2;
|
|
||||||
--c;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{} {} {}", a, b, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/799/.clang-format
Normal file
9
codeforces/799/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
#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 N = n;
|
|
||||||
u32 dcount = 0;
|
|
||||||
while (N > 0) {
|
|
||||||
++dcount;
|
|
||||||
N /= 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 base = 1;
|
|
||||||
for (u32 i = 0; i + 1 < dcount; ++i) {
|
|
||||||
base *= 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", n - base);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/806/.clang-format
Normal file
9
codeforces/806/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
#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() {
|
|
||||||
i32 n, H, M, h, m;
|
|
||||||
cin >> n >> H >> M;
|
|
||||||
|
|
||||||
i32 ans = 24 * 60;
|
|
||||||
|
|
||||||
for (i32 i = 0; i < n; ++i) {
|
|
||||||
cin >> h >> m;
|
|
||||||
i32 diff = h * 60 + m - (H * 60 + M);
|
|
||||||
if (diff < 0) {
|
|
||||||
diff += 24 * 60;
|
|
||||||
}
|
|
||||||
ans = min(ans, diff);
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{} {}", ans / 60, ans % 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/817/.clang-format
Normal file
9
codeforces/817/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
#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() {
|
|
||||||
i32 a, b, c;
|
|
||||||
cin >> a >> b >> c;
|
|
||||||
|
|
||||||
i32 A = a - 1;
|
|
||||||
i32 B = abs(c - b) + c - 1;
|
|
||||||
|
|
||||||
if (A == B) {
|
|
||||||
println("3");
|
|
||||||
} else {
|
|
||||||
println("{}", A < B ? 1 : 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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/827/.clang-format
Normal file
9
codeforces/827/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
#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
|
|
||||||
// }}}
|
|
||||||
|
|
||||||
string Yes = "Yes";
|
|
||||||
|
|
||||||
void solve() {
|
|
||||||
string s;
|
|
||||||
cin >> s;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < s.size(); ++i) {
|
|
||||||
auto c = s[i];
|
|
||||||
if (Yes.find(c) == string::npos ||
|
|
||||||
i + 1 < s.size() && !(c == 'Y' && s[i + 1] == 'e' || c == 'e' && s[i + 1] == 's' ||
|
|
||||||
c == 's' && s[i + 1] == 'Y')) {
|
|
||||||
println("NO");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
println("YES");
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/835/.clang-format
Normal file
9
codeforces/835/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
#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;
|
|
||||||
|
|
||||||
println("{}", s[0] - '0' + s[2] - '0');
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
#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
|
|
||||||
// }}}
|
|
||||||
|
|
||||||
string PI = "3141592653589793238462643383279";
|
|
||||||
|
|
||||||
void solve() {
|
|
||||||
string s;
|
|
||||||
cin >> s;
|
|
||||||
|
|
||||||
u32 i = 0;
|
|
||||||
while (i < PI.size() && s[i] == PI[i]) {
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", i);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/849/.clang-format
Normal file
9
codeforces/849/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
#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;
|
|
||||||
string s;
|
|
||||||
cin >> n >> s;
|
|
||||||
|
|
||||||
// NOTE: cannot due `for (auto c : "meow")` <- c-style string, includes null-terminator
|
|
||||||
string S{"meow"};
|
|
||||||
|
|
||||||
u32 i = 0;
|
|
||||||
for (auto c : S) {
|
|
||||||
u32 j = i;
|
|
||||||
while (j < n && tolower(s[j]) == c) {
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
if (i == j) {
|
|
||||||
i = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
i = j;
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", i == n ? "YES" : "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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/859/.clang-format
Normal file
9
codeforces/859/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
#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;
|
|
||||||
char d;
|
|
||||||
string s;
|
|
||||||
cin >> n >> d >> s;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < n; ++i) {
|
|
||||||
if (d > s[i] || d == s[i] && i + 1 < n && d > s[i + 1]) {
|
|
||||||
println("{}{}{}", s.substr(0, i), d, s.substr(i));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}{}", s, d);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
#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, t;
|
|
||||||
cin >> n >> t;
|
|
||||||
array ans{-1, -1};
|
|
||||||
vector<u32> a(n), b(n);
|
|
||||||
for (u32 i = 0; i < n; ++i) {
|
|
||||||
cin >> a[i];
|
|
||||||
}
|
|
||||||
for (u32 i = 0; i < n; ++i) {
|
|
||||||
cin >> b[i];
|
|
||||||
}
|
|
||||||
for (u32 i = 1; i <= n; ++i) {
|
|
||||||
if (i - 1 + a[i - 1] <= t) {
|
|
||||||
ans = max(ans, {b[i - 1], i});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
println("{}", ans[1] == -1 ? -1 : 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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/871/.clang-format
Normal file
9
codeforces/871/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/874/.clang-format
Normal file
9
codeforces/874/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
#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;
|
|
||||||
string s;
|
|
||||||
cin >> n >> s;
|
|
||||||
|
|
||||||
u32 i = 0;
|
|
||||||
string ans;
|
|
||||||
for (u32 j = 1; j < n; ++j) {
|
|
||||||
if (s[j] == s[i]) {
|
|
||||||
ans.push_back(s[i]);
|
|
||||||
i = j + 1;
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", ans);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
#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;
|
|
||||||
vector<u32> a(n);
|
|
||||||
for (auto& e : a) cin >> e;
|
|
||||||
|
|
||||||
sort(begin(a), end(a));
|
|
||||||
|
|
||||||
u32 ans = 0;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < n / 2; ++i) {
|
|
||||||
ans += a[n - i - 1] - a[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", ans);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
9
codeforces/886/.clang-format
Normal file
9
codeforces/886/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/888/.clang-format
Normal file
9
codeforces/888/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/891/.clang-format
Normal file
9
codeforces/891/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/894/.clang-format
Normal file
9
codeforces/894/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/895/.clang-format
Normal file
9
codeforces/895/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/898/.clang-format
Normal file
9
codeforces/898/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/900/.clang-format
Normal file
9
codeforces/900/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
9
codeforces/903/.clang-format
Normal file
9
codeforces/903/.clang-format
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
#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
|
|
||||||
// }}}
|
|
||||||
|
|
||||||
string keys = "1234567890";
|
|
||||||
vector<i32> m(10);
|
|
||||||
|
|
||||||
void solve() {
|
|
||||||
string s;
|
|
||||||
cin >> s;
|
|
||||||
|
|
||||||
u32 ans = 4;
|
|
||||||
|
|
||||||
char last = '1';
|
|
||||||
for (auto c : s) {
|
|
||||||
ans += abs(m[c - '0'] - m[last - '0']);
|
|
||||||
last = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
println("{}", ans);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 (i32 i = 0; i < keys.size(); ++i) {
|
|
||||||
m[keys[i] - '0'] = i;
|
|
||||||
}
|
|
||||||
for (u32 t = 0; t < tc; ++t) {
|
|
||||||
solve();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
#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;
|
|
||||||
if (n % 3 == 1 || n % 3 == 2) {
|
|
||||||
println("First");
|
|
||||||
} else {
|
|
||||||
println("Second");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue