Submission #1299199

#TimeUsernameProblemLanguageResultExecution timeMemory
1299199tabEsej (COCI15_esej)C++20
16 / 80
8 ms4864 KiB
#include "bits/stdc++.h"
using namespace std;
#define intt int
#define fi first
#define se second

const intt mxN = 1e5 + 5;
const intt LG = 20;
const intt inf = 1e18;  
const intt mod = 10007;

intt A, B, sz = 1;
vector<string> v;

void _() {
    cin >> A >> B;
    char last = 'a';
    while(v.size() <= B) {
        if(v.size() >= B/2) {
            while(v.size() < A) {
                v.push_back("a");
            }
            break;
        }

        intt f = 0;
        if(sz == 1) {
            for(char c = 'a'; c <= 'z'; c++) {
                string app="";
                app += c;
                v.push_back(app);
                if(v.size() >= A && v.size() <= B) {
                    f = 1;
                    break;
                }
            }
            ++sz;
            if(f) break;
            continue;
        }

        char tempp = 'a';
        intt szz = sz;
        string temp="";
        while(szz!=0){
            temp+=tempp;
            tempp++;
            --szz;
        } 
        v.push_back(temp);
        for(char fir = 'b'; fir <= 'z'; fir++) {
            string app="";
            app += fir;
            tempp = 'a';
            while(app.size() != sz) {
                app += tempp;
                ++tempp;
            }
            v.push_back(app);
            if(v.size() >= A && v.size() <= B) {
                f = 1;
                break;
            }
            if(v.size() >= B / 2) {
                break;
            }
        }
        if(f)break;
        if(sz != 15) ++sz;
        else break;
    }

    intt idx = 0;
    while(v.size() < A) {
        if(v[idx] != "bab") {
            string b = v[idx];
            reverse(b.begin(), b.end());
            v.push_back(b);
        }
        ++idx;
    }
    for(auto u : v) {
        cout << u << " ";
    } 
    cout << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    intt t = 1, buu = 1;
    // cin >> t;
    while(t--){
        // cout << "Case #" << buu++ << ": ";
        _();
    }
}

Compilation message (stderr)

esej.cpp:9:18: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
    9 | const intt inf = 1e18;
      |                  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...