"I want to ask a question" - Ask them all here!

Problem : Neil And Arrays Neil is a CSE guy and loves arrays.One day he found an interesting challenge on arrays and he needs your help.Given an array… Make another array a such that 1<=a[i]<=b[i], where b is the given array. Let S= sum of abs(a[i]-a[i-1]) for all i=2 to n You need to find the maximum possible value of S and print it on stdout.

InputFormat: First line containing an integer T, number of TestCases. Each Testcase contains two lines.On the First line N, number of elements in array b.Second line contains the array b.

Constrains: 1<=T<=20 1<=n<=10^5 1<=element in array<=1000

OutputFormat: maximum possible value of S

Sample Input: 1 5 5 10 15 20 25

Explanation: A=[1,10,1,20,1]

Sample Output: 56

How to approach this question?

1 Like

about the 100% attendance ladoos, do i strictly need to participate in 36 rated contests(if some of them over a 12 month period are cancelled) or i just need to participate in all the three monthly rated contests and it doesn’t matter if they are cancelled or unrated, at the end of 12 month period i will still receive codechef ladoos

1 Like

Why my solution to google codejam 2018 qualification round’s first problem failed for test set 2

I am a beginer in the competitive programming. I have participated in the google codejam this year for the first time. My solution to the first problem(Saving the Universe Again) passed test set 1 but failed for test set 2. According to analysis given in the codejam contest site it seemed correct to me and should pass for test set 2 too. Can’t understand why it was failed. Will be grateful if someone point out my error or point out what would be the best solution to this. Here is my solution to the problem.

Thanks.

1 Like

Codechef is dropping my rating twice for violating its code of conduct once in November 2014
Details :
In November 2014, me and my friend submitted the same code in long challenge [we did not do it deliberatly].
Me and my friend received the an email from Codechef after some time about this. The mail read following…
We have dropped the ratings and disqualified all the submissions of your account on grounds of using false practice during November Challenge 2014
And some other stuff about code of conduct. I had received this email on 19th November 2014, and my ratings were dropped[you can cross check that my going to my profile] and all my submissions for that contest were removed.
Now today I got another email from Codechef which is again talking about dropping my rating on the basis of NOV14 long challenge act. The mail reads following…
We will be dropping your ratings on grounds of using false practice during CodeChef’s rated contest/s. We found few of your codes similar with one another user. You should have got the email regarding the same after the MOSS process. Here are the contest/s in which we found your solutions same: NOV14

I think I am being penalised twice for the same violation. Can some one help me here.

1 Like

not able to comment

1 Like

is there any library in c++/python/numpy which has inbuilt methods for solving simultaneous linear equations like gauss elimination??

finally,I am doing my first comment on codechef for a long time I tried a lot to upvote and asking question but there was something wrong.whatever,now I am happy.
I know that this is not the right place to show my happiness but i can’t stop myself to wright here.
so,sorry for all about what I am writing here.

1 Like

I am basically getting wrong answer for my code even if all the outputs are right in the compiler. The question is DSPC305 Problem - CodeChef. I don’t know where i’m going wrong. Help a fellow beginner please. I used C (gcc 6.3)

 #include<stdio.h>
 #include<math.h>

 int main()
{

float x,y,a,b,C,c,r,s,xnew,ynew,p,q;

scanf("%f", &C);
scanf("%f %f", &x, &y);
scanf("%f %f %f" , &a, &b, &c);
scanf("%f %f", &r, &s);

float theta = atan(b/a);

if (C==1)
{
     xnew = (x-r) * cos(theta) + (y-s) * sin(theta);
     ynew = -(x-r) * sin(theta) + (y-s) * cos(theta);
     p=xnew +r;
     q=ynew +s;
     int var2 = (int) p;
     int var3 = (int) q;
     printf("%d %d\n", var2,var3);
}

if (C==0)
{
     xnew =( (x-r) * (cos(theta)) - (y-s) * sin(theta));
     ynew =( (x-r) * (sin(theta)) + (y-s) * cos(theta));
     p=xnew +r;
     q=ynew +s;
     int var2 = (int) p;
     int var3 = (int) q;
     printf("%d %d\n", var2,var3);
}
return 0;

}

1 Like

I was looking about the laddus rewarding system. I’m a school student and I was wondering if I could be in the top 3 of the Indian school participants then I could get 100 laddus for that. If I manage to be in the top 3 of the challenge scores then I should be able to get 100 + 150 = 250 laddus. But there is an exception that the person who is in top 3 of the challenge scores should not be a winner. Who exactly is a “winner” here? The person who have won div 1 or the one who has won div 2?

Also, what if there are more than 3 Indian school participants who are at same score and have same rank and are at top of the ranklist among Indian school participants, which 3 would get 100 laddus?

Indirectly, I want to ask who gets how many laddus would these get:

  1. Div 2 Indian winner (obviously have highest challenge score)?
  2. Div 2 India top 3 + top 3 challenge scores?
  3. Div 2 India top 3 + top 3 challenge scores (but highest among Indian)?
1 Like

same code

https://www.codechef.com/viewsolution/18871603

@rajeevbaditha

https://www.codechef.com/viewsolution/18871498

@sumit083

This link is not working: A Learning Module for Beginners

I’ve been using this link for a long time, and all of a sudden it stopped working. It’s been giving a 500 server error since yesterday. Please fix it @admin.

Need karma

Can someone please help me with this problem from recent codeforces contest ? http://codeforces.com/contest/1016/problem/C.

I am not able to understand the DP approach which is used here.

Any help would be appreciated. Thanks.

Question Link:- CIELAB Problem - CodeChef

can someOne tell why it is giving wrong error ? I tried all the test cases from my side can u guys find any problem in my Code …
Scanner z = new Scanner(System.in);

	int a=z.nextInt();
	int b=z.nextInt();
	int c=a-b;
	int d=c%10;
	 
	 if(d==0)
		 System.out.println(c+1);
	 else
		 System.out.println(c-1);

WHY am I getting this error in my java code ? It works fine on my system but when I submit it at your IDE in codechef I keep etting this same error. It’s quite frustrating as I been trying to look up for its solution for about 2 hours.

spoj: The program compiled successfully, but main class was not found.
Main class should contain method: public static void main (String[] args).
CODE:=

import java.util.;
import java.io.
;
public class Main
{
public static int main(String[] args)
{
Scanner sc = new Scanner(System.in);
int t,count;
int n;
int a[],b[];
int ans=0;
t= sc.nextInt();
for(count =0;count<t;count++)
{
n= sc.nextInt();
a= new int[n];
b = new int[n];
for(count=1;count<=a.length;count++)
{
a[count] = sc.nextInt();
}
for(count=1;count<=b.length;count++)
{
b[count]=sc.nextInt();
}
for(count=1;count<=b.length;count++)
{
if(b[count]<=(a[count]-a[count-1]))
{
ans+=1;
}
}
System.out.println(ans);
}
return(0);
}
}

@Vijju I have made payment for a regional using UPI ( using online app ) even though NEFT was mentioned by mistake .What can I do ? It is not begin accepted from 4-5 days now ?

Users are requested to give their views as COMMENTS to this question.

Only questions should be posted in this thread (to keep it clean)

Pretty cool idea

2 Likes

I think it will be better as a community wiki.

2 Likes

If you feel so. :slight_smile: . BTW, now i can also see the revision history :stuck_out_tongue: