Search found 584 matches

by Krzysztof Duleba
Mon Oct 08, 2007 3:31 pm
Forum: C++
Topic: Compile error on priority_queue.
Replies: 6
Views: 3637

It looks like the compiler thinks that "priority_queue<int, vector<int>, MyLess> que(MyLess(a));" is a function prototype, instead of a variable. Yes, this declaration is equivalent to priority_queue<int, vector<int>, MyLess> que(MyLess a); which is a declaration of function que that takes a single...
by Krzysztof Duleba
Wed Oct 03, 2007 8:30 pm
Forum: C++
Topic: C++ Template Specialisation Problem
Replies: 9
Views: 3839

There's no way to tell user-defined types from built-ins in templates except by explicit specialization.
by Krzysztof Duleba
Wed Oct 03, 2007 8:27 pm
Forum: C++
Topic: Always WA, even with correct output... (what am I missing?)
Replies: 6
Views: 3584

Why would you use C compiler to compile C++?

The first thing that comes to mind after looking at the snippet you provided is the lack of newline character at the end of the output.
by Krzysztof Duleba
Thu Sep 27, 2007 1:23 pm
Forum: Algorithms
Topic: Need expert's view for geometry algos.
Replies: 23
Views: 9374

Note that monotone chain is O(n) if you're given points in sorted order.
by Krzysztof Duleba
Wed Sep 26, 2007 6:49 pm
Forum: Algorithms
Topic: Need expert's view for geometry algos.
Replies: 23
Views: 9374

Not that you'll ever need this on an ACM ICPC contest, but for the sake of completeness: maximum number of points on a line can be done in O(n^2) by using the point-line duality, and then traversing the plane subdivision and looking for the vertex of maximum degree. Or better yet, with simple hashi...
by Krzysztof Duleba
Fri Sep 07, 2007 1:00 pm
Forum: Volume 101 (10100-10199)
Topic: 10126 - Zipf's Law
Replies: 36
Views: 8825

ayon wrote:most probably online-judge doesn't support clear()
It does.

std::string comes from <string>, not from <cstring> (although you need the latter for strcmp (although operator== could do the trick with much less typing)).
by Krzysztof Duleba
Thu Jul 12, 2007 2:00 am
Forum: C++
Topic: C++ string usage: compile error
Replies: 4
Views: 2429

You forgot the right include.
by Krzysztof Duleba
Fri Jul 06, 2007 11:39 pm
Forum: C++
Topic: How to check for blank line?
Replies: 5
Views: 3443

Do you need it all spell out? You already have tools necessary to accomplish that goal (I'll just add that string::size() method is nicer than string::length()). If you don't, my advice is that you get a good book and read it, your questions indicate lack of basic understanding of programming in gen...
by Krzysztof Duleba
Thu Jun 28, 2007 2:14 pm
Forum: C++
Topic: Why can we use the manipulators in <iomanip>
Replies: 3
Views: 1993

Yes, instructions like cout << setw(5) are evaluated so that setw(5) returns an object of implementation-specific class, for which appropriate overloads are provided in iomanip header.
by Krzysztof Duleba
Thu Jun 28, 2007 11:32 am
Forum: C++
Topic: Why can we use the manipulators in <iomanip>
Replies: 3
Views: 1993

The second (manipulators that do not take arguments) and third (manipulators that take an argument). It's clearly said in the manual you pointed to that manipulators return unspecified types that operator<< and operator>> are overloaded for, so you shouldn't be expecting any of these operators to be...
by Krzysztof Duleba
Sat Jun 09, 2007 3:50 pm
Forum: C
Topic: Complie error
Replies: 4
Views: 5641

I can't tell you what the problem really is unless you provide the exact error message (you should get in on your email). However, one thing is that all identifiers beginning with underscore are reserved for internal purposes and one must avoid using them. Suggested approach is to use trailing under...
by Krzysztof Duleba
Fri Jun 01, 2007 7:10 pm
Forum: C
Topic: 64 bit compiler (gcc) - expert question
Replies: 8
Views: 7337

Thanks. Talking about benchmarks: division using 64 bit doubles is about 2.5 times faster than using 32 bit ints; division using 128 bit long doubles is also about 2.5 faster than using 64 bit longs and about 1.5 times slower than using 64 bit doubles. At least on my processor (AMD 64 X2 3800+). Ca...
by Krzysztof Duleba
Fri Jun 01, 2007 2:06 pm
Forum: C
Topic: 64 bit compiler (gcc) - expert question
Replies: 8
Views: 7337

1. It compiles to whatever architecture your system has.
2. No, it's still 32-bit. Note that longs are now 64-bit, though.
3. No. But why don't you write a simple benchmark and tell us?
4. Whatever sizeof(bool) prints out. Most likely it will be 1 byte.
by Krzysztof Duleba
Tue Feb 27, 2007 1:03 pm
Forum: Volume 110 (11000-11099)
Topic: 11019 - Matrix Matcher
Replies: 43
Views: 18044

Well, my guess is that a program allocating over 500MB of memory has very slim chances of passing.

Go to advanced search