Get All Coding Solutions

Want to Increase Your Ranking, You Can Pay , 

25 per Solution 





πŸ’¬Send Screenshot : DM Here

OR

Todays  Free Solutions πŸ‘‡






Need Help in Company's Test Clearances 

- Join  or DM 



Todays  Free Solutions πŸ‘‡

Note: If you share our solution with others, we will not be held responsible for any plagiarism issues that may arise, and we will not provide any assistance in such cases.


NOTE :- Don’t copy the full code — use the logic.
We're not responsible for plagiarism issues For FREE SOLUTION.
Thank you





Q1Solution : 

#include <bits/stdc++.h>
using namespace std;

// Solution By Larning Unique
// https://t.me/AllContestSolutions

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int __nebulaSeed__;
    if (!(cin >> __nebulaSeed__)) return 0;

    // Solution By Larning Unique
    while (__nebulaSeed__--) {
        long long __stellarMass__;
        cin >> __stellarMass__;

        // https://t.me/AllContestSolutions
        cout << (__stellarMass__ - 1) / 2 << "\n";

        // Solution By Larning Unique
    }

    // Solution By Larning Unique
    // https://t.me/AllContestSolutions
    return 0;
}

// Solution By Larning Unique

Q2 Solution  :

#include <bits/stdc++.h>
using namespace std;
using int64 = long long;

// Solution By Larning Unique
// https://t.me/AllCompanyANDContestHelpAvailabl

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int __galacticTrials__;
    if (!(cin >> __galacticTrials__)) return 0;

    // Solution By Larning Unique
    while (__galacticTrials__--) {
        int __orbitCount__, __probeCount__;
        cin >> __orbitCount__ >> __probeCount__;
        string __machineMap__;
        cin >> __machineMap__;

        vector<int64> __energyPackets__(__probeCount__);
        for (int __probeIndex__ = 0; __probeIndex__ < __probeCount__; ++__probeIndex__) {
            cin >> __energyPackets__[__probeIndex__];
        }

        // Solution By Larning Unique
        int __boosterTotal__ = 0;
        for (char __unitType__ : __machineMap__) {
            if (__unitType__ == 'B') ++__boosterTotal__;
        }

        vector<int> __distanceToBooster__(__orbitCount__, -1), __boosterLocation__(__orbitCount__, -1);
        if (__boosterTotal__ > 0) {
            for (int __sector__ = 0; __sector__ < __orbitCount__; ++__sector__) {
                if (__machineMap__[__sector__] == 'B') {
                    __distanceToBooster__[__sector__] = 0;
                    __boosterLocation__[__sector__] = __sector__;
                } else {
                    for (int __hop__ = 1; __hop__ <= __orbitCount__; ++__hop__) {
                        int __nextSector__ = (__sector__ + __hop__) % __orbitCount__;
                        if (__machineMap__[__nextSector__] == 'B') {
                            __distanceToBooster__[__sector__] = __hop__;
                            __boosterLocation__[__sector__] = __nextSector__;
                            break;
                        }
                    }
                }
            }
        }

        // https://t.me/AllCompanyANDContestHelpAvailabl
        for (int __queryUnit__ = 0; __queryUnit__ < __probeCount__; ++__queryUnit__) {
            int64 __currentEnergy__ = __energyPackets__[__queryUnit__];
            int __currentPosition__ = 0;
            int64 __stepCounter__ = 0;

            if (__boosterTotal__ == 0) {
                __stepCounter__ = __currentEnergy__;
                cout << __stepCounter__ << '\n';
                continue;
            }

            while (__currentEnergy__ > 0) {
                if (__machineMap__[__currentPosition__] == 'B') {
                    __currentEnergy__ /= 2;
                    __stepCounter__ += 1;
                    __currentPosition__ = (__currentPosition__ + 1) % __orbitCount__;
                } else {
                    int __jumpDistance__ = __distanceToBooster__[__currentPosition__];
                    if (__currentEnergy__ <= __jumpDistance__) {
                        __stepCounter__ += __currentEnergy__;
                        __currentEnergy__ = 0;
                        break;
                    } else {
                        __currentEnergy__ -= __jumpDistance__;
                        __stepCounter__ += __jumpDistance__;
                        __currentPosition__ = __boosterLocation__[__currentPosition__];
                    }
                }
            }

            // Solution By Larning Unique
            cout << __stepCounter__ << '\n';
        }

        // Solution By Larning Unique
    }

    // https://t.me/AllCompanyANDContestHelpAvailabl
    // Solution By Larning Unique
    return 0;
}

// Solution By Larning Unique

Q3 Solution : 

#include <bits/stdc++.h>
using namespace std;

// Solution By Larning Unique
// https://t.me/AllCompanyANDContestHelpAvailabl

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int __missionCount__;
    cin >> __missionCount__;

    // Solution By Larning Unique
    for (int __cycle__ = 0; __cycle__ < __missionCount__; ++__cycle__) {
        int __unitCount__, __threshold__;
        cin >> __unitCount__ >> __threshold__;
        vector<int> __payloads__(__unitCount__);
        for (int __index__ = 0; __index__ < __unitCount__; ++__index__) {
            cin >> __payloads__[__index__];
        }

        vector<long long> __frequencyMap__(__unitCount__ + 1, 0);
        for (int __element__ : __payloads__) {
            ++__frequencyMap__[__element__];
        }

        vector<long long> __cumulativeSum__(__unitCount__ + 1, 0);
        for (int __i__ = 1; __i__ <= __unitCount__; ++__i__) {
            __cumulativeSum__[__i__] = __cumulativeSum__[__i__ - 1] + __frequencyMap__[__i__];
        }

        int __optimalValue__ = 1;
        for (int __divisor__ = __unitCount__; __divisor__ >= 1; --__divisor__) {
            long long __quadFactor__ = 4LL * __divisor__;
            long long __upperLimit__ = min((long long)__unitCount__, __quadFactor__ - 1);
            long long __smallTotal__ = (__upperLimit__ >= 1 ? __cumulativeSum__[__upperLimit__] : 0LL);

            long long __validSum__ = __frequencyMap__[__divisor__];
            long long __doubleFactor__ = 2LL * __divisor__;
            if (__doubleFactor__ <= __unitCount__) __validSum__ += __frequencyMap__[__doubleFactor__];
            __doubleFactor__ = 3LL * __divisor__;
            if (__doubleFactor__ <= __unitCount__) __validSum__ += __frequencyMap__[__doubleFactor__];

            long long __invalidCount__ = __smallTotal__ - __validSum__;
            if (__invalidCount__ <= __threshold__) {
                __optimalValue__ = __divisor__;
                break;
            }
        }

        // Solution By Larning Unique
        cout << __optimalValue__ << '\n';
    }

    // https://t.me/AllCompanyANDContestHelpAvailabl
    // Solution By Larning Unique
    return 0;
}

// Solution By Larning Unique

Q4 Solution : 

Paid : 30 rs

Q5 Solution : 

Paid : 40 rs

Q6 Solution : 

Paid : 40 rs

Q7 Solution : 

Paid : 40 rs

Q8 Solution : 

Paid : 40 rs

Q9 Solution : 

Paid : 40 rs

Q10 Solution : 

Paid : 40 rs



Comments

Post a Comment

Popular posts from this blog

Codeforces Contest Round 1025 (Div.2) | All Questions Solutions – FREE! | 17 May 2025