Search found 147 matches

by bugzpodder
Fri Aug 20, 2004 5:43 am
Forum: Algorithms
Topic: USACO Broken Necklace Problem
Replies: 8
Views: 4740

In this problem, the necklace size is small enough (350) that we might as well just try breaking the necklace at each point and see how many beads can be collected. This will take approximately O(n^2) time, but n is small enough that it won't matter. The code is slightly simple-minded in that we mig...
by bugzpodder
Thu Aug 19, 2004 7:37 pm
Forum: Other words
Topic: Foundation Contest 2004
Replies: 12
Views: 3687

as the problemsetter for Problem C, certainly my intent for this problem is not a DP solution (I for-one does not know and doubt the existance of such a solution). As previously mentioned, there is a simple but non-trivial criterion for this. [edit] although in a way, I guess you could say this crit...
by bugzpodder
Thu May 06, 2004 5:56 pm
Forum: Volume 106 (10600-10699)
Topic: 10644 - Floor Tiles
Replies: 25
Views: 11450

Per wrote:No.. for instance, a 9x5-rectangle is possible, but you can't build it out of 2x3-tiles.
This is the key insight.
by bugzpodder
Thu Apr 22, 2004 3:28 pm
Forum: Volume 1 (100-199)
Topic: 180 - Eeny Meeny
Replies: 34
Views: 11081

Re: 180 Eeny Meeny.. WA??

let F(n) = person to be chosen as chief when there are n people to choose from let G(n) = person to be chosen as chief when we count from the other direction clearly F(n) depends on F(n-1). so I generate a table starting from F(1) = 0 (means the starting person is chosen). The table is generated un...
by bugzpodder
Mon Feb 16, 2004 11:04 pm
Forum: Volume 100 (10000-10099)
Topic: 10083 - Division
Replies: 12
Views: 6138

hmmmmmmmmmmmm....
I followed your advice and still got a TLE. its either an infinite loop or my bigInt implementation is too slow then...
by bugzpodder
Thu Dec 11, 2003 5:57 pm
Forum: C++
Topic: Strangest Error yet!!
Replies: 1
Views: 1320

ok I know why it crashes now. i used strings in the clients and it only dumps the pointer to the string (C++ basic_string) to the file. hence if we declare the class inside the for loop and exits, only the pointer is saved, and that explains why all the numbers are correct and the strings are incorr...
by bugzpodder
Thu Dec 11, 2003 5:09 pm
Forum: C++
Topic: Strangest Error yet!!
Replies: 1
Views: 1320

Strangest Error yet!!

for (int i=0;i<1;i++){ Client s(44,"Mike","Brown","333333"); ofstream fout("test.bin",ios::binary); fout.write((char *) (&s),sizeof(Client)); fout.flush(); fout.close(); } Client s2; ifstream fin("test.bin",ios::binary); fin.read((char *) (&s2),sizeof(Client)); cout<<s2.display()<<endl; fin.close()...
by bugzpodder
Fri Oct 17, 2003 2:33 am
Forum: Volume 1 (100-199)
Topic: 126 - The Errant Physicist
Replies: 25
Views: 4063

[Resolved] 126 - "The Errant Physicist" Descriptio

I am not sure when I should add the space between the signs. 13 2 11 8 6 5 5 2 3 3 -x y - x y + 8x y + 9x - x y + x y + 8x +x y - 1 + y for that sample output above i do not understand why they didnt have a space between +x^3y also in the input can you have something like: 0 0 or x-x y-y
by bugzpodder
Fri Oct 10, 2003 3:34 pm
Forum: C++
Topic: STL and binary
Replies: 0
Views: 1307

STL and binary

I am having a little trouble with binary files and STL stuff. forexample i have a structure that contains C++ string type and i tried use read/write in an binary file and it doesnt work. and i also tried to write a vector into a binary file but that didnt work either. is STL not compatible with bina...
by bugzpodder
Thu Oct 09, 2003 3:31 pm
Forum: C++
Topic: sort/qsort compare function [Resolved]
Replies: 1
Views: 1546

sort/qsort compare function [Resolved]

to my understanding the sort function in the STL algorithms header and the function that qsort (standard C) takes in should be completely opposite right? consider compareTo(int a1,int a2) in the STL sort, we must return 1 (true) if a1 goes before a2 and in the C qsort, we must return -1 if a1 goes b...
by bugzpodder
Wed Oct 08, 2003 10:46 pm
Forum: Volume 102 (10200-10299)
Topic: 10217 - A Dinner with Schwarzenegger!!!
Replies: 28
Views: 9394

congrats to Schwarzenegger for winning the election thing :lol:
by bugzpodder
Mon Oct 06, 2003 10:27 pm
Forum: Volume 102 (10200-10299)
Topic: 10270 - Bigger Square Please...
Replies: 25
Views: 12264

10270 - Bigger Squares Please

How do we prune the search tree enough so it will run in time? my DFS algorithm with some backtracking and a optimized maximum of 20 is still too slow for prime cases!
by bugzpodder
Fri Sep 26, 2003 5:51 pm
Forum: Volume 1 (100-199)
Topic: 127 - "Accordian" Patience
Replies: 83
Views: 9942

yes, building your own stack and statically allocate the stacks is definately a good idea. it got me AC after ~3.2s :D
by bugzpodder
Fri Sep 26, 2003 3:09 pm
Forum: C++
Topic: [resolved] more long longs
Replies: 1
Views: 1443

[resolved] more long longs

i tried to use bitshifting for my long long variable but it wont take width of greater than 31
my compiler complains for something like:
long long x;
x=1<<32;
by bugzpodder
Fri Sep 26, 2003 3:05 pm
Forum: Volume 1 (100-199)
Topic: 127 - "Accordian" Patience
Replies: 83
Views: 9942

UFP2161 wrote:Yes, C++ STL won't cut it with this one (too much overhead). I used a doubly linked list, with input/output buffering [fread and fwrite].
hmm fread? what is the parameter for the file stream? my compiler wont accept stdio ass the file stream.

Go to advanced search