You are not logged in. Please login at www.codechef.com to post your questions!

×

How to test my answer perfectly ?

I am getting correct answer for my code. But it still gives WA on submitting. Can you suggest the test case for which my code may fail.

asked 03 Sep '12, 13:16

vaibhav_ag's gravatar image

3★vaibhav_ag
1111
accept rate: 0%


problem:ChefTown code:

include<stdio.h>

int a[400002]; int max(int,int); int main() { int n,w,maxp,p,q,count=0,i; long long int sum=0; scanf("%d",&n); scanf("%d",&w); for(i=0;i<n;i++) {="" scanf("%d",&a[i]);="" }="" for(i="0;i&lt;w;i++)" sum+="a[i];" maxp="max(0,w);" p="a[0];" for(i="0;i&lt;=n-w;i++)" {="" if(sum="=(w*(w+1))/2+(w*(maxp-w)))" count++;="" if(i!="(n-w))" {="" sum="sum+a[i+w]-p;" if(a[i+w]="">maxp) maxp=a[i+w]; else if(p==maxp) maxp=max(i+1,w+i+1); p=a[i+1];

    }
}
printf("%d",count);
return 0;

} max(j,w){ int max=0,i; for(i=j;i<w+j;i++) {="" if(a[i]="">max) max=a[i]; } return max; }

link

answered 03 Sep '12, 13:17

vaibhav_ag's gravatar image

3★vaibhav_ag
1111
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×2,321

question asked: 03 Sep '12, 13:16

question was seen: 1,185 times

last updated: 03 Sep '12, 13:17