Submission #68825090


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define rep(i, s, t) for(int i = (s); i <= (t); i ++)
#define per(i, s, t) for(int i = (s); i >= (t); i --)
template<typename T, typename T2>
inline void chmin(T &x, T2 &&y) { x = min(x, y); }
template<typename T, typename T2>
inline void chmax(T &x, T2 &&y) { x = max(x, y); }
typedef long long ll;

const int N = 4e7 + 5;
ll ans[N], h;

signed main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    ll x; cin >> x;
    rep(d, -2e7, 2e7)
    {
        ll n = (x - 1ll * d * d) / (2 * d - 1);
        if(n * n + n + x == (n + d) * (n + d))
            ans[++h] = n;
    }
    sort(ans + 1, ans + h + 1);
    h = unique(ans + 1, ans + h + 1) - ans - 1;
    cout << h << "\n"; rep(i, 1, h) cout << ans[i] << " ";

    return 0;
}

Submission Info

Submission Time
Task G - sqrt(n²+n+X)
User adam01
Language C++ 20 (gcc 12.2)
Score 575
Code Size 798 Byte
Status AC
Exec Time 117 ms
Memory 3640 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 116 ms 3392 KiB
00_sample_01.txt AC 117 ms 3392 KiB
00_sample_02.txt AC 116 ms 3636 KiB
01_handmade_00.txt AC 116 ms 3420 KiB
01_handmade_01.txt AC 116 ms 3440 KiB
01_handmade_02.txt AC 116 ms 3392 KiB
01_handmade_03.txt AC 116 ms 3624 KiB
01_handmade_04.txt AC 116 ms 3532 KiB
01_handmade_05.txt AC 116 ms 3500 KiB
01_handmade_06.txt AC 116 ms 3588 KiB
01_handmade_07.txt AC 116 ms 3480 KiB
01_handmade_08.txt AC 116 ms 3472 KiB
01_handmade_09.txt AC 116 ms 3392 KiB
01_handmade_10.txt AC 116 ms 3396 KiB
01_handmade_11.txt AC 116 ms 3524 KiB
01_handmade_12.txt AC 116 ms 3396 KiB
01_handmade_13.txt AC 116 ms 3640 KiB
01_handmade_14.txt AC 116 ms 3428 KiB
01_handmade_15.txt AC 116 ms 3476 KiB
01_handmade_16.txt AC 116 ms 3560 KiB
01_handmade_17.txt AC 116 ms 3384 KiB
01_handmade_18.txt AC 116 ms 3560 KiB
01_handmade_19.txt AC 116 ms 3528 KiB
01_handmade_20.txt AC 116 ms 3524 KiB
01_handmade_21.txt AC 116 ms 3388 KiB
01_handmade_22.txt AC 116 ms 3400 KiB
01_handmade_23.txt AC 116 ms 3528 KiB
01_handmade_24.txt AC 116 ms 3440 KiB
01_handmade_25.txt AC 116 ms 3524 KiB
01_handmade_26.txt AC 116 ms 3396 KiB
01_handmade_27.txt AC 116 ms 3528 KiB
01_handmade_28.txt AC 116 ms 3456 KiB
01_handmade_29.txt AC 116 ms 3348 KiB
01_handmade_30.txt AC 116 ms 3640 KiB
01_handmade_31.txt AC 116 ms 3532 KiB
01_handmade_32.txt AC 116 ms 3476 KiB
01_handmade_33.txt AC 116 ms 3528 KiB
01_handmade_34.txt AC 116 ms 3460 KiB
01_handmade_35.txt AC 116 ms 3456 KiB
01_handmade_36.txt AC 116 ms 3564 KiB
01_handmade_37.txt AC 116 ms 3532 KiB
01_handmade_38.txt AC 116 ms 3428 KiB
01_handmade_39.txt AC 116 ms 3448 KiB
01_handmade_40.txt AC 116 ms 3388 KiB
01_handmade_41.txt AC 116 ms 3436 KiB
01_handmade_42.txt AC 116 ms 3472 KiB
01_handmade_43.txt AC 116 ms 3524 KiB
01_handmade_44.txt AC 116 ms 3456 KiB
01_handmade_45.txt AC 116 ms 3528 KiB
01_handmade_46.txt AC 116 ms 3516 KiB
01_handmade_47.txt AC 116 ms 3560 KiB
01_handmade_48.txt AC 116 ms 3424 KiB
01_handmade_49.txt AC 117 ms 3448 KiB
02_radom_00.txt AC 116 ms 3560 KiB
02_radom_01.txt AC 116 ms 3520 KiB
02_radom_02.txt AC 116 ms 3528 KiB
02_radom_03.txt AC 116 ms 3420 KiB
02_radom_04.txt AC 116 ms 3468 KiB
02_radom_05.txt AC 116 ms 3564 KiB
02_radom_06.txt AC 116 ms 3524 KiB
02_radom_07.txt AC 116 ms 3524 KiB
02_radom_08.txt AC 116 ms 3400 KiB
02_radom_09.txt AC 116 ms 3560 KiB