Can anyone tell me why my solution for problem LRQUER from november lunchtime is giving wrong answer on subtask #2 but correct answer on subtasks #1 and #3. https://www.codechef.com/viewsolution/16377252
How to calculate revenue in business ? Please explain it through example.
plzz upvote me i want to ask questions!!
Had you asked this in any other thread, you would have received a ban. Ask your questions here, karma begging is NOT allowed. We are strict here.
Can you please reword it in a way that it feels more relevant? Like, how is your question relevant to the coding community? I cannot get that.
if possible please clear my doubt : https://discuss.codechef.com/questions/118737/help-in-understanding-strongly-connected-component-in-graphs
When I run this Prime generator it works fine , but when i give range for prime’s as 1 to 10000000 it stops working and everything crashes !
I recently learned Sieve of Eratosthenes and is implementation of it.
Please help. I find this Karma system bad for newbies like me and would appreciate any help. Thanks in advance.
#include <iostream>
#include<stdio.h>
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{ ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
scanf("%d",&t);
while(t--)
{
long long int m,n;
scanf("%lld %lld",&m,&n);
//Sieve
bool prime[n+1];
prime[0]=false;
prime[1]=false;
for(ll i=2;i<=n;i++)
prime[i] = true;
for(ll i=2; i*i<= n;i++)
{
if(prime[i])
{
for(ll j=i*2;j<=n;j+=i)
prime[j]=false;
}
}
// Printing
for(ll z=m;z<=n;z++)
{
if(prime[z])
printf("%lld\n",z);
}
}
return 0;
}
I find this Karma system bad for newbies like me and would appreciate any help.
Its there for a reason. Because some questions are repetitive, some just shouting “GOOGLE ME” which are asked by newbies. At one point @admin did remove the 1 karma thing and quality of threads deteriorated exponentially.
Your question is also repetitive. I assume you are running it on local machine. You cannot declare an array of size as big as {10}^{7} on your local machine. The best you can do is trying to declare that array globally. Many problems restrict themselves at {10}^{6} for this reason,
Ok, thanks. I did not know that there is a limit on array size. It’s only when you ask questions do you learn things.
Why are solutions of ZCO practice contest of other coders are visible??
Is it because it’s a practice contest??
They announced this on FB page- The solutions are visible until INOI I guess.
can someone explain with an example the use of upper_bound() and lower_bound() functions(as used in solving binary search problems)??
Lets say our array is {1,2,6].
Now-
upper_bound(5)=lower_bound(5)=6;
If array is {1,2,5,6}.
Upper_bound(5)=6, lower_bound(5)=5.
Upper bound = return element >x, lower bound = return element >=x;
Upper bound = return smallest element >x, lower bound = return smallest element >=x;
And also it works only if the array is sorted in ascending order.
I assume he at least know and has read through the basics and just needs an example illustrating them.
thanks for answering and it helped my solution finally got accepted with 100pts.
While using Codechef IDE, I noticed a bug. If a line is selected and Ctrl + /
is pressed then, in general for other languages (I checked for C, C++ 6.3, C++ 17, PYTH, PYTH 3.5) the lines get commented out. But for PYPY, just a //
is put before the lines, which is definitely not commenting out in case of PYPY.
Can you please check this and inform @admin if it is truly a bug (in case she does not notice).
Thanks.
Reported the issue. Thank you.
Reported the issue. Thank you.
Hi, Now I think that there’s some issue with the question as when I copy pasted the official solution and submitted, it got TLE as well. I am doing this to complete my A2OJ ladder, is there any other way I can get around this?