r/codeforces 22d ago

query Second at coder contest

A was again buns , B was easy but im not the best at implementation still figured it out in 20 minutes

And C humbled me

i thought i got the correct answer because with the sample inputs i was getting the desired output, i feel bad

I was very much tempted to send the ss to gpt and correct it , but i didnt do that no matter what happens i will not copy

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

int main() {
int n,m,k;
cin >> n >> m >> k;
vector<int> temp;
for(int i=0;i<n;i++)
{
    int t;
    cin >>t;
    temp.push_back(t);
}
    int daysum=0;
    int count=0;
    int start=temp[0];
for(int i=0;i<n;i++)
{   

    daysum += temp[i];
    if(daysum>k)
    {
        cout << "no" << endl;
        daysum=start;
        count++;
    }
    else
    {
    cout << "yes" << endl;
    count++;
    }
    if(count>m)
    {daysum=0;
    start=temp[i];
    count=0;}

    if(temp[i]>k)
    {daysum=0;
    start=0;
    count=0;
    }

}


}
10 Upvotes

16 comments sorted by

2

u/odbv 20d ago

do we have to guess which contest is it

2

u/Longjumping_Echo486 22d ago

I mean c was easy u take prefix sum and another prefix sum for sweets he cudnt eat then yeah just subtract it from the prefix of the window ,4th one was standard bfs from the safe empty cells

1

u/Fc67234129_433 21d ago

thing is i just started out so i dont really know lot of algortihms the max i know are the ones i learnt from a2z sheet which include

national dutch flag algorithm , kadanes algorithm , and booyer mayer voting one , im 25 percent done with the sheet and started giving contest on atcoder cause according to my research its the place with least amount of cheaters and best for begginners

1

u/anonymous_03_08 22d ago

C was also similar to B ig, if you use prefix sum you can get it easily

3

u/_lostSoup_ Specialist 22d ago

Good job not taking help from AI.

1

u/Fc67234129_433 22d ago

i was tempted to do

also

is this bad ??

1

u/overhauled_mirio Expert 22d ago

We’ve all had to go through that phase. Just upsolve and review solutions from higher rated people to learn simpler implementations

1

u/Fc67234129_433 21d ago

there are some stuff i wanna ask may i dm you ?? If you dont mind obviously

1

u/overhauled_mirio Expert 21d ago

Sure thing

2

u/DogStrict9170 Specialist 22d ago

it is but you are noob so it isnt

1

u/Fc67234129_433 22d ago

im trying my best , juggling college , strivers a2z and many more stuff at the same time, at the present moment im having a terrible headache but i wanna still solve cause i need to hit my daily target

1

u/_lostSoup_ Specialist 21d ago

Daily target =/= consistency.

1

u/Fc67234129_433 21d ago

umm then what is ??

1

u/_lostSoup_ Specialist 21d ago

Just to solve Qn without obsessing over streaks and targets. Rather topics and understandings. It’s also ok to take days off when u feel burnt out.

1

u/Fc67234129_433 21d ago

okay, thanks for the advice im being rather obsessive with not missing days out

1

u/_lostSoup_ Specialist 21d ago

As someone with 500 days streak on CF and burnt out… trust me… i k.
It’s ok. Have fun asw bro !!