feat(cf/895): nonlazy prop soln
This commit is contained in:
parent
6c16185126
commit
94383fbaf7
99 changed files with 4536 additions and 0 deletions
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
|
||||
8
codeforces/886/.clangd
Normal file
8
codeforces/886/.clangd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
CompileFlags:
|
||||
Add:
|
||||
- -Wall
|
||||
- -Wextra
|
||||
- -Wpedantic
|
||||
- -Wshadow
|
||||
- -DLOCAL
|
||||
- -Wno-unknown-pragmas
|
||||
84
codeforces/886/a.cc
Normal file
84
codeforces/886/a.cc
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
#include <bits/stdc++.h> // {{{
|
||||
|
||||
// https://codeforces.com/blog/entry/96344
|
||||
|
||||
#pragma GCC optimize("O2,unroll-loops")
|
||||
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <typename T> [[nodiscard]] static T MIN() {
|
||||
return std::numeric_limits<T>::min();
|
||||
}
|
||||
|
||||
template <typename T> [[nodiscard]] static T MAX() {
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
template <typename T> [[nodiscard]] static T sc(auto &&x) {
|
||||
return static_cast<T>(x);
|
||||
}
|
||||
|
||||
template <typename T> [[nodiscard]] static T sz(auto &&x) {
|
||||
return static_cast<T>(x.size());
|
||||
}
|
||||
|
||||
#define prln(...) std::println(__VA_ARGS__)
|
||||
#define pr(...) std::print(__VA_ARGS__)
|
||||
|
||||
#ifdef LOCAL
|
||||
#define dbgln(...) std::println(__VA_ARGS__)
|
||||
#define dbg(...) std::print(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
inline static void NO() { prln("NO"); }
|
||||
|
||||
inline static void YES() { prln("YES"); }
|
||||
|
||||
using ll = long long;
|
||||
using ld = long double;
|
||||
template <typename T> using ve = std::vector<T>;
|
||||
template <typename T, size_t N> using ar = std::array<T, N>;
|
||||
template <typename T1, typename T2> using pa = std::pair<T1, T2>;
|
||||
template <typename... Ts> using tu = std::tuple<Ts...>;
|
||||
template <typename... Ts> using dq = std::deque<Ts...>;
|
||||
template <typename... Ts> using qu = std::queue<Ts...>;
|
||||
template <typename... Ts> using pq = std::priority_queue<Ts...>;
|
||||
template <typename... Ts> using st = std::stack<Ts...>;
|
||||
auto lb = [](auto... args) { return std::lower_bound(args...); };
|
||||
auto ub = [](auto... args) { return std::upper_bound(args...); };
|
||||
|
||||
#define ff first
|
||||
#define ss second
|
||||
#define eb emplace_back
|
||||
#define pb push_back
|
||||
#define all(x) (x).begin(), (x).end()
|
||||
#define rall(x) (x).rbegin(), (x).rend()
|
||||
// }}}
|
||||
|
||||
// start 16:03
|
||||
void solve() {
|
||||
ve<int> a(3);
|
||||
for (auto &e : a)
|
||||
cin >> e;
|
||||
sort(all(a));
|
||||
if (a[1] + a[2] >= 10)
|
||||
YES();
|
||||
else
|
||||
NO();
|
||||
}
|
||||
|
||||
int main() { // {{{
|
||||
cin.tie(nullptr)->sync_with_stdio(false);
|
||||
cin.exceptions(cin.failbit);
|
||||
|
||||
int t = 1;
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
solve();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
// }}}
|
||||
6
codeforces/886/a.in
Normal file
6
codeforces/886/a.in
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
5
|
||||
8 1 2
|
||||
4 4 5
|
||||
9 9 9
|
||||
0 0 0
|
||||
8 5 3
|
||||
116
codeforces/886/b.cc
Normal file
116
codeforces/886/b.cc
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
#include <bits/stdc++.h> // {{{
|
||||
|
||||
// https://codeforces.com/blog/entry/96344
|
||||
|
||||
#pragma GCC optimize("O2,unroll-loops")
|
||||
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MIN() {
|
||||
return std::numeric_limits<T>::min();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MAX() {
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sc(auto&& x) {
|
||||
return static_cast<T>(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sz(auto&& x) {
|
||||
return static_cast<T>(x.size());
|
||||
}
|
||||
|
||||
#define prln(...) std::println(__VA_ARGS__)
|
||||
#define pr(...) std::print(__VA_ARGS__)
|
||||
|
||||
#ifdef LOCAL
|
||||
#define dbgln(...) std::println(__VA_ARGS__)
|
||||
#define dbg(...) std::print(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
inline static void NO() {
|
||||
prln("NO");
|
||||
}
|
||||
|
||||
inline static void YES() {
|
||||
prln("YES");
|
||||
}
|
||||
|
||||
using ll = long long;
|
||||
using ld = long double;
|
||||
template <typename T>
|
||||
using ve = std::vector<T>;
|
||||
template <typename T, size_t N>
|
||||
using ar = std::array<T, N>;
|
||||
template <typename T1, typename T2>
|
||||
using pa = std::pair<T1, T2>;
|
||||
template <typename... Ts>
|
||||
using tu = std::tuple<Ts...>;
|
||||
template <typename... Ts>
|
||||
using dq = std::deque<Ts...>;
|
||||
template <typename... Ts>
|
||||
using qu = std::queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using pq = std::priority_queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using st = std::stack<Ts...>;
|
||||
auto lb = [](auto... args) {
|
||||
return std::lower_bound(args...);
|
||||
};
|
||||
auto ub = [](auto... args) {
|
||||
return std::upper_bound(args...);
|
||||
};
|
||||
|
||||
#define ff first
|
||||
#define ss second
|
||||
#define eb emplace_back
|
||||
#define pb push_back
|
||||
#define all(x) (x).begin(), (x).end()
|
||||
#define rall(x) (x).rbegin(), (x).rend()
|
||||
// }}}
|
||||
|
||||
void solve() {
|
||||
int n;
|
||||
cin >> n;
|
||||
ve<pa<int, int>> responses(n);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
cin >> responses[i].ff >> responses[i].ss;
|
||||
}
|
||||
|
||||
// didn't read problem
|
||||
|
||||
int best = MIN<int>();
|
||||
int ans;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (responses[i].ff <= 10) {
|
||||
if (responses[i].ss > best) {
|
||||
best = responses[i].ss;
|
||||
ans = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prln("{}", ans + 1);
|
||||
}
|
||||
|
||||
int main() { // {{{
|
||||
cin.tie(nullptr)->sync_with_stdio(false);
|
||||
cin.exceptions(cin.failbit);
|
||||
|
||||
int t = 1;
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
solve();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
// }}}
|
||||
13
codeforces/886/b.in
Normal file
13
codeforces/886/b.in
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
3
|
||||
5
|
||||
7 2
|
||||
12 5
|
||||
9 3
|
||||
9 4
|
||||
10 1
|
||||
3
|
||||
1 2
|
||||
3 4
|
||||
5 6
|
||||
1
|
||||
1 43
|
||||
6
codeforces/886/b.out
Normal file
6
codeforces/886/b.out
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
4
|
||||
3
|
||||
1
|
||||
|
||||
[code]: 0
|
||||
[time]: 6.05655 ms
|
||||
120
codeforces/886/c.cc
Normal file
120
codeforces/886/c.cc
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
#include <bits/stdc++.h> // {{{
|
||||
|
||||
// https://codeforces.com/blog/entry/96344
|
||||
|
||||
#pragma GCC optimize("O2,unroll-loops")
|
||||
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MIN() {
|
||||
return std::numeric_limits<T>::min();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MAX() {
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sc(auto&& x) {
|
||||
return static_cast<T>(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sz(auto&& x) {
|
||||
return static_cast<T>(x.size());
|
||||
}
|
||||
|
||||
#define prln(...) std::println(__VA_ARGS__)
|
||||
#define pr(...) std::print(__VA_ARGS__)
|
||||
|
||||
#ifdef LOCAL
|
||||
#define dbgln(...) std::println(__VA_ARGS__)
|
||||
#define dbg(...) std::print(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
inline static void NO() {
|
||||
prln("NO");
|
||||
}
|
||||
|
||||
inline static void YES() {
|
||||
prln("YES");
|
||||
}
|
||||
|
||||
using ll = long long;
|
||||
using ld = long double;
|
||||
template <typename T>
|
||||
using ve = std::vector<T>;
|
||||
template <typename T, size_t N>
|
||||
using ar = std::array<T, N>;
|
||||
template <typename T1, typename T2>
|
||||
using pa = std::pair<T1, T2>;
|
||||
template <typename... Ts>
|
||||
using tu = std::tuple<Ts...>;
|
||||
template <typename... Ts>
|
||||
using dq = std::deque<Ts...>;
|
||||
template <typename... Ts>
|
||||
using qu = std::queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using pq = std::priority_queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using st = std::stack<Ts...>;
|
||||
auto lb = [](auto... args) {
|
||||
return std::lower_bound(args...);
|
||||
};
|
||||
auto ub = [](auto... args) {
|
||||
return std::upper_bound(args...);
|
||||
};
|
||||
|
||||
#define ff first
|
||||
#define ss second
|
||||
#define eb emplace_back
|
||||
#define pb push_back
|
||||
#define all(x) (x).begin(), (x).end()
|
||||
#define rall(x) (x).rbegin(), (x).rend()
|
||||
// }}}
|
||||
|
||||
void solve() {
|
||||
// was a bit uncertain - didn't notice that you can literally just do this
|
||||
// (the second solution was my actual first one)
|
||||
|
||||
char c;
|
||||
for (int i = 0; i < 8 * 8; ++i) {
|
||||
cin >> c;
|
||||
if (c != '.')
|
||||
pr("{}", c);
|
||||
}
|
||||
prln();
|
||||
// ve<string> grid(8);
|
||||
// for (int i = 0; i < 8; ++i) {
|
||||
// cin >> grid[i];
|
||||
// }
|
||||
//
|
||||
//
|
||||
// string ans;
|
||||
// for (int r = 0; r < 8; ++r) {
|
||||
// for (int c = 0; c < 8; ++c) {
|
||||
// if (grid[r][c] != '.') {
|
||||
// ans.pb(grid[r][c]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// prln("{}", ans);
|
||||
}
|
||||
|
||||
int main() { // {{{
|
||||
cin.tie(nullptr)->sync_with_stdio(false);
|
||||
cin.exceptions(cin.failbit);
|
||||
|
||||
int t = 1;
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
solve();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
// }}}
|
||||
41
codeforces/886/c.in
Normal file
41
codeforces/886/c.in
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
5
|
||||
........
|
||||
........
|
||||
........
|
||||
........
|
||||
...i....
|
||||
........
|
||||
........
|
||||
........
|
||||
........
|
||||
.l......
|
||||
.o......
|
||||
.s......
|
||||
.t......
|
||||
........
|
||||
........
|
||||
........
|
||||
........
|
||||
........
|
||||
........
|
||||
........
|
||||
......t.
|
||||
......h.
|
||||
......e.
|
||||
........
|
||||
........
|
||||
........
|
||||
........
|
||||
........
|
||||
.......g
|
||||
.......a
|
||||
.......m
|
||||
.......e
|
||||
a.......
|
||||
a.......
|
||||
a.......
|
||||
a.......
|
||||
a.......
|
||||
a.......
|
||||
a.......
|
||||
a.......
|
||||
8
codeforces/886/c.out
Normal file
8
codeforces/886/c.out
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
i
|
||||
lost
|
||||
the
|
||||
game
|
||||
aaaaaaaa
|
||||
|
||||
[code]: 0
|
||||
[time]: 13.4587 ms
|
||||
6
codeforces/886/compile_flags.txt
Normal file
6
codeforces/886/compile_flags.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
-Wall
|
||||
-Wextra
|
||||
-Wpedantic
|
||||
-Wshadow
|
||||
-DLOCAL
|
||||
-std=c++23
|
||||
124
codeforces/886/d.cc
Normal file
124
codeforces/886/d.cc
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
#include <bits/stdc++.h> // {{{
|
||||
|
||||
// https://codeforces.com/blog/entry/96344
|
||||
|
||||
#pragma GCC optimize("O2,unroll-loops")
|
||||
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MIN() {
|
||||
return std::numeric_limits<T>::min();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MAX() {
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sc(auto&& x) {
|
||||
return static_cast<T>(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sz(auto&& x) {
|
||||
return static_cast<T>(x.size());
|
||||
}
|
||||
|
||||
#define prln(...) std::println(__VA_ARGS__)
|
||||
#define pr(...) std::print(__VA_ARGS__)
|
||||
|
||||
#ifdef LOCAL
|
||||
#define dbgln(...) std::println(__VA_ARGS__)
|
||||
#define dbg(...) std::print(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
inline static void NO() {
|
||||
prln("NO");
|
||||
}
|
||||
|
||||
inline static void YES() {
|
||||
prln("YES");
|
||||
}
|
||||
|
||||
using ll = long long;
|
||||
using ld = long double;
|
||||
template <typename T>
|
||||
using ve = std::vector<T>;
|
||||
template <typename T, size_t N>
|
||||
using ar = std::array<T, N>;
|
||||
template <typename T1, typename T2>
|
||||
using pa = std::pair<T1, T2>;
|
||||
template <typename... Ts>
|
||||
using tu = std::tuple<Ts...>;
|
||||
template <typename... Ts>
|
||||
using dq = std::deque<Ts...>;
|
||||
template <typename... Ts>
|
||||
using qu = std::queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using pq = std::priority_queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using st = std::stack<Ts...>;
|
||||
auto lb = [](auto... args) {
|
||||
return std::lower_bound(args...);
|
||||
};
|
||||
auto ub = [](auto... args) {
|
||||
return std::upper_bound(args...);
|
||||
};
|
||||
|
||||
#define ff first
|
||||
#define ss second
|
||||
#define eb emplace_back
|
||||
#define pb push_back
|
||||
#define all(x) (x).begin(), (x).end()
|
||||
#define rall(x) (x).rbegin(), (x).rend()
|
||||
// }}}
|
||||
|
||||
void solve() {
|
||||
int n, k;
|
||||
cin >> n >> k;
|
||||
|
||||
ve<ll> d(n);
|
||||
for (auto& e : d)
|
||||
cin >> e;
|
||||
|
||||
int keep = 0;
|
||||
|
||||
sort(all(d));
|
||||
|
||||
// too long, still don't know HOW, but invariants/problem i'd done before
|
||||
// definitely help
|
||||
// walking thru/specific logic help
|
||||
// kept fucking around and not answering the problem
|
||||
// common thing: "let's read in input before we think about it"
|
||||
// NO - think then code, that's just procrastinating the problem
|
||||
|
||||
int start = 0;
|
||||
for (int i = 1; i < n; ++i) {
|
||||
if (d[i] - d[i - 1] > k) {
|
||||
keep = max(keep, i - start);
|
||||
start = i;
|
||||
}
|
||||
}
|
||||
|
||||
keep = max(keep, n - start);
|
||||
|
||||
prln("{}", n - keep);
|
||||
}
|
||||
|
||||
int main() { // {{{
|
||||
cin.tie(nullptr)->sync_with_stdio(false);
|
||||
cin.exceptions(cin.failbit);
|
||||
|
||||
int t = 1;
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
solve();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
// }}}
|
||||
15
codeforces/886/d.in
Normal file
15
codeforces/886/d.in
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
7
|
||||
5 1
|
||||
1 2 4 5 6
|
||||
1 2
|
||||
10
|
||||
8 3
|
||||
17 3 1 20 12 5 17 12
|
||||
4 2
|
||||
2 4 6 8
|
||||
5 3
|
||||
2 3 19 10 8
|
||||
3 4
|
||||
1 10 5
|
||||
8 1
|
||||
8 3 1 4 5 10 7 3
|
||||
10
codeforces/886/d.out
Normal file
10
codeforces/886/d.out
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
2
|
||||
0
|
||||
5
|
||||
0
|
||||
3
|
||||
1
|
||||
4
|
||||
|
||||
[code]: 0
|
||||
[time]: 6.87933 ms
|
||||
150
codeforces/886/e.cc
Normal file
150
codeforces/886/e.cc
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
#include <bits/stdc++.h> // {{{
|
||||
|
||||
// https://codeforces.com/blog/entry/96344
|
||||
|
||||
#pragma GCC optimize("O2,unroll-loops")
|
||||
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MIN() {
|
||||
return std::numeric_limits<T>::min();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MAX() {
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sc(auto&& x) {
|
||||
return static_cast<T>(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sz(auto&& x) {
|
||||
return static_cast<T>(x.size());
|
||||
}
|
||||
|
||||
#define prln(...) std::println(__VA_ARGS__)
|
||||
#define pr(...) std::print(__VA_ARGS__)
|
||||
|
||||
#ifdef LOCAL
|
||||
#define dbgln(...) std::println(__VA_ARGS__)
|
||||
#define dbg(...) std::print(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
inline static void NO() {
|
||||
prln("NO");
|
||||
}
|
||||
|
||||
inline static void YES() {
|
||||
prln("YES");
|
||||
}
|
||||
|
||||
using ll = long long;
|
||||
using ld = long double;
|
||||
template <typename T>
|
||||
using ve = std::vector<T>;
|
||||
template <typename T, size_t N>
|
||||
using ar = std::array<T, N>;
|
||||
template <typename T1, typename T2>
|
||||
using pa = std::pair<T1, T2>;
|
||||
template <typename... Ts>
|
||||
using tu = std::tuple<Ts...>;
|
||||
template <typename... Ts>
|
||||
using dq = std::deque<Ts...>;
|
||||
template <typename... Ts>
|
||||
using qu = std::queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using pq = std::priority_queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using st = std::stack<Ts...>;
|
||||
auto lb = [](auto... args) {
|
||||
return std::lower_bound(args...);
|
||||
};
|
||||
auto ub = [](auto... args) {
|
||||
return std::upper_bound(args...);
|
||||
};
|
||||
|
||||
#define ff first
|
||||
#define ss second
|
||||
#define eb emplace_back
|
||||
#define pb push_back
|
||||
#define all(x) (x).begin(), (x).end()
|
||||
#define rall(x) (x).rbegin(), (x).rend()
|
||||
// }}}
|
||||
|
||||
void solve() {
|
||||
ll n, c;
|
||||
cin >> n >> c;
|
||||
ll sum = 0, sumsq = 0;
|
||||
ll s;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
cin >> s;
|
||||
sum += s;
|
||||
sumsq += s * s;
|
||||
}
|
||||
|
||||
ld C = sumsq - c;
|
||||
|
||||
ld A = 4 * n;
|
||||
// NOTE: tbh, look back at solutions,m not sure what went exactly wrong here.
|
||||
// most definitely just not taking my time
|
||||
// NOTE: didn't check WHY round down/why is this right, just that it *looked* right in the examples
|
||||
// this logic is a surefire way to skip certainty and absolutely confuse yourself
|
||||
|
||||
ld B = 4 * sum;
|
||||
|
||||
ll root = (-B + sqrtl(B * B - 4 * A * C)) / (2 * A);
|
||||
prln("{}", root);
|
||||
|
||||
// NOTE: tbh, look back at solutions,m not sure what went exactly wrong here.
|
||||
// most definitely just not taking my time
|
||||
// NOTE: didn't check WHY round down/why is this right, just that it *looked* right in the examples
|
||||
// this logic is a surefire way to skip certainty and absolutely confuse yourself
|
||||
|
||||
/*
|
||||
p ez, if anything should've just been locked and written the equation
|
||||
division and long double - fucked
|
||||
|
||||
say paintings are a, b, c
|
||||
|
||||
ax^2+bx+c
|
||||
|
||||
area c= (a + 2w) ^ 2 + ...
|
||||
=a^2+4w^2+4aw + ...
|
||||
|
||||
c = a^2+b^2+...+4(a+b+...) * w + 4nw^2
|
||||
0 = sumsq - c
|
||||
|
||||
|
||||
a^2+b^2+c^2=sum of painting area
|
||||
(a+2w)^2+(b+2w)^2+...= c; find w quickly
|
||||
|
||||
a^2+2aw+4w^2+...
|
||||
|
||||
c = = a^2 + 4w^2+2aw + ...
|
||||
=a^2+b^2+c^2 + ... 2aw + 2bw + 2cw + ... + 4nw^2
|
||||
0 = sumsq + 4nw^2 + 2w(a+b+c+d+....) - c
|
||||
quadratic formula
|
||||
= 4nw^2+2w(a+b+c+d)
|
||||
= 4nw^2+2w(a+b+...) - c +a^2+b^2+c^2+...
|
||||
*/
|
||||
}
|
||||
|
||||
int main() { // {{{
|
||||
cin.tie(nullptr)->sync_with_stdio(false);
|
||||
cin.exceptions(cin.failbit);
|
||||
|
||||
int t = 1;
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
solve();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
// }}}
|
||||
21
codeforces/886/e.in
Normal file
21
codeforces/886/e.in
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
10
|
||||
3 50
|
||||
3 2 1
|
||||
1 100
|
||||
6
|
||||
5 500
|
||||
2 2 2 2 2
|
||||
2 365
|
||||
3 4
|
||||
2 469077255466389
|
||||
10000 2023
|
||||
10 635472106413848880
|
||||
9181 4243 7777 1859 2017 4397 14 9390 2245 7225
|
||||
7 176345687772781240
|
||||
9202 9407 9229 6257 7743 5738 7966
|
||||
14 865563946464579627
|
||||
3654 5483 1657 7571 1639 9815 122 9468 3079 2666 5498 4540 7861 5384
|
||||
19 977162053008871403
|
||||
9169 9520 9209 9013 9300 9843 9933 9454 9960 9167 9964 9701 9251 9404 9462 9277 9661 9164 9161
|
||||
18 886531871815571953
|
||||
2609 10 5098 9591 949 8485 6385 4586 1064 5412 6564 8460 2245 6552 5089 8353 3803 3764
|
||||
13
codeforces/886/e.out
Normal file
13
codeforces/886/e.out
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
1
|
||||
2
|
||||
4
|
||||
5
|
||||
7654321
|
||||
126040443
|
||||
79356352
|
||||
124321725
|
||||
113385729
|
||||
110961227
|
||||
|
||||
[code]: 0
|
||||
[time]: 14.693 ms
|
||||
258
codeforces/886/f.cc
Normal file
258
codeforces/886/f.cc
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
#include <bits/stdc++.h> // {{{
|
||||
|
||||
// https://codeforces.com/blog/entry/96344
|
||||
|
||||
#pragma GCC optimize("O2,unroll-loops")
|
||||
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MIN() {
|
||||
return std::numeric_limits<T>::min();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MAX() {
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sc(auto &&x) {
|
||||
return static_cast<T>(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sz(auto &&x) {
|
||||
return static_cast<T>(x.size());
|
||||
}
|
||||
|
||||
#define prln(...) std::println(__VA_ARGS__)
|
||||
#define pr(...) std::print(__VA_ARGS__)
|
||||
|
||||
#ifdef LOCAL
|
||||
#define dbgln(...) std::println(__VA_ARGS__)
|
||||
#define dbg(...) std::print(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
inline static void NO() {
|
||||
prln("NO");
|
||||
}
|
||||
|
||||
inline static void YES() {
|
||||
prln("YES");
|
||||
}
|
||||
|
||||
using ll = long long;
|
||||
using ld = long double;
|
||||
template <typename T>
|
||||
using ve = std::vector<T>;
|
||||
template <typename T, size_t N>
|
||||
using ar = std::array<T, N>;
|
||||
template <typename T1, typename T2>
|
||||
using pa = std::pair<T1, T2>;
|
||||
template <typename... Ts>
|
||||
using tu = std::tuple<Ts...>;
|
||||
template <typename... Ts>
|
||||
using dq = std::deque<Ts...>;
|
||||
template <typename... Ts>
|
||||
using qu = std::queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using pq = std::priority_queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using st = std::stack<Ts...>;
|
||||
auto lb = [](auto... args) {
|
||||
return std::lower_bound(args...);
|
||||
};
|
||||
auto ub = [](auto... args) {
|
||||
return std::upper_bound(args...);
|
||||
};
|
||||
|
||||
#define ff first
|
||||
#define ss second
|
||||
#define eb emplace_back
|
||||
#define pb push_back
|
||||
#define all(x) (x).begin(), (x).end()
|
||||
#define rall(x) (x).rbegin(), (x).rend()
|
||||
// }}}
|
||||
|
||||
#include <ext/pb_ds/assoc_container.hpp>
|
||||
#include <ext/pb_ds/tree_policy.hpp>
|
||||
|
||||
using namespace __gnu_pbds;
|
||||
|
||||
// https://mirror.codeforces.com/blog/entry/124683
|
||||
|
||||
namespace hashing {
|
||||
using i64 = std::int64_t;
|
||||
using u64 = std::uint64_t;
|
||||
static const u64 FIXED_RANDOM =
|
||||
std::chrono::steady_clock::now().time_since_epoch().count();
|
||||
|
||||
#if USE_AES
|
||||
std::mt19937 rd(FIXED_RANDOM);
|
||||
const __m128i KEY1{(i64)rd(), (i64)rd()};
|
||||
const __m128i KEY2{(i64)rd(), (i64)rd()};
|
||||
#endif
|
||||
|
||||
template <class T, class D = void>
|
||||
struct custom_hash {};
|
||||
|
||||
template <class T>
|
||||
inline void hash_combine(u64 &seed, T const &v) {
|
||||
custom_hash<T> hasher;
|
||||
seed ^= hasher(v) + 0x9e3779b97f4a7c15 + (seed << 12) + (seed >> 4);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct custom_hash<T,
|
||||
typename std::enable_if<std::is_integral<T>::value>::type> {
|
||||
u64 operator()(T _x) const {
|
||||
u64 x = _x;
|
||||
#if USE_AES
|
||||
__m128i m{i64(u64(x) * 0xbf58476d1ce4e5b9u64), (i64)FIXED_RANDOM};
|
||||
__m128i y = _mm_aesenc_si128(m, KEY1);
|
||||
__m128i z = _mm_aesenc_si128(y, KEY2);
|
||||
return z[0];
|
||||
#else
|
||||
x += 0x9e3779b97f4a7c15 + FIXED_RANDOM;
|
||||
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
|
||||
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
|
||||
return x ^ (x >> 31);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct custom_hash<T, std::void_t<decltype(std::begin(std::declval<T>()))>> {
|
||||
u64 operator()(T const &a) const {
|
||||
u64 value = FIXED_RANDOM;
|
||||
for (auto &x : a)
|
||||
hash_combine(value, x);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
template <class... T>
|
||||
struct custom_hash<std::tuple<T...>> {
|
||||
u64 operator()(const std::tuple<T...> &a) const {
|
||||
u64 value = FIXED_RANDOM;
|
||||
std::apply(
|
||||
[&value](T const &...args) {
|
||||
(hash_combine(value, args), ...);
|
||||
},
|
||||
a);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
struct custom_hash<std::pair<T, U>> {
|
||||
u64 operator()(std::pair<T, U> const &a) const {
|
||||
u64 value = FIXED_RANDOM;
|
||||
hash_combine(value, a.first);
|
||||
hash_combine(value, a.second);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
}; // namespace hashing
|
||||
|
||||
#ifdef PB_DS_ASSOC_CNTNR_HPP
|
||||
template <class Key, class Value = null_type>
|
||||
using hashtable = gp_hash_table<
|
||||
Key, Value, hashing::custom_hash<Key>, std::equal_to<Key>,
|
||||
direct_mask_range_hashing<>, linear_probe_fn<>,
|
||||
hash_standard_resize_policy<hash_exponential_size_policy<>,
|
||||
hash_load_check_resize_trigger<>, true>>;
|
||||
|
||||
#endif
|
||||
#ifdef PB_DS_TREE_POLICY_HPP
|
||||
template <typename T>
|
||||
using multitree = tree<T, null_type, std::less_equal<T>, rb_tree_tag,
|
||||
tree_order_statistics_node_update>;
|
||||
template <class Key, class Value = null_type>
|
||||
using rbtree = tree<Key, Value, std::less<Key>, rb_tree_tag,
|
||||
tree_order_statistics_node_update>;
|
||||
#endif
|
||||
|
||||
void solve() {
|
||||
// division/math is weak point, but good amortized analysis
|
||||
// should be able to evaluate/come up with S(n=10^5)
|
||||
// instead of typing it into python
|
||||
// series/real analysis weakness
|
||||
// NOTE: better workflow for testing, i can't be certain if i would've tested
|
||||
// with 10^5 numbers 1..10^5 because i was on an airplane, but i tested it now
|
||||
int n;
|
||||
cin >> n;
|
||||
ve<ll> a(n);
|
||||
hashtable<int, int> f;
|
||||
for (auto &e : a) {
|
||||
cin >> e;
|
||||
++f[e];
|
||||
}
|
||||
|
||||
ve<int> sieve(n + 1, 0);
|
||||
for (auto [k, v] : f) {
|
||||
ll K = k;
|
||||
while (K <= n) {
|
||||
sieve[K] += v;
|
||||
K += k;
|
||||
}
|
||||
}
|
||||
|
||||
// TC: O(n + n + n / 2 + n / 3 + n / 4)
|
||||
// with n <= 10^5, that's O(14 n), which should be fine
|
||||
|
||||
prln("{}", *max_element(all(sieve)));
|
||||
|
||||
/*
|
||||
n + n / 2 + n / 3 + n / 4
|
||||
1 + 1 / 2 + 1 / 3 + 1 / 4
|
||||
a, 2a, 3a, 4a
|
||||
b, 2b, 3b, 4b
|
||||
c, 2c, 3c, 4c
|
||||
|
||||
looking for number most frogs hit
|
||||
|
||||
most frequent common multiple
|
||||
|
||||
can't scan frog hop distances
|
||||
|
||||
sort them
|
||||
|
||||
a
|
||||
b
|
||||
makes sense to choose earliest hop in common for now
|
||||
lcm(a, b), ans = 2 (NOTE: if <= 10^9)
|
||||
|
||||
find c: trap: lcm(a, b, c), ans = 3
|
||||
or don't: lcm(a, b), lcm(c) = c
|
||||
|
||||
^ prob dp?
|
||||
|
||||
binary search on place to trap, check if can trap:
|
||||
time-wise yes
|
||||
if can trap a at position x? x % a = 0
|
||||
|
||||
no monotonic search space?
|
||||
|
||||
consider iterating from trap=1..n
|
||||
how many frogs can i trap?
|
||||
number of frogs s.t. trap % frog = 0
|
||||
*/
|
||||
}
|
||||
|
||||
int main() { // {{{
|
||||
cin.tie(nullptr)->sync_with_stdio(false);
|
||||
cin.exceptions(cin.failbit);
|
||||
|
||||
int t = 1;
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
solve();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
// }}}
|
||||
17
codeforces/886/f.in
Normal file
17
codeforces/886/f.in
Normal file
File diff suppressed because one or more lines are too long
11
codeforces/886/f.out
Normal file
11
codeforces/886/f.out
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
3
|
||||
3
|
||||
3
|
||||
5
|
||||
0
|
||||
4
|
||||
4
|
||||
128
|
||||
|
||||
[code]: 0
|
||||
[time]: 21.6208 ms
|
||||
246
codeforces/886/g.cc
Normal file
246
codeforces/886/g.cc
Normal file
|
|
@ -0,0 +1,246 @@
|
|||
#include <bits/stdc++.h> // {{{
|
||||
|
||||
// https://codeforces.com/blog/entry/96344
|
||||
|
||||
#pragma GCC optimize("O2,unroll-loops")
|
||||
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MIN() {
|
||||
return std::numeric_limits<T>::min();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MAX() {
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sc(auto &&x) {
|
||||
return static_cast<T>(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sz(auto &&x) {
|
||||
return static_cast<T>(x.size());
|
||||
}
|
||||
|
||||
#define prln(...) std::println(__VA_ARGS__)
|
||||
#define pr(...) std::print(__VA_ARGS__)
|
||||
|
||||
#ifdef LOCAL
|
||||
#define dbgln(...) std::println(__VA_ARGS__)
|
||||
#define dbg(...) std::print(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
inline static void NO() {
|
||||
prln("NO");
|
||||
}
|
||||
|
||||
inline static void YES() {
|
||||
prln("YES");
|
||||
}
|
||||
|
||||
using ll = long long;
|
||||
using ld = long double;
|
||||
template <typename T>
|
||||
using ve = std::vector<T>;
|
||||
template <typename T, size_t N>
|
||||
using ar = std::array<T, N>;
|
||||
template <typename T1, typename T2>
|
||||
using pa = std::pair<T1, T2>;
|
||||
template <typename... Ts>
|
||||
using tu = std::tuple<Ts...>;
|
||||
template <typename... Ts>
|
||||
using dq = std::deque<Ts...>;
|
||||
template <typename... Ts>
|
||||
using qu = std::queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using pq = std::priority_queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using st = std::stack<Ts...>;
|
||||
auto lb = [](auto... args) {
|
||||
return std::lower_bound(args...);
|
||||
};
|
||||
auto ub = [](auto... args) {
|
||||
return std::upper_bound(args...);
|
||||
};
|
||||
|
||||
#define ff first
|
||||
#define ss second
|
||||
#define eb emplace_back
|
||||
#define pb push_back
|
||||
#define all(x) (x).begin(), (x).end()
|
||||
#define rall(x) (x).rbegin(), (x).rend()
|
||||
// }}}
|
||||
|
||||
#include <ext/pb_ds/assoc_container.hpp>
|
||||
#include <ext/pb_ds/tree_policy.hpp>
|
||||
|
||||
using namespace __gnu_pbds;
|
||||
|
||||
// https://mirror.codeforces.com/blog/entry/124683
|
||||
|
||||
namespace hashing {
|
||||
using i64 = std::int64_t;
|
||||
using u64 = std::uint64_t;
|
||||
static const u64 FIXED_RANDOM =
|
||||
std::chrono::steady_clock::now().time_since_epoch().count();
|
||||
|
||||
#if USE_AES
|
||||
std::mt19937 rd(FIXED_RANDOM);
|
||||
const __m128i KEY1{(i64)rd(), (i64)rd()};
|
||||
const __m128i KEY2{(i64)rd(), (i64)rd()};
|
||||
#endif
|
||||
|
||||
template <class T, class D = void>
|
||||
struct custom_hash {};
|
||||
|
||||
template <class T>
|
||||
inline void hash_combine(u64 &seed, T const &v) {
|
||||
custom_hash<T> hasher;
|
||||
seed ^= hasher(v) + 0x9e3779b97f4a7c15 + (seed << 12) + (seed >> 4);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct custom_hash<T,
|
||||
typename std::enable_if<std::is_integral<T>::value>::type> {
|
||||
u64 operator()(T _x) const {
|
||||
u64 x = _x;
|
||||
#if USE_AES
|
||||
__m128i m{i64(u64(x) * 0xbf58476d1ce4e5b9u64), (i64)FIXED_RANDOM};
|
||||
__m128i y = _mm_aesenc_si128(m, KEY1);
|
||||
__m128i z = _mm_aesenc_si128(y, KEY2);
|
||||
return z[0];
|
||||
#else
|
||||
x += 0x9e3779b97f4a7c15 + FIXED_RANDOM;
|
||||
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
|
||||
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
|
||||
return x ^ (x >> 31);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct custom_hash<T, std::void_t<decltype(std::begin(std::declval<T>()))>> {
|
||||
u64 operator()(T const &a) const {
|
||||
u64 value = FIXED_RANDOM;
|
||||
for (auto &x : a)
|
||||
hash_combine(value, x);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
template <class... T>
|
||||
struct custom_hash<std::tuple<T...>> {
|
||||
u64 operator()(const std::tuple<T...> &a) const {
|
||||
u64 value = FIXED_RANDOM;
|
||||
std::apply(
|
||||
[&value](T const &...args) {
|
||||
(hash_combine(value, args), ...);
|
||||
},
|
||||
a);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
struct custom_hash<std::pair<T, U>> {
|
||||
u64 operator()(std::pair<T, U> const &a) const {
|
||||
u64 value = FIXED_RANDOM;
|
||||
hash_combine(value, a.first);
|
||||
hash_combine(value, a.second);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
}; // namespace hashing
|
||||
|
||||
#ifdef PB_DS_ASSOC_CNTNR_HPP
|
||||
template <class Key, class Value = null_type>
|
||||
using hashtable = gp_hash_table<
|
||||
Key, Value, hashing::custom_hash<Key>, std::equal_to<Key>,
|
||||
direct_mask_range_hashing<>, linear_probe_fn<>,
|
||||
hash_standard_resize_policy<hash_exponential_size_policy<>,
|
||||
hash_load_check_resize_trigger<>, true>>;
|
||||
|
||||
#endif
|
||||
#ifdef PB_DS_TREE_POLICY_HPP
|
||||
template <typename T>
|
||||
using multitree = tree<T, null_type, std::less_equal<T>, rb_tree_tag,
|
||||
tree_order_statistics_node_update>;
|
||||
template <class Key, class Value = null_type>
|
||||
using rbtree = tree<Key, Value, std::less<Key>, rb_tree_tag,
|
||||
tree_order_statistics_node_update>;
|
||||
#endif
|
||||
|
||||
void solve() {
|
||||
int n;
|
||||
cin >> n;
|
||||
// NOTE: keep forgetting to initialize vector with size
|
||||
// NOTE: thought could just use angles -> completely wrong
|
||||
ve<pa<ll, ll>> points(n);
|
||||
map<ll, ll> xs, ys;
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
cin >> points[i].ff >> points[i].ss;
|
||||
++xs[points[i].ff];
|
||||
++ys[points[i].ss];
|
||||
}
|
||||
|
||||
ll ans = 0;
|
||||
|
||||
for (auto [_, f] : xs) {
|
||||
ans += f * (f - 1) / 2;
|
||||
}
|
||||
for (auto [_, f] : ys) {
|
||||
ans += f * (f - 1) / 2;
|
||||
}
|
||||
|
||||
xs.clear();
|
||||
ys.clear();
|
||||
|
||||
// NOTE: claude did tihs, to account for precision errors, no idea why this
|
||||
// works
|
||||
for (auto [x, y] : points) {
|
||||
ll rx = x + y;
|
||||
ll ry = x - y;
|
||||
++xs[rx];
|
||||
++ys[ry];
|
||||
}
|
||||
|
||||
for (auto [_, f] : xs) {
|
||||
ans += f * (f - 1) / 2;
|
||||
}
|
||||
for (auto [_, f] : ys) {
|
||||
ans += f * (f - 1) / 2;
|
||||
}
|
||||
|
||||
prln("{}", ans * 2);
|
||||
|
||||
// WRONG:
|
||||
// for the fun of it, let's change this up - find the angle each point makes
|
||||
// with 0 then should be same counting approach
|
||||
|
||||
// should be: count all points with same y value, n * (n - 1) / 2
|
||||
// and same x
|
||||
// then rotate 45 degrees, do the same- guaranteed no overcounting
|
||||
|
||||
// PAUSED AT 17:00
|
||||
}
|
||||
|
||||
int main() { // {{{
|
||||
cin.tie(nullptr)->sync_with_stdio(false);
|
||||
cin.exceptions(cin.failbit);
|
||||
|
||||
int t = 1;
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
solve();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
// }}}
|
||||
29
codeforces/886/g.in
Normal file
29
codeforces/886/g.in
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
6
|
||||
3
|
||||
0 0
|
||||
-1 -1
|
||||
1 1
|
||||
4
|
||||
4 5
|
||||
5 7
|
||||
6 9
|
||||
10 13
|
||||
3
|
||||
-1000000000 1000000000
|
||||
0 0
|
||||
1000000000 -1000000000
|
||||
5
|
||||
0 0
|
||||
2 2
|
||||
-1 5
|
||||
-1 10
|
||||
2 11
|
||||
3
|
||||
0 0
|
||||
-1 2
|
||||
1 -2
|
||||
4
|
||||
0 0
|
||||
0 1
|
||||
1 0
|
||||
-1 0
|
||||
9
codeforces/886/g.out
Normal file
9
codeforces/886/g.out
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
6
|
||||
2
|
||||
6
|
||||
8
|
||||
0
|
||||
12
|
||||
|
||||
[code]: 0
|
||||
[time]: 14.0719 ms
|
||||
96
codeforces/886/h.cc
Normal file
96
codeforces/886/h.cc
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
#include <bits/stdc++.h> // {{{
|
||||
|
||||
// https://codeforces.com/blog/entry/96344
|
||||
|
||||
#pragma GCC optimize("O2,unroll-loops")
|
||||
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MIN() {
|
||||
return std::numeric_limits<T>::min();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T MAX() {
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sc(auto&& x) {
|
||||
return static_cast<T>(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] static T sz(auto&& x) {
|
||||
return static_cast<T>(x.size());
|
||||
}
|
||||
|
||||
#define prln(...) std::println(__VA_ARGS__)
|
||||
#define pr(...) std::print(__VA_ARGS__)
|
||||
|
||||
#ifdef LOCAL
|
||||
#define dbgln(...) std::println(__VA_ARGS__)
|
||||
#define dbg(...) std::print(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
inline static void NO() {
|
||||
prln("NO");
|
||||
}
|
||||
|
||||
inline static void YES() {
|
||||
prln("YES");
|
||||
}
|
||||
|
||||
using ll = long long;
|
||||
using ld = long double;
|
||||
template <typename T>
|
||||
using ve = std::vector<T>;
|
||||
template <typename T, size_t N>
|
||||
using ar = std::array<T, N>;
|
||||
template <typename T1, typename T2>
|
||||
using pa = std::pair<T1, T2>;
|
||||
template <typename... Ts>
|
||||
using tu = std::tuple<Ts...>;
|
||||
template <typename... Ts>
|
||||
using dq = std::deque<Ts...>;
|
||||
template <typename... Ts>
|
||||
using qu = std::queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using pq = std::priority_queue<Ts...>;
|
||||
template <typename... Ts>
|
||||
using st = std::stack<Ts...>;
|
||||
auto lb = [](auto... args) {
|
||||
return std::lower_bound(args...);
|
||||
};
|
||||
auto ub = [](auto... args) {
|
||||
return std::upper_bound(args...);
|
||||
};
|
||||
|
||||
#define ff first
|
||||
#define ss second
|
||||
#define eb emplace_back
|
||||
#define pb push_back
|
||||
#define all(x) (x).begin(), (x).end()
|
||||
#define rall(x) (x).rbegin(), (x).rend()
|
||||
// }}}
|
||||
|
||||
void solve() {
|
||||
|
||||
}
|
||||
|
||||
int main() { // {{{
|
||||
cin.tie(nullptr)->sync_with_stdio(false);
|
||||
cin.exceptions(cin.failbit);
|
||||
|
||||
int t = 1;
|
||||
cin >> t;
|
||||
|
||||
while (t--) {
|
||||
solve();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
// }}}
|
||||
0
codeforces/886/h.in
Normal file
0
codeforces/886/h.in
Normal file
0
codeforces/886/h.out
Normal file
0
codeforces/886/h.out
Normal file
Loading…
Add table
Add a link
Reference in a new issue