feat(946): problem a
This commit is contained in:
parent
77794b593c
commit
e371dd60e7
15 changed files with 213 additions and 32 deletions
|
|
@ -7,13 +7,13 @@ namespace rv = std::views;
|
||||||
namespace rs = std::ranges;
|
namespace rs = std::ranges;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// https://codeforces.com/blog/entry/96344
|
|
||||||
|
|
||||||
#pragma GCC optimize("O2,unroll-loops")
|
#pragma GCC optimize("O2,unroll-loops")
|
||||||
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
|
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
using i16 = int16_t;
|
||||||
|
using u16 = uint16_t;
|
||||||
using i32 = int32_t;
|
using i32 = int32_t;
|
||||||
using u32 = uint32_t;
|
using u32 = uint32_t;
|
||||||
using i64 = int64_t;
|
using i64 = int64_t;
|
||||||
|
|
@ -27,34 +27,8 @@ constexpr T MIN = std::numeric_limits<T>::min();
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr T MAX = std::numeric_limits<T>::max();
|
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
|
#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
|
#ifdef LOCAL
|
||||||
#define db(...) std::print(__VA_ARGS__)
|
#define db(...) std::print(__VA_ARGS__)
|
||||||
#define dbln(...) std::println(__VA_ARGS__)
|
#define dbln(...) std::println(__VA_ARGS__)
|
||||||
|
|
@ -65,12 +39,25 @@ using vec = std::vector<T>;
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
void solve() {
|
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() { // {{{
|
int main() { // {{{
|
||||||
std::cin.exceptions(std::cin.failbit);
|
std::cin.exceptions(std::cin.failbit);
|
||||||
|
|
||||||
#ifdef LOCAL
|
#ifdef LOCAL
|
||||||
std::cerr.rdbuf(std::cout.rdbuf());
|
std::cerr.rdbuf(std::cout.rdbuf());
|
||||||
std::cout.setf(std::ios::unitbuf);
|
std::cout.setf(std::ios::unitbuf);
|
||||||
|
|
@ -78,14 +65,11 @@ int main() { // {{{
|
||||||
#else
|
#else
|
||||||
std::cin.tie(nullptr)->sync_with_stdio(false);
|
std::cin.tie(nullptr)->sync_with_stdio(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u32 tc = 1;
|
u32 tc = 1;
|
||||||
std::cin >> tc;
|
std::cin >> tc;
|
||||||
|
|
||||||
for (u32 t = 0; t < tc; ++t) {
|
for (u32 t = 0; t < tc; ++t) {
|
||||||
solve();
|
solve();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
|
||||||
12
codeforces/946/io/1974a.1.cpin
Normal file
12
codeforces/946/io/1974a.1.cpin
Normal 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
|
||||||
11
codeforces/946/io/1974a.1.cpout
Normal file
11
codeforces/946/io/1974a.1.cpout
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
1
|
||||||
|
1
|
||||||
|
2
|
||||||
|
2
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
1
|
||||||
|
1
|
||||||
|
2
|
||||||
|
5
|
||||||
11
codeforces/946/io/1974b.1.cpin
Normal file
11
codeforces/946/io/1974b.1.cpin
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
5
|
||||||
|
10
|
||||||
|
serofedsoc
|
||||||
|
3
|
||||||
|
ttf
|
||||||
|
9
|
||||||
|
tlrhgmaoi
|
||||||
|
1
|
||||||
|
w
|
||||||
|
15
|
||||||
|
hnndledmnhlttin
|
||||||
5
codeforces/946/io/1974b.1.cpout
Normal file
5
codeforces/946/io/1974b.1.cpout
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
codeforces
|
||||||
|
fft
|
||||||
|
algorithm
|
||||||
|
w
|
||||||
|
meetinthemiddle
|
||||||
17
codeforces/946/io/1974c.1.cpin
Normal file
17
codeforces/946/io/1974c.1.cpin
Normal 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
|
||||||
8
codeforces/946/io/1974c.1.cpout
Normal file
8
codeforces/946/io/1974c.1.cpout
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
2
|
||||||
|
0
|
||||||
|
3
|
||||||
|
1
|
||||||
|
8
|
||||||
|
4
|
||||||
|
3
|
||||||
|
2
|
||||||
21
codeforces/946/io/1974d.1.cpin
Normal file
21
codeforces/946/io/1974d.1.cpin
Normal 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
|
||||||
10
codeforces/946/io/1974d.1.cpout
Normal file
10
codeforces/946/io/1974d.1.cpout
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
RRHRRH
|
||||||
|
NO
|
||||||
|
HRRHRH
|
||||||
|
NO
|
||||||
|
NO
|
||||||
|
RHRH
|
||||||
|
RRHH
|
||||||
|
RH
|
||||||
|
RRRH
|
||||||
|
RRHH
|
||||||
31
codeforces/946/io/1974e.1.cpin
Normal file
31
codeforces/946/io/1974e.1.cpin
Normal 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
|
||||||
7
codeforces/946/io/1974e.1.cpout
Normal file
7
codeforces/946/io/1974e.1.cpout
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
0
|
||||||
|
10
|
||||||
|
200
|
||||||
|
15
|
||||||
|
1
|
||||||
|
9
|
||||||
|
9
|
||||||
39
codeforces/946/io/1974f.1.cpin
Normal file
39
codeforces/946/io/1974f.1.cpin
Normal 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
|
||||||
6
codeforces/946/io/1974f.1.cpout
Normal file
6
codeforces/946/io/1974f.1.cpout
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
2 1
|
||||||
|
2 0
|
||||||
|
0 3
|
||||||
|
1 1
|
||||||
|
2 0
|
||||||
|
0 1
|
||||||
13
codeforces/946/io/1974g.1.cpin
Normal file
13
codeforces/946/io/1974g.1.cpin
Normal 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
|
||||||
6
codeforces/946/io/1974g.1.cpout
Normal file
6
codeforces/946/io/1974g.1.cpout
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
2
|
||||||
|
4
|
||||||
|
3
|
||||||
|
1
|
||||||
|
2
|
||||||
|
1
|
||||||
Loading…
Add table
Add a link
Reference in a new issue