/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 215ms 736.0 KiB
#3 Time Exceeded ≥1095ms ≥564.0 KiB
#4 Time Exceeded ≥1098ms ≥532.0 KiB

Code

// Author: Shawn Das Shachin-->(shawn_das)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb push_back
#define mod 1000000007
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(),v.rend())
#define OPTIMIZE_IO ios::sync_with_stdio(false); cin.tie(nullptr);

void solve() {
    ll k;
    cin >> k;

    ll block = 1;       
    ll cum_len = 2;     

    while (cum_len < k) {
        block++;
        cum_len += (block + 1);
    }

    ll prev_cum_len = cum_len - (block + 1);
    ll pos_in_block = k - prev_cum_len;

    if (pos_in_block <= block)
        cout << 'a' << endl;
    else
        cout << 'b' << endl;
}

int main() {
    OPTIMIZE_IO;

    int t;
    cin >> t;
    while (t--) {
        solve();
    }

    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 16:48:45
Judged At
2026-01-06 16:48:45
Judged By
Score
20
Total Time
≥1098ms
Peak Memory
≥736.0 KiB