Search found 33 matches

by Khaled_912
Sun Mar 11, 2007 10:52 am
Forum: Volume 111 (11100-11199)
Topic: 11103 - WFF 'N PROOF
Replies: 13
Views: 8228

is it asking for a 'sub-sequence' or a 'substring' (consecutive characters)? Is it allowed to re-order the symbols?
by Khaled_912
Sun Mar 11, 2007 10:45 am
Forum: Volume 111 (11100-11199)
Topic: 11107 - Life Forms
Replies: 21
Views: 13718

Here's my approach: I try all substrings of length L and insert them into a map <string, int>, which keeps track of the total occurences of a substring (I take care not to insert the same substring twice from the same string, i.e. the substring "xx" occurs in "xxx" twice, I took care of counting in ...
by Khaled_912
Sun Mar 11, 2007 10:31 am
Forum: Volume 111 (11100-11199)
Topic: 11109 - Rinse
Replies: 8
Views: 3110

11109 - Rinse

Any ideas how to approach this problem?
by Khaled_912
Wed Aug 23, 2006 4:01 am
Forum: Volume 105 (10500-10599)
Topic: 10546 - The Eagle's Nest
Replies: 23
Views: 10951

From the 1st vertex connect using a unit edge to the 2nd vertex of the missions that appear before this mission and are easier than the one at hand. Well, this seems not to be correct. Let h be the length of the maximum sequence of missions ending with 'i'. In this case, 2nd vertex of mission 'j' i...
by Khaled_912
Thu Aug 17, 2006 3:05 pm
Forum: Volume 106 (10600-10699)
Topic: 10634 - Say NO to Memorization
Replies: 18
Views: 8507

The fastest and safest method to evaluate nCk is using the fact from the pascal's traingle that this recurrence relation holds true: nCk = nC(k-1) + (n-1)C(k-1) Consider this function: long long mem[2005][2005]; //initialized to -1 long long c(int n, int k) { if (n == k) return 1; if (k == 0) return...
by Khaled_912
Thu Aug 17, 2006 2:59 pm
Forum: Volume 106 (10600-10699)
Topic: 10634 - Say NO to Memorization
Replies: 18
Views: 8507

Thanks a lot, I noticed the silly mistake concerning the size of my array, got AC now.
I'll remember next time to post my Q in an existing thread.
by Khaled_912
Wed Aug 16, 2006 6:43 pm
Forum: Volume 106 (10600-10699)
Topic: 10634 - Say NO to Memorization
Replies: 18
Views: 8507

10634 Say NO to Memorization - WA

I'm keeping to get WA on this problem, although I've tried all of the test cases in the other posts.
If anybody can tell me where's the mistake or post some extra i/o I'll be thankful.

Code: Select all

Removied after AC
by Khaled_912
Tue Jul 04, 2006 9:44 pm
Forum: Volume 105 (10500-10599)
Topic: 10505 - Montesco vs Capuleto
Replies: 73
Views: 37747

You must consider the graph as 'components', and count components that are not bipartite as 0. Here is my DFS code: void dfs(int x, int c) { if (v[x]) //visited { if (col[x] != c) bipartite = false; //color mismatch return; } v[x] = true; col[x] = c; //set the color //add the code for counting the n...
by Khaled_912
Sun Jun 18, 2006 11:08 pm
Forum: Volume 102 (10200-10299)
Topic: 10231 - Matrix World
Replies: 8
Views: 2548

Sorry for the late reply, I've just got this problem accepted. Your main idea seems OK, but there are some flaws. Maybe I midunderstood what you said, but what do you mean by 'Measure the distance'? It is indeed not the Euclidean distance; you must do BFS and find the shortest path from your positio...
by Khaled_912
Sat Jan 14, 2006 1:23 am
Forum: C++
Topic: GCC 2.95.4 compiler??
Replies: 1
Views: 1759

GCC 2.95.4 compiler??

does anyone has any idea where can I find a compiler that uses the 2.95.4 version of the GCC?? I'm mad about my compilation errors (and sometimes RE due to compiler differences)...
by Khaled_912
Mon Jan 09, 2006 11:25 pm
Forum: Volume 109 (10900-10999)
Topic: 10939 - Ants, Aphids and a Ladybug
Replies: 13
Views: 5757

I'm using BFS, but I'm mad about my TLE !! Here's my code, please tell my if I can optimize any part. #include <iostream> #include <fstream> #include <queue> #include <stdlib.h> #include <stdio.h> using namespace std; bool a[5005][5005]; int v[5005]; int p[5005]; int d[5005]; int first,second; int n...
by Khaled_912
Mon Jan 09, 2006 8:49 pm
Forum: Algorithms
Topic: big integers in C
Replies: 12
Views: 2774

misof wrote: When this happens, you have to add a new digit to the beginning of the string (and thus reallocate the whole string).
Does this mean that when using the insert() function of the string class, the string is reallocated?
string s;
.
.
.
s.insert(0,1,'1'); //does this reallocate the whole string?
by Khaled_912
Mon Jan 09, 2006 6:17 am
Forum: C++
Topic: stdio or iostream??
Replies: 6
Views: 2776

stdio or iostream??

I've always wondered which is faster to use: scanf and printf or the cin and cout?
It might seems a useless question, but I'm just curious to know which is faster, if any.
by Khaled_912
Mon Jan 09, 2006 5:40 am
Forum: Off topic (General chit-chat)
Topic: What kinds of problems do you solve most ?
Replies: 25
Views: 77220

I LOVE graphs.. I just try to solve any problem using graphs even if a simpler solution exists (Set Union using DFS)... I also like dynamic programming, but I'm not pretty good in solving those types of problems. I also have a good ability in solving maths problems, but I dun really like them. Final...
by Khaled_912
Mon Jan 09, 2006 5:07 am
Forum: Off topic (General chit-chat)
Topic: Which programming language are you useing more often?
Replies: 4
Views: 34934

C++ rocks with the STL!! With java it's pretty easy to get a compilation error, and C++ has an advantage over C so...

Go to advanced search