Search found 49 matches

by richatibrewal
Wed Jan 14, 2015 2:13 pm
Forum: Volume 101 (10100-10199)
Topic: 10131 - Is Bigger Smarter?
Replies: 93
Views: 63786

Re: 10131 - Is Bigger Smarter?

It is written that :
There may be many correct outputs for a given input, your program only needs to find one.
So, its not necessary to get the same output as that given in the judge's sample output
by richatibrewal
Tue Jan 13, 2015 5:43 pm
Forum: Volume 101 (10100-10199)
Topic: 10131 - Is Bigger Smarter?
Replies: 93
Views: 63786

Why WA?

I am getting WA for the following code. Plz tell me the mistake. #include<algorithm> #include<cstdio> using namespace std; int w[2000],p[2000],m[2000],m_id[2000],in[2000],index[2000]; void print(int end) { if(end<0) return; printf("%d\n",index[end]); print(p[end]); } int main() { int i=0,pos,l,l_end...
by richatibrewal
Sat Jan 10, 2015 11:43 am
Forum: Volume 4 (400-499)
Topic: 497 - Strategic Defense Initiative
Replies: 144
Views: 20554

Why WA?

I am continuously getting WA for this problem. I am using the algorithm of time complexity O(nlogk). Following is my code: #include<cstdio> #include<algorithm> #include<cstring> using namespace std; int m[100000],m_id[100000],p[100000],a[100000]; char str[10]; void print(int end) { if(end<0) return;...
by richatibrewal
Sat Jan 03, 2015 8:41 pm
Forum: Volume 5 (500-599)
Topic: 507 - Jill Rides Again
Replies: 92
Views: 29317

Re: 507 - Jill Rides Again

I have tried the output for all the sample input i could get and it is giving me the reqired output. If not , plz give me the input for which the output is wrong
by richatibrewal
Fri Jan 02, 2015 1:37 pm
Forum: Volume 5 (500-599)
Topic: 507 - Jill Rides Again
Replies: 92
Views: 29317

507 - Jill Rides Again Run Time Error

I am getting run time error for this problem . Plz help. Here is my code #include<cstdio> using namespace std; void find_sum(int n,long long int arr[],int c) { int i,j,k,len,a,b; long long int sum[n+1][n+1],maxlen; maxlen=-1; for(i=1;i<n;i++) { sum[i][i+1]=arr[i]; if(arr[i]>maxlen) { maxlen=arr[i]; ...
by richatibrewal
Sat Dec 20, 2014 5:32 pm
Forum: Volume 8 (800-899)
Topic: 884 - Factorial Factors
Replies: 49
Views: 26325

Not getting the required output

I am not getting the required output. Plz tell me what is the problem with the code? #include<cstdio> #include<cmath> #include<vector> #define MAXLEN 1000010 using namespace std; int mark[MAXLEN]; vector<int> prime; void sieve() { int i,j,p; p=(float)pow(MAXLEN,0.5); for(i=0;i<MAXLEN;i++) mark[i]=1;...
by richatibrewal
Thu Dec 18, 2014 2:34 pm
Forum: Volume 106 (10600-10699)
Topic: 10680 - LCM
Replies: 38
Views: 12277

Why TLE??

I am getting TLE for the following code: #include<cstdio> #include<cmath> #include<vector> #define max 1000000 using namespace std; bool mark[max+10]; vector<int> prime; void sieve() { int i,j,p; for(i=2;i<=max+10;i++) mark[i]=true; p=(float)pow(max+10,0.5); for(i=2;i<=p;i++) { if(mark[i]) for(j=i*i...
by richatibrewal
Tue Dec 09, 2014 3:38 pm
Forum: Volume 118 (11800-11899)
Topic: 11827 - Maximum GCD
Replies: 22
Views: 3695

Re: 11827 - Maximum GCD

Hii,the following code got accepted for 0.015 s. How can I improve this code ? #include<cstdio> #include<cstring> #include<iostream> using namespace std; int gcd(int a,int b) { int r; while(b!=0) { r=a%b; a=b; b=r; } return a; } int main() { int n,a[200]={0},i,j,max=-1,l,len,flag,g; char s[100096]; ...
by richatibrewal
Thu Nov 13, 2014 6:16 pm
Forum: Volume 108 (10800-10899)
Topic: 10892 - LCM Cardinality
Replies: 25
Views: 8163

Re: 10892 - LCM Cardinality

How can we solve the problem by prime factors method??
by richatibrewal
Thu Nov 13, 2014 1:15 pm
Forum: Volume 104 (10400-10499)
Topic: 10407 - Simple division
Replies: 34
Views: 11532

Re: 10407 - Simple division

Thanx :)
by richatibrewal
Wed Nov 12, 2014 7:50 pm
Forum: Volume 104 (10400-10499)
Topic: 10407 - Simple division
Replies: 34
Views: 11532

Re: 10407 - Simple division

Yes, by the method of gcd. But i couldn't understand the test case. Will someone plz throw some light on the 3rd test case??
by richatibrewal
Wed Nov 12, 2014 5:53 pm
Forum: Volume 104 (10400-10499)
Topic: 10407 - Simple division
Replies: 34
Views: 11532

Re: 10407 - Simple division

I am facing difficulty in understanding its 3rd example:
Input : 14 -22 17 -31 -124 0
output: 3
14%3 = 2
whereas -22%3 = 1
Will someone plz explain this ?
by richatibrewal
Sat Nov 08, 2014 7:56 pm
Forum: Volume 101 (10100-10199)
Topic: 10168 - Summation of Four Primes
Replies: 51
Views: 19713

Re: 10168 - Summation of Four Primes

Thanx . Got accepted.

But its run time is 0.652s. Can u tell me what changes I should make in my code so that the run time is less?
by richatibrewal
Sat Nov 08, 2014 5:22 pm
Forum: Volume 101 (10100-10199)
Topic: 10168 - Summation of Four Primes
Replies: 51
Views: 19713

Re: 10168 - Summation of Four Primes

Hii, I am getting WA for this problem. Plz tell me the bug in my code or give some critical inputs for this question: #include<cstdio> #include<cstring> using namespace std; int prime[10000010]; int main() { memset(prime,1,sizeof(prime)); int i,j,a,b,diff,n,count; for(i=2;i<=3163;i++) { if(prime[i])...
by richatibrewal
Fri Nov 07, 2014 5:45 pm
Forum: Volume 114 (11400-11499)
Topic: 11401 - Triangle Counting
Replies: 19
Views: 9998

Re: 11401 - Triangle Counting

Thank u so much.
Accepted

Go to advanced search