Search found 17 matches

by bradd123
Mon Feb 23, 2015 7:33 pm
Forum: Volume 123 (12300-12399)
Topic: 12324 - Philip J. Fry Problem
Replies: 0
Views: 618

Re: 12324 - Philip J. Fry Problem

Any hints to solve this problem?
by bradd123
Mon Feb 23, 2015 5:38 pm
Forum: Volume 118 (11800-11899)
Topic: 11832 - Account Book
Replies: 3
Views: 2485

Re: 11832 - Account Book

Hi, I got Time Limit Exceeded for this problem. I used dp with memoization. How to optimize this code? #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int dp[45][32010]; int N,F; int a[45]; char path[45]; bool AccBook(int idx,int sum){ if(idx==N){ if(sum==F) return true; ...
by bradd123
Mon Feb 23, 2015 3:24 pm
Forum: Volume 118 (11800-11899)
Topic: 11832 - Account Book
Replies: 3
Views: 2485

Re: 11832 - Account Book

Your third expression is wrong.
Take these two expressions.
-1+2-3+4+5 =7
+1+2+3-4+5 =7
You can clearly see that only second and last transactions are same in both expressions. Remaining are ambiguous to tell whether that is income or expense.
by bradd123
Mon Feb 23, 2015 11:44 am
Forum: Volume 106 (10600-10699)
Topic: 10690 - Expression Again
Replies: 23
Views: 8996

Re: 10690 - Expression Again

Hi, I got time limit exceeded for this problem. Please tell me how to improve solution. I used dp subset sum. #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int _min,_max; int dp[110][110][5500]; int N,M,a[110]; int mi,totalsum; void ExpAgain(int idx,int num,int sum){ if...
by bradd123
Sun Feb 22, 2015 3:28 pm
Forum: Volume 11 (1100-1199)
Topic: 1172 - The Bridges of Kolsberg
Replies: 5
Views: 2814

Re: 1172 - The Bridges of Kolsberg

Hi, Can anybody tell me How to proceed to solve this problem? It looks like matching with some constraints. Please give me some hints?
by bradd123
Fri Feb 20, 2015 11:46 am
Forum: Volume 100 (10000-10099)
Topic: 10086 - Test the Rods
Replies: 10
Views: 4413

Re: 10086 - Test the Rods

It worked for RE Error. But Now I am getting Time LImit Exceeded. How to improve this solution.
by bradd123
Thu Feb 19, 2015 2:12 pm
Forum: Volume 100 (10000-10099)
Topic: 10086 - Test the Rods
Replies: 10
Views: 4413

Re: 10086 - Test the Rods

@Brianfry713 : I added return 0; to the program Still It shows RE. Could you please tell me any other mistakes. I think it is out of bounds error. But I couldn't find it. Please Give me some test cases.
by bradd123
Wed Feb 18, 2015 11:02 am
Forum: Volume 100 (10000-10099)
Topic: 10086 - Test the Rods
Replies: 10
Views: 4413

Re: 10086 - Test the Rods

Hi, Can anyone tell me why my code shows RE for this problem. #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define INF 2000000000 int T1,T2,n; int m[25];int C[50][50][2]; int memo[50][310][310]; int trace[50][310][310]; int TesttheRods(int idx,int rem1,int rem2){ if(id...
by bradd123
Mon Feb 16, 2015 3:31 pm
Forum: Volume 114 (11400-11499)
Topic: 11420 - Chest of Drawers
Replies: 11
Views: 4842

11420 - Chest of Drawers

Hi, Can anyone tell me how to improve my solution for this problem. I used DP top-down But It gives me TLE. Any suggestions please? #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long int ll; ll memo[75][75][75]; ll n,s; ll LockDrawer(ll lst,ll id,ll nlck){ ...
by bradd123
Sun Feb 01, 2015 8:47 pm
Forum: Volume 11 (1100-1199)
Topic: 1196 - Tiling Up Blocks
Replies: 10
Views: 3840

Re: 1196 - Tiling Up Blocks

Why Runtime Error for this code? I can't figure out. #include<cstdio> #include<algorithm> #include<cstring> using namespace std; #define MAX 10010 struct block{ int l; int m; }; block a[MAX]; int val[MAX]; bool compare(const block& lhs, const block& rhs){ return lhs.l<=rhs.l; } int lis(int n){ if(n=...
by bradd123
Fri Jan 02, 2015 10:17 am
Forum: Volume 3 (300-399)
Topic: 315 - Network
Replies: 68
Views: 20622

Re: 315 - Network

I solved it using tarjan's algorithm for finding articulation points, jakecho1's post is very helpful.
by bradd123
Fri Jan 02, 2015 8:08 am
Forum: Volume 127 (12700-12799)
Topic: 12797 - Letters
Replies: 3
Views: 993

Re: 12797 - Letters

@satirmo, your code fails on this test case

Code: Select all

2
aa
AA
Your code gives 3 but the answer is -1 . I think floodfill algorithm is more suitable for this type of implicit graphs. Although bfs will work fine.
by bradd123
Thu Jan 01, 2015 3:28 pm
Forum: Volume 105 (10500-10599)
Topic: 10505 - Montesco vs Capuleto
Replies: 73
Views: 36500

Re: 10505 - Montesco vs Capuleto

@uradura, In set of connected components, if one component is not bipartite, your program does not give the answer of other bipartite components result
For Example take this input

Code: Select all

1

2 2 3
2 1 3
3 1 2
1 5
1 4
Your code gives 0,but the AC answer is 1
by bradd123
Wed Dec 31, 2014 7:34 am
Forum: Volume 119 (11900-11999)
Topic: 11902 - Dominator
Replies: 20
Views: 8897

Re: 11902 - Dominator

Hi, what is wrong with my solution for this problem, WA at 0.516. #include<cstdio> #include<vector> #include<cstring> using namespace std; vector<int> A[110]; bool Visited[110]; bool Reachable[110]; bool Dominator[110][110]; void dfs(int u){ Visited[u]=true; Reachable[u]=true; for(int j=0;j<(int)A[u...
by bradd123
Sun Dec 28, 2014 11:29 am
Forum: Volume 4 (400-499)
Topic: 469 - Wetlands of Florida
Replies: 63
Views: 20488

Re: 469 - Wetlands of Florida

Here is my code. It shows WA at 0.046. I can't figure out what is what is wrong here. Please help me.

Code: Select all

Removed after AC, Thank you very much [b]lighted[/b].it is simple input taking problem.

Go to advanced search