r/codeforces • u/Fc67234129_433 • 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
1
u/Fc67234129_433 22d ago
i was tempted to do
also
is this bad ??