Submission #68316113
Source Code Expand
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define rep(i, m, n) for (ll i = (ll)m; i < (ll)n; i++)
#define drep(i, m, n) for (ll i = m - 1; i >= n; i--)
#define Endl endl
#define all(a) a.begin(), a.end()
#define pr(i, j) make_pair(i, j)
#define isin(x, l, r) (l <= x && x < r)
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
#define srt(ar) sort(ar.begin(), ar.end())
#define rev(ar) reverse(ar.begin(), ar.end())
#define jge(f, s, t) cout << (f ? s : t) << endl
template <typename T>
using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define printar(ar) \
do \
{ \
for (auto dbg : ar) \
{ \
cout << dbg << " "; \
} \
cout << endl; \
} while (0)
const ll inf = 1e18;
const ld pi = 3.14159265358979;
const ld eps = 1e-9;
template <class T, ll n, ll idx = 0>
auto make_vec(const ll (&d)[n], const T &init) noexcept
{
if constexpr (idx < n)
return std::vector(d[idx], make_vec<T, n, idx + 1>(d, init));
else
return init;
}
template <class T, ll n>
auto make_vec(const ll (&d)[n]) noexcept
{
return make_vec(d, T{});
}
//////////////// 以下を貼る ////////////////
template <class T>
size_t HashCombine(const size_t seed, const T &v)
{
return seed ^ (std::hash<T>()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2));
}
/* pair用 */
template <class T, class S>
struct std::hash<std::pair<T, S>>
{
size_t operator()(const std::pair<T, S> &keyval) const noexcept
{
return HashCombine(std::hash<T>()(keyval.first), keyval.second);
}
};
/* vector用 */
template <class T>
struct std::hash<std::vector<T>>
{
size_t operator()(const std::vector<T> &keyval) const noexcept
{
size_t s = 0;
for (auto &&v : keyval)
s = HashCombine(s, v);
return s;
}
};
/* tuple用 */
template <int N>
struct HashTupleCore
{
template <class Tuple>
size_t operator()(const Tuple &keyval) const noexcept
{
size_t s = HashTupleCore<N - 1>()(keyval);
return HashCombine(s, std::get<N - 1>(keyval));
}
};
template <>
struct HashTupleCore<0>
{
template <class Tuple>
size_t operator()(const Tuple &keyval) const noexcept { return 0; }
};
template <class... Args>
struct std::hash<std::tuple<Args...>>
{
size_t operator()(const tuple<Args...> &keyval) const noexcept
{
return HashTupleCore<tuple_size<tuple<Args...>>::value>()(keyval);
}
};
////////////////////////////////////////////
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s;
cin >> s;
ld ans = 0;
ll n = s.length();
rep(i, 0, n)
{
rep(j, i, n)
{
string t = s.substr(i, j - i + 1);
if (t.length() < 3)
{
continue;
}
ll a = t.length();
ll b = 0;
rep(k, 0, t.length())
{
if (t[k] == 't')
{
b++;
}
}
ld sub = b - 2;
sub /= (ld)(a - 2);
chmax(ans, sub);
}
}
cout << setprecision(15) << fixed << ans << endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - You're a teapot |
| User | a_s_k |
| Language | C++ 23 (gcc 12.2) |
| Score | 200 |
| Code Size | 3807 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 3880 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt |
| All | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, 01-36.txt, 01-37.txt, 01-38.txt, 01-39.txt, 01-40.txt, 01-41.txt, 01-42.txt, 01-43.txt, 01-44.txt, 01-45.txt, 01-46.txt, 01-47.txt, 01-48.txt, 01-49.txt, 01-50.txt, 01-51.txt, 01-52.txt, 01-53.txt, 01-54.txt, 01-55.txt, 01-56.txt, 01-57.txt, 01-58.txt, 01-59.txt, 01-60.txt, 01-61.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-01.txt | AC | 1 ms | 3740 KiB |
| 00-sample-02.txt | AC | 1 ms | 3568 KiB |
| 00-sample-03.txt | AC | 1 ms | 3760 KiB |
| 01-01.txt | AC | 1 ms | 3744 KiB |
| 01-02.txt | AC | 1 ms | 3744 KiB |
| 01-03.txt | AC | 1 ms | 3744 KiB |
| 01-04.txt | AC | 1 ms | 3692 KiB |
| 01-05.txt | AC | 1 ms | 3696 KiB |
| 01-06.txt | AC | 1 ms | 3732 KiB |
| 01-07.txt | AC | 1 ms | 3688 KiB |
| 01-08.txt | AC | 1 ms | 3684 KiB |
| 01-09.txt | AC | 1 ms | 3748 KiB |
| 01-10.txt | AC | 1 ms | 3636 KiB |
| 01-11.txt | AC | 1 ms | 3772 KiB |
| 01-12.txt | AC | 1 ms | 3744 KiB |
| 01-13.txt | AC | 1 ms | 3640 KiB |
| 01-14.txt | AC | 1 ms | 3756 KiB |
| 01-15.txt | AC | 1 ms | 3732 KiB |
| 01-16.txt | AC | 1 ms | 3876 KiB |
| 01-17.txt | AC | 1 ms | 3696 KiB |
| 01-18.txt | AC | 1 ms | 3648 KiB |
| 01-19.txt | AC | 1 ms | 3652 KiB |
| 01-20.txt | AC | 1 ms | 3696 KiB |
| 01-21.txt | AC | 1 ms | 3756 KiB |
| 01-22.txt | AC | 1 ms | 3704 KiB |
| 01-23.txt | AC | 1 ms | 3528 KiB |
| 01-24.txt | AC | 1 ms | 3748 KiB |
| 01-25.txt | AC | 1 ms | 3760 KiB |
| 01-26.txt | AC | 1 ms | 3644 KiB |
| 01-27.txt | AC | 1 ms | 3876 KiB |
| 01-28.txt | AC | 1 ms | 3696 KiB |
| 01-29.txt | AC | 1 ms | 3756 KiB |
| 01-30.txt | AC | 1 ms | 3760 KiB |
| 01-31.txt | AC | 1 ms | 3764 KiB |
| 01-32.txt | AC | 1 ms | 3768 KiB |
| 01-33.txt | AC | 1 ms | 3732 KiB |
| 01-34.txt | AC | 1 ms | 3764 KiB |
| 01-35.txt | AC | 1 ms | 3640 KiB |
| 01-36.txt | AC | 1 ms | 3668 KiB |
| 01-37.txt | AC | 1 ms | 3772 KiB |
| 01-38.txt | AC | 1 ms | 3752 KiB |
| 01-39.txt | AC | 1 ms | 3700 KiB |
| 01-40.txt | AC | 1 ms | 3620 KiB |
| 01-41.txt | AC | 1 ms | 3756 KiB |
| 01-42.txt | AC | 1 ms | 3872 KiB |
| 01-43.txt | AC | 1 ms | 3764 KiB |
| 01-44.txt | AC | 1 ms | 3772 KiB |
| 01-45.txt | AC | 1 ms | 3576 KiB |
| 01-46.txt | AC | 1 ms | 3700 KiB |
| 01-47.txt | AC | 1 ms | 3880 KiB |
| 01-48.txt | AC | 1 ms | 3696 KiB |
| 01-49.txt | AC | 1 ms | 3880 KiB |
| 01-50.txt | AC | 1 ms | 3784 KiB |
| 01-51.txt | AC | 1 ms | 3708 KiB |
| 01-52.txt | AC | 1 ms | 3664 KiB |
| 01-53.txt | AC | 1 ms | 3668 KiB |
| 01-54.txt | AC | 1 ms | 3784 KiB |
| 01-55.txt | AC | 1 ms | 3764 KiB |
| 01-56.txt | AC | 1 ms | 3580 KiB |
| 01-57.txt | AC | 1 ms | 3760 KiB |
| 01-58.txt | AC | 1 ms | 3704 KiB |
| 01-59.txt | AC | 1 ms | 3704 KiB |
| 01-60.txt | AC | 1 ms | 3696 KiB |
| 01-61.txt | AC | 1 ms | 3752 KiB |