Search found 16 matches

by Pavl0
Fri Aug 06, 2004 1:47 pm
Forum: Volume 102 (10200-10299)
Topic: 10245 - The Closest Pair Problem
Replies: 92
Views: 33489

10245 - The Closest Pair Problem - brute force => WA :|

J get WA by brutr force, first j sort all points by x
next check all n^2 , witch some optimalization by x
end get WA plese give mi some sample input/output
or find bug im my prog
meybe problem is in rounding ??

[c]

#include<stdio.h>
#include<stdlib.h>
#include<math.h>

struct point
{
long double ...
by Pavl0
Thu Jul 29, 2004 1:01 pm
Forum: Algorithms
Topic: can any body inform me the best prime generating algorithm ?
Replies: 17
Views: 7768

Jdont like Sieve of Eratosthenes :P

somthing like that take les memory (only prime numbers)

for(i=6;i<=2000000;i+=6)
{
for(j=0;;j++){ if((i-1)%fst[j]==0)break; if((fst[j]*fst[j])>(i-1))
{fst[liczp]=i-1; countprime++; break;}}
for(j=0;;j++){ if((i+1)%fst[j]==0)break; if((fst[j]*fst[j])>(i+1))
{fst ...
by Pavl0
Thu Jul 29, 2004 12:15 pm
Forum: Volume 106 (10600-10699)
Topic: 10604 - Chemical Reaction
Replies: 24
Views: 19045

J get AC 0:00.158
after one modification j was geting TLE
J using dymic programing + recurence
all data stored in int tst[11][11][11][11][11][11]; table
and all secret is DO NOT CLEAR TABLE it take too much time
beter is declarate second table tst[11][11][11][11][11][11];
end for valible data who ...
by Pavl0
Thu Jul 29, 2004 9:52 am
Forum: Algorithms
Topic: Segmentation Fault
Replies: 6
Views: 2340

in stl you must resize tables,vectors etc. some times j think :roll:
but j don't know execly becose j don't use stl

but if you use normal table[12] end your prog will call table[19] it will be segmentation
by Pavl0
Thu Jul 29, 2004 9:30 am
Forum: Algorithms
Topic: tree matching algorithm
Replies: 3
Views: 4080

in what problem this algo can be used ??
by Pavl0
Thu Jul 29, 2004 9:28 am
Forum: Algorithms
Topic: I'm collecting cool graph algorithms problems
Replies: 13
Views: 6887

10054 - euler problem , but j get WA :(
by Pavl0
Thu Jul 29, 2004 9:26 am
Forum: Algorithms
Topic: BigInteger
Replies: 10
Views: 4060

in c++ sometimes j use long double
but most time you must wrore your implementation big num

for example table
0 1 2 3 4 5
4 5 6 7 5 3

can reprezent number 456753
by Pavl0
Wed Jul 28, 2004 5:00 pm
Forum: Volume 6 (600-699)
Topic: 640 - Self Numbers
Replies: 47
Views: 25854

U can also check all number if it is self number :)
J get AC by deleting numbers who are not self number's
by Pavl0
Wed Jul 28, 2004 4:52 pm
Forum: Algorithms
Topic: BACKTRACKING
Replies: 5
Views: 2831

same problems can be slove by itteration by cheacking all ways witchaut backtraicing for example knapsack problem can be sloved by backtraicing
end also you can benerate all numbers in binary
n=3
000
001
010
100
011
....

means you take thing where is 1
all numbers can be grenrate witchaut ...
by Pavl0
Wed Jul 28, 2004 9:32 am
Forum: Volume 1 (100-199)
Topic: 167 - The Sultan's Successors
Replies: 21
Views: 6497

my prog find all 92 positions at start prog end use it far all cases
J get AC
J use iterratin methot for nqp for 8 is fast :)
by Pavl0
Wed Jul 28, 2004 9:13 am
Forum: Algorithms
Topic: Euler circuit
Replies: 2
Views: 2068

You can use modification of DFS

DFS( V)
{

for all E DFS(E.V)

add_to list(V);

}

it will give you list of V in euler cycle
end renember check all E only one time
by Pavl0
Fri Jul 09, 2004 10:21 pm
Forum: Volume 106 (10600-10699)
Topic: 10680 - LCM
Replies: 38
Views: 19507

my prog pass all tests but get wa :(
by Pavl0
Tue Jul 06, 2004 8:28 am
Forum: Volume 106 (10600-10699)
Topic: 10680 - LCM
Replies: 38
Views: 19507

j use this algoritm but j get wa
pleas give me some simple input output
program pased all input who was on forum

#include <stdio.h>


unsigned int pierwsze[100000];
unsigned int fstost[100000];


unsigned int liczp=2;
unsigned int oset;

unsigned int iled;
unsigned int ilep;



unsigned int ...
by Pavl0
Wed May 19, 2004 7:51 pm
Forum: Volume 5 (500-599)
Topic: 530 - Binomial Showdown
Replies: 137
Views: 49042

the fastest way j know is using dynamic programing end formula:

nCr(n,r) = nCr(n-1,r-1) + nCr(n-1,r);

but j cant go AC :| but this way j hot AC in 369 - it's very symilar but easest



sory 4 me englisz :)
by Pavl0
Fri Apr 23, 2004 2:54 pm
Forum: Volume 100 (10000-10099)
Topic: 10062 - Tell me the frequencies!
Replies: 235
Views: 69435

10062 tell me frequences!!!! WA 10062

hello
why j get wa ??


#include<stdio.h>

char stat [512];

void pw(void)
{
int i,j;

for(i=1;i!=1024;i++)
{
j=500;
while(j--)
{
if(stat[j]==i)printf("%d %d\n",j,stat[j]);
}

}

}

main()
{
int i;
char ch;

while(1)
{
ch=getchar();
if(ch=='\n'|| ch=='\r'){pw(); for(i=0;i!=512 ...

Go to advanced search