Search found 13 matches

by Schultz
Wed Oct 03, 2007 11:37 pm
Forum: C++
Topic: C++ Template Specialisation Problem
Replies: 9
Views: 3820

I see.

So I will have to change my approach.

Thanks guys. I'll tell if I can figure ou a solution for this.
by Schultz
Wed Oct 03, 2007 3:38 pm
Forum: C++
Topic: C++ Template Specialisation Problem
Replies: 9
Views: 3820

My goal in this construct is metaprogramming. For instance, I could define integral types as those whose members are either machine types or integral types and do not have default constructors or destructors implemented. Then, instead of trait, I could name the template pointed_value_is_integral. Th...
by Schultz
Tue Oct 02, 2007 10:26 pm
Forum: C++
Topic: C++ Template Specialisation Problem
Replies: 9
Views: 3820

Oh, I got it. You mean X<int>::Y is the same as X<float>::Y.

But what if I put something like typedef T type; inside Y? Then I should be able to solve this.

The problem is that I can not get this working even then.
by Schultz
Mon Oct 01, 2007 8:48 pm
Forum: C++
Topic: C++ Template Specialisation Problem
Replies: 9
Views: 3820

I think, one of the template specializations is not correct: template<typename T> struct trait< typename X<T>::Y > { typedef true_type value; }; This is the one I am not sure about. Nevertheless, it compiles with no warnings in my gcc 4. Microsoft's compiler is known for getting nothing right when ...
by Schultz
Mon Oct 01, 2007 1:41 am
Forum: C++
Topic: C++ Template Specialisation Problem
Replies: 9
Views: 3820

C++ Template Specialisation Problem

I have been programming in C++ for a long time, but recently I stepped in a difficult problem with the language. I have defined a type trait for to be used with a type defined as an inner class, but could not specialise the template of the trait. The code below is my problem in its simplest form. It...
by Schultz
Sat Aug 25, 2007 5:09 pm
Forum: Volume 112 (11200-11299)
Topic: 11249 - Game
Replies: 32
Views: 13208

Sorry to delay so much to answer, I was lacking internet connection.

I see, it happens that we assumed many things to get to our result. We will give up this, we wasted four ours in this problem in the day we used it in our contest. I only wish I could know what is wrong with our theroy.
by Schultz
Mon Aug 20, 2007 9:36 pm
Forum: Volume 112 (11200-11299)
Topic: 11249 - Game
Replies: 32
Views: 13208

Thank you. I will check our proof once more after examining the input more carefully.

Could you tell me how why is it I can not win if I am given 64 26 with k = 1?
by Schultz
Mon Aug 20, 2007 1:02 am
Forum: Volume 112 (11200-11299)
Topic: 11249 - Game
Replies: 32
Views: 13208

I have written a program which produces correct outputs to the inputs I have tried so far. While solving the problem a friend and I formulated a complicated theory and proved its correctness. Of course, we must have made a mistake in the proof, otherwise we would have received accepted. According to...
by Schultz
Wed May 30, 2007 3:13 am
Forum: Volume 100 (10000-10099)
Topic: 10037 - Bridge
Replies: 84
Views: 23830

10037 - The Bridge (to Hell)

Hello, I found this problem very interesting at first, but when I tried to solve it, it became a nightmare. The judge always either return WA or RE. The code below is WA. Could anyone PLEASE a (the) bug in the code below. It is clear to understand. Thanks in advance. /* ------------- ACM UVA 10037 S...
by Schultz
Sat May 19, 2007 3:14 am
Forum: Volume 8 (800-899)
Topic: 843 - Crypt Kicker
Replies: 51
Views: 25180

Ah, the decoding function. Must it be injective?
by Schultz
Sat May 19, 2007 3:12 am
Forum: Volume 8 (800-899)
Topic: 843 - Crypt Kicker
Replies: 51
Views: 25180

I wrote the problem, ok. It works for every test I have tried but not for the one in the site. Can anybody check what is wrong with my code? /* ------------ ACM UVA 843 Schultz Crypt Kicker ------------ */ /* imports */ #include<stdio.h> #include<string.h> #include<vector> #include<algorithm> using ...
by Schultz
Thu May 17, 2007 5:33 pm
Forum: Volume 3 (300-399)
Topic: 374 - Big Mod
Replies: 79
Views: 11586

Yes, there is one, but it requires a bit more thought. Consider /* calculates a^b mod m */ integer modpow(integer a, integer b, integer m) { integer p = 1; // such that a0^b0 is always p*a^b while (b != 0) { if (b%2 == 0) b/= 2; else { b = (b-1)/2; p = (p*a)%m; } a = (a*a)%m; } return p%m; }
by Schultz
Wed May 16, 2007 2:21 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 181701

100 - 3n+1 - Memorisation

I have solved the 3n+1 problem by use of the memorisation method. In my computer, it solves the input "1 999999" 60 times faster than brute force. But when I submit it, besides getting AC, it takes over a second to get it correct, considering that the brute force took 3 seconds. Furthermore, I expec...

Go to advanced search