ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1510. Order

PLEASE,HELP ME!!!!!!!!!!!!!!!!!! I HAVE 2 PROGRAMM!!!!!!!!ONE OF THEM TLE#19,ANOTHER TLE#20
Posted by CHIDEMYAN SERGEY 14 Mar 2007 20:55
Edited by author 17.03.2007 22:05

Edited by author 17.03.2007 22:05

Edited by author 17.03.2007 22:49
HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by CHIDEMYAN SERGEY 17 Mar 2007 22:48


Edited by author 19.03.2007 18:44
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Romko [Lviv NU] 17 Mar 2007 23:41
Your program is O(n^2). But you can write simple quick sort(O(n*log(n))) and got AC!!!
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by CHIDEMYAN SERGEY 17 Mar 2007 23:48
SORRY!IM BEGINNER,AND I SHALL VERY PLEASED TO YOU IF YOU SAY ME WHAT IT MEANS O(n*log(n))) OR O(n^2). THANK!!!!

Edited by author 17.03.2007 23:49
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by CHIDEMYAN SERGEY 18 Mar 2007 00:54
I think I found book about quick sort

Edited by author 18.03.2007 00:54
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by CHIDEMYAN SERGEY 18 Mar 2007 01:18
It so hard????
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by KIRILL(ArcSTU) 18 Mar 2007 02:33
No :)
Qsort is standart sorting  algo
you should not understand how it's work deeply just
use it when you need(copypost:) or use included in C++

by the way this problem can be solved in  O(n)
if you post your mail I can send you several variants

P.S.
O() is complexity of algo
shortly to say
for example

for i:=1 to n  do ...     O(n)

for i:=1 to n  do
for j:=1 to n  do ...   O(n^2)

but it's very stupid definition:)

Edited by author 18.03.2007 02:37
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Romko [Lviv NU] 18 Mar 2007 14:12
Why O(n), I think it's O(2*n)!!!
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by KIRILL(ArcSTU) 18 Mar 2007 15:29
Romko [Lviv NU] wrote 18 March 2007 14:12
Why O(n), I think it's O(2*n)!!!
:)

O(2*n)= O(3*n)=O(100000000000000000*n) = O(n)
constant is not uses with n in O

so with small n sometimes O(N^2) solutions work faster then
O(n) because of constant


my O(n) is only 1 cycle for input for i:=1 to n
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by CHIDEMYAN SERGEY 18 Mar 2007 20:27
MY mail:serchch@mail.ru!THANK YOU VERY much!YOU HELP me second time!!!!THANK YOU!!!!!!!!
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by CHIDEMYAN SERGEY 19 Mar 2007 16:38
IS QSORT FUNCTION USE IN <ALGORITHM>?

Edited by author 19.03.2007 17:50
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by CHIDEMYAN SERGEY 19 Mar 2007 17:50
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Romko [Lviv NU] 19 Mar 2007 18:02
YES.
int a[100];
sort(a,a+100);
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by CHIDEMYAN SERGEY 19 Mar 2007 18:14


Edited by author 19.03.2007 18:43

Edited by author 19.03.2007 18:43
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Romko [Lviv NU] 19 Mar 2007 18:16
My algo is the same :)
[DELETED]

Edited by author 19.03.2007 18:34
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by CHIDEMYAN SERGEY 19 Mar 2007 18:23
SORRY!CAN YOU SAY WHAT MEANS MALLOC?THANK!!!!

Edited by author 19.03.2007 18:24
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Romko [Lviv NU] 19 Mar 2007 18:27
char *t;
t = (char*)malloc(sizeof(char)*10);
equal to
char *t = new char[10];
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by CHIDEMYAN SERGEY 19 Mar 2007 18:32
THANK!!!NOW I UNDERSTAND!
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Romko [Lviv NU] 19 Mar 2007 18:34
:)