Search found 22 matches

by shantanu18
Tue Jun 21, 2011 10:55 am
Forum: Volume 101 (10100-10199)
Topic: 10168 - Summation of Four Primes
Replies: 51
Views: 20154

Re: 10168 - Summation of Four Primes

I am getting WA. There is no lower bound so i handle for negative number also #include <cstdio> #include <iostream> #include <cmath> #define MAX 10000100 #define PMAX 664600 #define int64 long long using namespace std; bool base[MAX+2]; int64 prime[PMAX+2]; void getPrime() { int i2,cnt=0; int sq=sqr...
by shantanu18
Mon Jun 20, 2011 11:00 pm
Forum: Volume 3 (300-399)
Topic: 392 - Polynomial Showdown
Replies: 93
Views: 18092

Re: 392 - Polynomial Showdown PE -- plz help

I found the bug of my code. When all input is 0 then output is 0. I missed that. Now AC!

Code: Select all

Got AC
by shantanu18
Sat Jun 18, 2011 11:33 pm
Forum: Volume 1 (100-199)
Topic: 106 - Fermat vs. Pythagoras
Replies: 138
Views: 12157

Re: 106 Fermat Vs Pythagoras 0.1sec!!

I used to generate all primitive PYTHAGOAN triples using Euclidian formula [link] http://en.wikipedia.org/wiki/Pythagorean_triple [/link] But All pair of m and n (see this link) does not generate all triples. So i am having problem to generate the second output of this problem. According to Euclidia...
by shantanu18
Sat Jun 18, 2011 2:53 pm
Forum: Volume 1 (100-199)
Topic: 116 - Unidirectional TSP
Replies: 226
Views: 36198

Re: help in Problem 116

Run as column major. update current position from (i-1)(i) (i+1) of previous column. handle (1st and last row). In this code i tried to print from 1st occurrence in last column. But i also tried all possible path and output the sorted one. NO LUCK 1 1 1 <-- this place update from three of previous c...
by shantanu18
Mon Jun 13, 2011 11:13 am
Forum: Volume 1 (100-199)
Topic: 118 - Mutant Flatworld Explorers
Replies: 68
Views: 9253

Re: 118 WA: wtf

Thanks zobayer for reply. I got the point. I got AC.
by shantanu18
Fri Jun 10, 2011 6:53 pm
Forum: Volume 118 (11800-11899)
Topic: 11825 - Hackers' Crackdown
Replies: 5
Views: 3846

Re: 11825 - Hackers’ Crackdown

I tried using dfs. call dfs from every node and get the max of all visited node from dfs. Need some cases. Please help #include <cstdio> #include <iostream> #include <vector> #include <cstring> #define max(a,b) (a>b?a:b) #define white 0 #define gray 1 #define black 2 #define MAX 100 using namespace ...
by shantanu18
Fri Jun 10, 2011 9:18 am
Forum: Volume 1 (100-199)
Topic: 118 - Mutant Flatworld Explorers
Replies: 68
Views: 9253

Re: 118 WA: wtf

Please anyone can explain this 3rd case ? 2nd case: 3 3 N LOST //so 3 3 coordinate is block 3rd Case: LLFFFLFLFL start 0 3 W L -> 0 3 S [change dir to left] L -> 0 3 E F -> 1 3 E F -> 2 3 E [b]#F -> 3 3 E [this step is not valid becoz 3 3 already visited by 2nd robot] [so this step remain 2 3 E][/b]...
by shantanu18
Mon Jun 06, 2011 1:47 am
Forum: Volume 1 (100-199)
Topic: 120 - Stacks of Flapjacks
Replies: 118
Views: 13472

Re: 120 Still WA. If you get AC, please try this input.

getting wa! #include <cstdio> #include <iostream> #include <vector> #include <string> #include <cstring> #include <algorithm> #include <utility> #define pa pair<int,int> using namespace std; bool com(const pa a,const pa b) { return a.first<b.first; } vector<pa> getNumber(string st) { vector <pa> vec...
by shantanu18
Sun May 15, 2011 8:48 pm
Forum: Volume 1 (100-199)
Topic: 116 - Unidirectional TSP
Replies: 226
Views: 36198

