/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 19ms 532.0 KiB
#3 Accepted 52ms 680.0 KiB
#4 Accepted 50ms 752.0 KiB

Code

#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define pb push_back
#define pf push_front
#define mp make_pair
#define eb emplace_back
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define here cout<<"HERE !!!"<<endl;
#define sz(v) (ll)v.size()
#define vi vector<ll>
#define print(v) for (auto it : v) cout << it << " "; cout << endl;
#define all(v) v.begin(), v.end()
#define i128 __int128
#define read(v) for(auto &it:v) cin>>it;
#define Faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace  __gnu_pbds;

#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
const long double pi = acos(-1.0l);
const ll inf = 4e18;
const int mod = 998244353, mx = 1e5 + 100;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll my_rand(ll l, ll r)
{
    return uniform_int_distribution<ll>(l, r)(rng);
}
//rotate(v.begin(), v.begin() + d, v.end());
//order_of_key(k): number of element less than k
//find_by_order(k): k-th element in set start from 0
ll ispossible(ll x, ll val)
{
    ll p = x * x + 3 * x - 2 * val;
    return p;
}
void ravana(ll idx)
{
    ll n;   cin >> n;
    ll l = 1, r = 6e8;
    while (l <= r)
    {
        ll mid = (l + r) / 2;
        if (ispossible(mid, n) == 0)
        {
            cout << "b" << endl;
            return;
        }
        if (ispossible(mid, n) < 0)
        {
            l = mid + 1;
        }
        else
        {
            r = mid - 1;
        }
    }
    if (ispossible(l, n) == 0)
    {
        cout << "b" << endl;
    }
    else
    {
        cout << "a" << endl;
    }
}
signed main()
{
    auto begin = std::chrono::high_resolution_clock::now();
    Faster;
    ll t = 1;
    cin >> t;
    for (ll i = 1; i <= t; ++i)
    {
        ravana(i);
    }
    auto end = std::chrono::high_resolution_clock::now();
    auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
    cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n";
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1223 C. Infinity Sequence
Contest
Happy New Year 2026
Language
C++17 (G++ 13.2.0)
Submit At
2026-01-06 15:59:33
Judged At
2026-01-06 15:59:34
Judged By
Score
100
Total Time
52ms
Peak Memory
752.0 KiB