Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

Cheaters Exposed | Codeforces Round 958 (Div. 2) | Cheat Patrol
Difference between en2 and en3, changed 19 character(s)
[contest:1994]↵

I would like to thank the entire **Cheat Patrol** team for exposing cheaters.↵
Special thanks to [user:Vladosiya,2024-07-12] for actively helping us in the server and taking actions on convicted cheaters↵

If you are interested in volunteering us in exposing cheaters.↵
You can join our **Cheat Patrol** server : [Cheat Patrol Discord Server](https://discord.com/invite/kKZhfAWKfE)↵

### Leaked Solution of A:↵

<spoiler summary="A Leak ">↵

~~~~~↵
void solve(){↵
    int numElements, maxSplit;↵
    cin>>numElements>>maxSplit;↵

    vector<int> elementSequence;↵
    elementSequence.push_back(numElements);↵

    int splitCount=0;↵
    while(elementSequence.size() < numElements)↵
    {↵
        int currentElement=elementSequence.back();↵
        elementSequence.erase(elementSequence.begin()+elementSequence.size()-1);↵
        for(int i=0;i<min(maxSplit-1,currentElement-1);i++)↵
        {↵
            elementSequence.push_back(1);↵
        }↵
        elementSequence.push_back(currentElement-maxSplit+1);↵
        splitCount++;↵
    }↵

    cout<<splitCount<<endl;↵
}↵
~~~~~↵

</spoiler>↵



### Leaked Solution of B:↵

<spoiler summary="B Leak">↵

~~~~~↵
void solve() {↵
    int n;↵
    cin >> n;↵
    string s;↵
    cin >> s;↵
    vector<int> v;↵
    char prev = '1';↵
    for (int i = 0; i < n; i++) {↵
        if (s[i] == '1') v.push_back(1);↵
        if (s[i] == '0' && prev == '1') v.push_back(0);↵
        prev = s[i];↵
    }↵
    int n0 = 0, n1 = 0;↵
    for (int i = 0; i < v.size(); i++) {↵
        if (v[i] == 1) n1++;↵
        else n0++;↵
    }↵
    if (n0 >= n1) cout << "NO" << endl;↵
    else cout << "YES" << endl;↵
~~~~~↵


</spoiler>↵





### Leaked Solution of C:↵

<spoiler summary="C Leak ">↵

~~~~~↵
#include <bits/stdc++.h>↵
using namespace std;↵
#define ll long long↵

void process_subsegments() {↵
    ll num_elements, max_sum;↵
    cin >> num_elements >> max_sum;↵
    ll elements_array[num_elements], prefix_sum_array[num_elements + 1] = {0}, dynamic_programming_array[num_elements + 3] = {0};↵
    ↵
    // Read elements array↵
    for (ll i = 0; i < num_elements; ++i) {↵
        cin >> elements_array[i];↵
        prefix_sum_array[i + 1] = prefix_sum_array[i] + elements_array[i];↵
    }↵
    ↵
    ll total_valid_subsegments = 0;↵
    ↵
    // Process subsegments in reverse order↵
    for (ll i = num_elements - 1; i >= 0; --i) {↵
        ll target_sum = prefix_sum_array[i] + max_sum;↵
        ↵
        // Find the lower bound of the target sum in the prefix sum array↵
        auto lower_bound_index = lower_bound(prefix_sum_array, prefix_sum_array + num_elements + 1, target_sum) - prefix_sum_array;↵
        ↵
        // Calculate the number of valid subsegments↵
        if (lower_bound_index == num_elements + 1)↵
            dynamic_programming_array[i] += (num_elements - i);↵
        else if (target_sum == prefix_sum_array[lower_bound_index])↵
            dynamic_programming_array[i] += (lower_bound_index - i) + dynamic_programming_array[lower_bound_index + 1];↵
        else↵
            dynamic_programming_array[i] += (lower_bound_index - i - 1) + dynamic_programming_array[lower_bound_index];↵
    }↵
    ↵
    // Calculate the total number of valid subsegments↵
    for (ll i = 0; i < num_elements + 3; ++i) {↵
        total_valid_subsegments += dynamic_programming_array[i];↵
    }↵
    ↵
    cout << total_valid_subsegments << endl;↵
}↵

int main() {↵
    ll test_cases = 1;↵
    cin >> test_cases;↵
    ↵
    while (test_cases--) {↵
        process_subsegments();↵
    }↵
    ↵
    return 0;↵
}↵
~~~~~↵


</spoiler>↵


### List of Cheater for Reported in Community:↵
You can join our **Cheat Patrol** server 
to report Cheaters : [Cheat Patrol Discord Server](https://discord.com/invite/kKZhfAWKfE)↵

<spoiler summary="B Cheaters">↵

</spoiler>↵




I would like to request [user:MikeMirzayanov,2024-07-15] and [user:244mhq,2024-07-15]  [user:MikeMirzayanov,2024-07-16] to take actions on the cheaters as well people who are leaking the solutions.↵

Here is the drive link : [Leaked Solution Drive](https://drive.google.com/drive/u/0/folders/1xC54OIi1zCoonwspEA5DJZ7QR8BLqtnv)↵
Anyone with this code has just copied from here .↵

**Disclaimer:** The IDs mentioned here are potential cheaters. There's a very low yet non zero chance that some innocent account gets mentioned here. In that case no need to complain in the comments/dm. You won't get skipped if u have not cheated.↵

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en9 English contest_exposer 2024-07-22 19:59:15 127
en8 English contest_exposer 2024-07-22 19:45:30 63
en7 English contest_exposer 2024-07-22 19:44:15 4 Tiny change: 'of the big cheating ' -> 'of the biggest cheating '
en6 English contest_exposer 2024-07-22 19:42:43 255
en5 English contest_exposer 2024-07-22 19:40:59 199
en4 English contest_exposer 2024-07-22 19:37:50 6
en3 English contest_exposer 2024-07-22 19:36:16 19 Tiny change: '** server : [Cheat ' -> '** server to report Cheaters : [Cheat ' (published)
en2 English contest_exposer 2024-07-22 19:35:32 916 (saved to drafts)
en1 English contest_exposer 2024-07-22 19:34:36 5434 Initial revision (published)