buty of arifmetica is
function swap(var a,b:T):T;begin
a:=-(a+b);
b:=-(a+b);
a:=-(a+b);
end;
or on array a[0..1]
for i:=0 to 2 do a:=-(a[0]+a[1]);
Search found 29 matches
- Mon Mar 19, 2007 9:15 pm
- Forum: Other words
- Topic: How to swap two variables... ??
- Replies: 4
- Views: 3283
- Wed Apr 05, 2006 2:36 am
- Forum: Algorithms
- Topic: Problem with sum of seqence
- Replies: 5
- Views: 1760
Yours advice bad cose S very big {TLE I think}Artikali wrote:http://www.comp.nus.edu.sg/~stevenha/pr ... ing_Change
- Tue Apr 04, 2006 9:39 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11026 - A Grouping Problem
- Replies: 28
- Views: 19001
(x-1)*(x-2)*(x-3) = x^3-6x^2+11x-6 a + b + c =6 ab+ac+bc= 11 abc=6 it got ac in 1.2 seconds during contest Time complexity O(n^2) Space Complexity O(n) in contest my prog with same algo as yours writed in pascal get me tle 2. sec now I send it , and get acc with 0:02.830 sec (by the way i only one ...
- Sat Apr 01, 2006 8:33 pm
- Forum: Bugs and suggestions
- Topic: Solution times in contest ranklist
- Replies: 3
- Views: 2566
- Fri Mar 24, 2006 10:59 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11014 - Make a Crystal
- Replies: 16
- Views: 7318
3.5 Compute all A[n] by making use of factor[n], O(n) I think you compute A[n] and sumA[n] same time >> p =s -sum(p[j]| i mod j=0, 0<j<i); Is this part O(n sqrt(n))? it depent from implimentation In my implement not. cose count action dec(p[j*i],p ) i=1,2,3..mn and j=2i,3i,..flor(m/i)j get for c(10...
- Fri Mar 24, 2006 10:29 pm
- Forum: Other words
- Topic: How big traffic in topcoder contest?
- Replies: 2
- Views: 2038
- Fri Mar 24, 2006 12:45 am
- Forum: Other words
- Topic: How big traffic in topcoder contest?
- Replies: 2
- Views: 2038
How big traffic in topcoder contest?
1.subj?
2. how big need download enviroment for contest?
ps pls ansver here. not send to topcoder's forum.
2. how big need download enviroment for contest?
ps pls ansver here. not send to topcoder's forum.
- Thu Mar 23, 2006 8:13 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11014 - Make a Crystal
- Replies: 16
- Views: 7318
The bottle neck of my algorithm is the sieve, my too (for j:=2 to m div i do dec(p[i*j],p ); afterwards, everything can be done in linear time. yep! Since our approaches are different, it's not surprised that there is a constant factor difference in the running times. I think not so dif. Cho can yo...
- Wed Mar 22, 2006 9:23 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11014 - Make a Crystal
- Replies: 16
- Views: 7318
1. cho can you explain?(your sol very fast-0.064sec) 2. my sol is(0.152sec more then 2 time slow :( ) : w =(2*i+1)^3 s =w -w[i-1]; p =s -sum(p[j]| i mod j=0, 0<j<i); r =sum(p ,1..i); where w - all atoms in cube 2i s -new atoms (|x| or |y| or |z| ==i) p -atoms in level i from wich can view center (0,...
- Tue Mar 21, 2006 11:18 pm
- Forum: Pascal
- Topic: What wrong with Pascal compiler in UVA?
- Replies: 4
- Views: 6949
here 2 solution(not full ) for 11014 problem: sol1: {$N+}const mn=100000;{100} var r:array[0..mn] of comp;c12,t:comp;i,j,n:longint; begin {secret part 1-make all r[1..10000]} i:=0;repeat read(n);if n=0 then break; inc(i);n:=n div 2;writeln('Crystal ',i,': ',r[n]:0:0); until false; end. sol2: {$N+}co...
- Tue Mar 21, 2006 10:43 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11014 - Make a Crystal
- Replies: 16
- Views: 7318
now all ok (I get accepted) but i think exist some bug in fpc cose my 1 try(wrong) use var r:comp; and writeln(r:0:0) and 2 try(accepted) use var r:int64; and writeln(r); in home i use: for 1try bp(turbo/borland pascal) for 2 try dcc( delphi ) for all value they get same result but on judge under fp...
- Mon Mar 20, 2006 11:53 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11014 - Make a Crystal
- Replies: 16
- Views: 7318
my prog(wich judge think wrong) for: 2 4 6 8 10 100 1000 10000 100000 200000 0 return : Crystal 1: 26 Crystal 2: 98 Crystal 3: 290 Crystal 4: 578 Crystal 5: 1154 Crystal 6: 854786 Crystal 7: 834185090 Crystal 8: 832136021570 Crystal 9: 831930692993858 Crystal 10: 6655340768473154 It's correct? wich ...
- Tue Mar 14, 2006 9:30 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10009 - All Roads Lead Where?
- Replies: 60
- Views: 16145
- Tue Feb 21, 2006 1:41 am
- Forum: Volume 7 (700-799)
- Topic: 785 - Grid Colouring
- Replies: 27
- Views: 14489
785
I think in some test was error. in string where must only 1 or more '_' as state in problem: each grid is terminated by a separation line full of underscores `_'. judge (if see carefull test file for 785 ) may wotch that situeted ' '(I think on end of string full of underscores `_' ) base on that so...
- Wed Feb 15, 2006 10:58 pm
- Forum: Other words
- Topic: source code of other members
- Replies: 6
- Views: 2842