Submission #68769740


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);
    ll x;
    cin >> x;
    x = 4 * x - 1;
    vector<ll> ans;
    for (ll i = 1; i * i <= abs(x); i++)
    {
        if (x % i == 0)
        {
            ll a = i - x / i;
            a -= 2;
            if (a % 4 == 0)
            {
                ans.emplace_back(a / 4);
            }
            ll b = -i + x / i;
            b -= 2;
            if (b % 4 == 0)
            {
                ans.emplace_back(b / 4);
            }
        }
    }
    srt(ans);
    cout << ans.size() << endl;
    printar(ans);
}

Submission Info

Submission Time
Task G - sqrt(n²+n+X)
User a_s_k
Language C++ 23 (gcc 12.2)
Score 575
Code Size 3602 Byte
Status AC
Exec Time 59 ms
Memory 3608 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 575 / 575
Status
AC × 3
AC × 63
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 01_handmade_10.txt, 01_handmade_11.txt, 01_handmade_12.txt, 01_handmade_13.txt, 01_handmade_14.txt, 01_handmade_15.txt, 01_handmade_16.txt, 01_handmade_17.txt, 01_handmade_18.txt, 01_handmade_19.txt, 01_handmade_20.txt, 01_handmade_21.txt, 01_handmade_22.txt, 01_handmade_23.txt, 01_handmade_24.txt, 01_handmade_25.txt, 01_handmade_26.txt, 01_handmade_27.txt, 01_handmade_28.txt, 01_handmade_29.txt, 01_handmade_30.txt, 01_handmade_31.txt, 01_handmade_32.txt, 01_handmade_33.txt, 01_handmade_34.txt, 01_handmade_35.txt, 01_handmade_36.txt, 01_handmade_37.txt, 01_handmade_38.txt, 01_handmade_39.txt, 01_handmade_40.txt, 01_handmade_41.txt, 01_handmade_42.txt, 01_handmade_43.txt, 01_handmade_44.txt, 01_handmade_45.txt, 01_handmade_46.txt, 01_handmade_47.txt, 01_handmade_48.txt, 01_handmade_49.txt, 02_radom_00.txt, 02_radom_01.txt, 02_radom_02.txt, 02_radom_03.txt, 02_radom_04.txt, 02_radom_05.txt, 02_radom_06.txt, 02_radom_07.txt, 02_radom_08.txt, 02_radom_09.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3484 KiB
00_sample_01.txt AC 1 ms 3464 KiB
00_sample_02.txt AC 1 ms 3524 KiB
01_handmade_00.txt AC 1 ms 3460 KiB
01_handmade_01.txt AC 1 ms 3420 KiB
01_handmade_02.txt AC 1 ms 3436 KiB
01_handmade_03.txt AC 1 ms 3416 KiB
01_handmade_04.txt AC 1 ms 3376 KiB
01_handmade_05.txt AC 1 ms 3468 KiB
01_handmade_06.txt AC 1 ms 3316 KiB
01_handmade_07.txt AC 1 ms 3468 KiB
01_handmade_08.txt AC 1 ms 3376 KiB
01_handmade_09.txt AC 1 ms 3464 KiB
01_handmade_10.txt AC 1 ms 3484 KiB
01_handmade_11.txt AC 1 ms 3604 KiB
01_handmade_12.txt AC 1 ms 3456 KiB
01_handmade_13.txt AC 1 ms 3520 KiB
01_handmade_14.txt AC 1 ms 3396 KiB
01_handmade_15.txt AC 1 ms 3436 KiB
01_handmade_16.txt AC 1 ms 3420 KiB
01_handmade_17.txt AC 1 ms 3528 KiB
01_handmade_18.txt AC 1 ms 3380 KiB
01_handmade_19.txt AC 1 ms 3460 KiB
01_handmade_20.txt AC 1 ms 3452 KiB
01_handmade_21.txt AC 59 ms 3420 KiB
01_handmade_22.txt AC 46 ms 3328 KiB
01_handmade_23.txt AC 48 ms 3432 KiB
01_handmade_24.txt AC 23 ms 3436 KiB
01_handmade_25.txt AC 31 ms 3428 KiB
01_handmade_26.txt AC 48 ms 3400 KiB
01_handmade_27.txt AC 59 ms 3428 KiB
01_handmade_28.txt AC 59 ms 3432 KiB
01_handmade_29.txt AC 59 ms 3312 KiB
01_handmade_30.txt AC 59 ms 3464 KiB
01_handmade_31.txt AC 59 ms 3424 KiB
01_handmade_32.txt AC 59 ms 3440 KiB
01_handmade_33.txt AC 59 ms 3532 KiB
01_handmade_34.txt AC 59 ms 3516 KiB
01_handmade_35.txt AC 59 ms 3408 KiB
01_handmade_36.txt AC 59 ms 3608 KiB
01_handmade_37.txt AC 59 ms 3608 KiB
01_handmade_38.txt AC 59 ms 3440 KiB
01_handmade_39.txt AC 59 ms 3484 KiB
01_handmade_40.txt AC 59 ms 3468 KiB
01_handmade_41.txt AC 59 ms 3480 KiB
01_handmade_42.txt AC 59 ms 3420 KiB
01_handmade_43.txt AC 59 ms 3460 KiB
01_handmade_44.txt AC 59 ms 3400 KiB
01_handmade_45.txt AC 59 ms 3484 KiB
01_handmade_46.txt AC 59 ms 3516 KiB
01_handmade_47.txt AC 59 ms 3412 KiB
01_handmade_48.txt AC 59 ms 3600 KiB
01_handmade_49.txt AC 50 ms 3504 KiB
02_radom_00.txt AC 51 ms 3472 KiB
02_radom_01.txt AC 44 ms 3608 KiB
02_radom_02.txt AC 23 ms 3512 KiB
02_radom_03.txt AC 56 ms 3412 KiB
02_radom_04.txt AC 55 ms 3432 KiB
02_radom_05.txt AC 43 ms 3324 KiB
02_radom_06.txt AC 38 ms 3396 KiB
02_radom_07.txt AC 30 ms 3476 KiB
02_radom_08.txt AC 44 ms 3320 KiB
02_radom_09.txt AC 51 ms 3416 KiB