Search found 22 matches

by shantanu18
Wed Sep 01, 2010 4:24 am
Forum: Volume 5 (500-599)
Topic: 514 - Rails
Replies: 79
Views: 24110

Your train's coaches are in following order --> 1 2 3 4 5
input-->5 4 1 2 3
coaches #5 so push 1 to 4 in station(stack).
coaches #4 you can get it becoz it is in the top of the station
coaches #1 you can not get it, becoz it is in the bottom of the station
So ans is "No"
Hope this will help!
by shantanu18
Fri Aug 06, 2010 8:46 am
Forum: Volume 109 (10900-10999)
Topic: 10917 - Walk Through the Forest
Replies: 19
Views: 10121

Re: 10917 - A Walk Through the Forest

Run dijkstra to calculate shortest path and dp to save the # of path. WA!!! please help #include <cstdio> #include <iostream> #include <vector> #include <utility> #include <queue> #include <cstring> #define pa pair <int,int> #define MAX 1010 using namespace std; vector <pa> v[MAX]; int ver,edg,e1,e2...
by shantanu18
Tue Jul 27, 2010 4:25 am
Forum: Volume 4 (400-499)
Topic: 406 - Prime Cuts
Replies: 187
Views: 21800

Re: problem 406

It was not only blank line problem also a logical problem. I got ac. Thanks everybody for helping me. (i can't edit my post so can not delete my code)
by shantanu18
Sat Jul 24, 2010 9:38 pm
Forum: Volume 4 (400-499)
Topic: 406 - Prime Cuts
Replies: 187
Views: 21800

Re: problem 406

still WA after change blank line. I tried also blank line after every case (cout<<endl<<endl) but both are WA! I am confused #include <cstdio> #include <iostream> #define MAX 1010 #define sq 32 using namespace std; int arr[MAX]; int v[MAX]; int prime[MAX]; void scive() { arr[0]=1; for(int i=3;i<=sq;...
by shantanu18
Sat Jul 24, 2010 9:27 pm
Forum: Volume 116 (11600-11699)
Topic: 11624 - Fire!
Replies: 54
Views: 14182

Re: 11624 - Fire!

getting WA! please help! thanks in advance #include <iostream> #include <cstdio> #include <cstring> #include <queue> #define MAX 1010 using namespace std; int r,c; char grid[MAX][MAX]; bool flag=false; struct Node{ int x; int y; }; int dj[MAX][MAX]; int arr[]={-1,0,1,0,0,-1,0,1}; void bfs(Node s,Nod...
by shantanu18
Wed Jul 21, 2010 7:16 pm
Forum: Volume 4 (400-499)
Topic: 406 - Prime Cuts
Replies: 187
Views: 21800

Re: problem 406

geting wa!!! why wa??? #include <cstdio> #include <iostream> #define MAX 1001 #define sq 32 using namespace std; int arr[MAX]; int v[MAX]; int prime[MAX]; void scive() { arr[0]=1; for(int i=3;i<=sq;i+=2) { for(int j=2;i*j<MAX;j++) arr[i*j]=1; } v[0]=0; v[1]=1; v[2]=2; prime[0]=1;prime[1]=2; int Ind=...
by shantanu18
Tue Jul 20, 2010 10:00 pm
Forum: Volume 6 (600-699)
Topic: 661 - Blowing Fuses
Replies: 67
Views: 19765

Re: 661 - Blowing Fuses

WA!!! please help! #include <cstdio> #include <iostream> #include <cstring> using namespace std; struct Amp { bool status; int wight; }; int main() { //freopen("input.txt","r",stdin); int n,m,c,ca=1,total,s[100],cl=0; struct Amp arr[100]; while(scanf("%d%d%d",&n,&m,&c)==3 && n && m && c) { if(ca>1) ...

Go to advanced search