Search found 105 matches

by Maniac
Mon Oct 18, 2004 3:00 pm
Forum: Volume 107 (10700-10799)
Topic: 10747 - Maximum Subsequence
Replies: 15
Views: 8976

My solution produces for the following input 6 6 -1 -2 -5 2 4 7 6 4 0 0 -12 12 -4 8 5 4 10 -20 12 0 5 4 3 9 10 -7 -100 4 4 1 2 3 4 4 1 1 2 3 4 4 2 4 4 -4 -4 4 2 -1 -3 -5 -7 4 2 -3 -7 0 -12 5 3 6 7 0 -3 -5 3 3 -2 -3 -4 4 4 -1 -2 -3 -4 5 3 -1 -2 -3 -4 0 1 1 3 2 1 -5 -7 0 0 this output: 5 4 27 -97 10 4...
by Maniac
Mon Oct 18, 2004 2:09 pm
Forum: Volume 107 (10700-10799)
Topic: 10747 - Maximum Subsequence
Replies: 15
Views: 8976

Problem statement:
You have to pick such a subsequence, so that multiplication of all its integers is maximum.
So if the input is

Code: Select all

6 3
-5
-10
-2
-4
-8
-12
The output should be

Code: Select all

-11
right? (choosing -2, -4 and -5)
by Maniac
Mon Oct 18, 2004 1:30 pm
Forum: Volume 104 (10400-10499)
Topic: 10406 - Cutting tabletops
Replies: 11
Views: 5640

Hmm, I thought this should be an easy one but I keep getting WA. Could somebody please take a look at my code? Am I making a stupid mistake somewhere or are there any tricky cases? Thanks, Erik [cpp]#include <stdio.h> #include <math.h> #include <assert.h> #define MAXPOINTS 10000 #define PI (2.0*acos...
by Maniac
Fri Oct 15, 2004 5:26 pm
Forum: Algorithms
Topic: calculate n choose k
Replies: 5
Views: 1861

calculate n choose k

I was wondering whether there is a smart way of calculating n choose m without having the possibility of an overflow during the calculation (when it's given that the result is within bounds). I always use this method [java]static long choose(int n, int m) { if(m > n/2) return choose(n, n-m); long t ...
by Maniac
Fri Oct 15, 2004 12:32 pm
Forum: ACM ICPC Archive Board
Topic: Live Archive flaw in input
Replies: 3
Views: 1129

So I did :-)
But I'm sure that the Java 1.4 compilers and newer ones evaluate the expression in the 'expected' order, i.e. the parameters in left to right order.
by Maniac
Wed Oct 13, 2004 3:08 pm
Forum: ACM ICPC Archive Board
Topic: Live Archive flaw in input
Replies: 3
Views: 1129

:evil: :oops: Turns out that there's nothing wrong with the input, but with the Java compiler (again). I changed [java]employee[i+1] = new Employee(nextInt(), nextInt(), nextInt());[/java] into [java]int a = nextInt(); int b = nextInt(); int c = nextInt(); employee[i+1] = new Employee(a,b,c);[/java]...
by Maniac
Tue Oct 12, 2004 1:28 pm
Forum: ACM ICPC Archive Board
Topic: Live Archive flaw in input
Replies: 3
Views: 1129

Live Archive flaw in input

I'm very confident that there is a flaw in the input of problem 2934 Who's the boss of the Live Archive (the problem is part of NWERC 2003 regional). The problem states this Then there are q lines listing queries. Each query is a single legal employee ID. But after many trials I found that there are...
by Maniac
Tue Oct 12, 2004 1:20 pm
Forum: Other words
Topic: Live Archive Board topics
Replies: 1
Views: 960

Live Archive Board topics

Hi all, I have some remarks about some problems on the Live Archive (especially the North Western European regionals) but I can't post messages on the Live Archive Board because the corresponding topic-clusters aren't available. Could someone maybe look into this and add the remaining clusters? Than...
by Maniac
Mon Oct 11, 2004 3:41 pm
Forum: Volume 106 (10600-10699)
Topic: 10699 - Count the factors
Replies: 27
Views: 11383

I also get these kind of compiler errors sometimes. I always get them when I use something like node[from].neighbour[node[from].neighbours++] = node[to]; When I then get this error, I change my code to Node n1 = node[from]; Node n2 = node[to]; n1.neighbour[n1.neighbours++] = n2; and that helps! God ...
by Maniac
Wed Oct 06, 2004 2:48 pm
Forum: Volume 106 (10600-10699)
Topic: 10604 - Chemical Reaction
Replies: 24
Views: 14872

I got AC in C++ with DFS and memoization. Before each run I clear my memoization table. To my surprise, I saw that using memset for clearing the table instead of a couple of loops decreased my running time from 4.2s to 0.7s! By the way, this is one of the many problems where Java solutions based on ...
by Maniac
Thu Sep 23, 2004 4:09 pm
Forum: Volume 107 (10700-10799)
Topic: 10722 - Super Lucky Numbers
Replies: 25
Views: 9550

well, an upperbound is 128^100, which has approx. 220 digits or so...
by Maniac
Thu Sep 23, 2004 1:25 pm
Forum: Volume 107 (10700-10799)
Topic: 10722 - Super Lucky Numbers
Replies: 25
Views: 9550

For a start you could try this: 10 1 10 100 10 99 10 98 10 10 10 1 4 2 5 3 0 0 The result should be 9 3290387238734012283765380421046311624106114607409883793453325921158295596577498551598639413302298001 3323966115428066677276838128189566798325775545061295687546571735901977998098677663491201259037020...
by Maniac
Tue Sep 21, 2004 3:13 pm
Forum: Volume 105 (10500-10599)
Topic: 10565 - Matrix
Replies: 12
Views: 4078

OK, the answer to my question is option 1.
And this problem is just too easy... Which is funny cause when I globally read it it seemed hard to me :-)
by Maniac
Tue Sep 21, 2004 2:39 pm
Forum: Volume 105 (10500-10599)
Topic: 10565 - Matrix
Replies: 12
Views: 4078

Problem statement: Find a matrix root of this equation: (A + k1)(A+k2)(A+k3)...(A+km) = O where k1,k2...km are distinct integers .... I do not like trivial answer, so your answer must have at least (n*n)/2 non-zero elements. What is meant here? 1. the n*n-matrix solution should have at least (n*n)/2...
by Maniac
Fri Sep 17, 2004 3:25 pm
Forum: Volume 105 (10500-10599)
Topic: 10513 - Bangladesh Sequences
Replies: 15
Views: 8304

I'll give it a try :-)

I have thought about that but I don't have a good idea of a sensible and useful thing to store. Any ideas?

Go to advanced search