feat(946): problem a

This commit is contained in:
Barrett Ruth 2025-12-08 20:33:36 -06:00
parent 77794b593c
commit e371dd60e7
15 changed files with 213 additions and 32 deletions

View file

@ -7,13 +7,13 @@ namespace rv = std::views;
namespace rs = std::ranges;
#endif
// https://codeforces.com/blog/entry/96344
#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;
@ -27,34 +27,8 @@ constexpr T MIN = std::numeric_limits<T>::min();
template <typename T>
constexpr T MAX = 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());
}
#endif
static void NO() {
std::cout << "NO\n";
}
static void YES() {
std::cout << "YES\n";
}
template <typename T>
using vec = std::vector<T>;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ff first
#define ss second
#ifdef LOCAL
#define db(...) std::print(__VA_ARGS__)
#define dbln(...) std::println(__VA_ARGS__)
@ -65,12 +39,25 @@ using vec = std::vector<T>;
// }}}
void solve() {
i32 x, y;
cin >> x >> y;
u32 ans = 0;
while (x > 0 || y > 0) {
i32 ys = min(2, y);
i32 xs = min(5 * 3 - ys * 2 * 2, x);
x -= xs;
y -= ys;
++ans;
}
println("{}", ans);
}
int main() { // {{{
std::cin.exceptions(std::cin.failbit);
#ifdef LOCAL
std::cerr.rdbuf(std::cout.rdbuf());
std::cout.setf(std::ios::unitbuf);
@ -78,14 +65,11 @@ int main() { // {{{
#else
std::cin.tie(nullptr)->sync_with_stdio(false);
#endif
u32 tc = 1;
std::cin >> tc;
for (u32 t = 0; t < tc; ++t) {
solve();
}
return 0;
}
// }}}

View file

@ -0,0 +1,12 @@
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9

View file

@ -0,0 +1,11 @@
1
1
2
2
1
1
0
1
1
2
5

View file

@ -0,0 +1,11 @@
5
10
serofedsoc
3
ttf
9
tlrhgmaoi
1
w
15
hnndledmnhlttin

View file

@ -0,0 +1,5 @@
codeforces
fft
algorithm
w
meetinthemiddle

View file

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

View file

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

View file

@ -0,0 +1,21 @@
10
6
NENSNE
3
WWW
6
NESSWS
2
SN
2
WE
4
SSNN
4
WESN
2
SS
4
EWNN
4
WEWE

View file

@ -0,0 +1,10 @@
RRHRRH
NO
HRRHRH
NO
NO
RHRH
RRHH
RH
RRRH
RRHH

View file

@ -0,0 +1,31 @@
7
1 10
1 5
2 80
0 10
200 100
3 100
70 100
100 200
150 150
5 8
3 1
5 3
3 4
1 5
5 3
2 5
1 5
2 1
5 3
2 5
2 4
4 1
5 1
3 4
5 2
2 1
1 2
3 5
3 2
3 2

View file

@ -0,0 +1,7 @@
0
10
200
15
1
9
9

View file

@ -0,0 +1,39 @@
6
4 4 3 2
4 1
3 3
2 4
D 2
R 1
4 4 3 3
4 1
3 2
2 3
D 1
L 1
U 2
3 5 3 2
1 3
2 2
3 3
R 2
R 2
6 4 4 2
1 4
2 3
5 3
1 1
R 1
U 1
9 3 2 1
6 1
3 3
D 8
10 10 2 5
7 5
9 1
R 1
L 2
D 1
U 4
D 1

View file

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

View file

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

View file

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