Re: help in Problem 116

getting wa #include <cstdio> #include <iostream> #define MAX 128 #define max(a,b)(a>b?a:b) using namespace std; struct node{ int cost; int prev; }; int arr[MAX][MAX]; node DP[MAX][MAX]; void print_path(int n,int j) { if(n==-1) return; else print_path(DP[n][j-1].prev,j-1); printf("%d ",n+1); } int ma...
by shantanu18
Wed Feb 02, 2011 10:01 pm
Forum: Volume 119 (11900-11999)
Topic: 11910 - Closest Fractions
Replies: 8
Views: 2968

Re: 11910 - Closest Fractions

Why Runtime Error!!! :o #include <cstdio> #include <iostream> #include <cmath> #include <cstring> #include <vector> #include <algorithm> #include <sstream> #define MAX 1024 #define eps 0.9000000000 #define min(a,b) (a<b? a:b) //#define p 10 using namespace std; struct node{ int x; int y; double res;...
by shantanu18
Wed Jan 19, 2011 11:53 am
Forum: Volume 4 (400-499)
Topic: 481 - What Goes Up
Replies: 82
Views: 13942

Re: 481 - What Goes UP (Run Time Error)

Why WA! please help... #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <map> #define MAX 1000000 #define inf 0x3f3f3f3f using namespace std; vector <int> arr; int prev[MAX]; map <int,int> mp; void print(int n) { if(n==-inf) return; else { print(prev[mp[n]]); pri...
by shantanu18
Mon Sep 06, 2010 10:12 pm
Forum: Volume 114 (11400-11499)
Topic: 11412 - Dig the Holes
Replies: 3
Views: 3008

Re: 11412 - Dig the Holes

I am confused about input/output please help!
Input:

Code: Select all

3

YGOR 4 0
RGOB 4 0

RBVY 2 1
ORVY 4 0

GYBV 2 1
YORV 0 2

Output:

Code: Select all

cheat //but it is true for this sequence GROB
possible //but what is the sequence 
possible //what is the sequence for which it is possible
by shantanu18
Sun Sep 05, 2010 7:08 pm
Forum: Volume 107 (10700-10799)
Topic: 10769 - Pillars
Replies: 22
Views: 10945

Re: 10769 - Pillars

I am getting TLE! maybe i don't have any problem with extra blank line. please give some IO #include <cstdio> #include <iostream> #include <vector> #include <sstream> #include <algorithm> #include <utility> #define pa pair<int,int> #define white 10 #define black 11 #define red 0 #define green 1 usin...
by shantanu18
Sat Sep 04, 2010 10:12 am
Forum: Volume 3 (300-399)
Topic: 380 - Call Forwarding
Replies: 3
Views: 3571

Re: 380 - Why do I have W.A.?

WA! please help! please give some IO. Thanks in advance #include <vector> #include <map> #include <iostream> #include <cstdio> #include <sstream> #define pa pair<TIME,int> #define MAX 10010 #define white 0 #define black 1 using namespace std; struct TIME{ int start; int end; }; vector <pa> V[MAX]; i...
by shantanu18
Sat Sep 04, 2010 7:00 am
Forum: Volume 108 (10800-10899)
Topic: 10815 - Andy's First Dictionary
Replies: 116
Views: 30783

Re: 10815 - Andy's First Dictionary

I think the following approach is good to take input for this problem. It is difficult to include all punctuation. while((getline(cin,st))!=NULL) { strcpy(ch,st.c_str()); for(int i=0;i<(int)strlen(ch);i++) { if(!isalpha(ch[i])) ch[i]=' '; else if(isalpha(ch[i]) && isupper(ch[i])) ch[i]=tolower(ch[i]...

Go to advanced search