saba_tavdgiridze's blog

By saba_tavdgiridze, history, 7 years ago, In English

I know it's not best place to write this .Briefly, my problem is finding national chemistry Olympiads and team selection problems in English. Yep ,I tried Google But in vain, there is no information for Asian countries ,which are leaders in this subject( Korea , Japan , China , Vietnam , Thailand , Indonesia etc.) and strong European countries( post-soviet and north-east ) , and not only that .Finding all that maybe easy for you if you're native and you're involved with this Olympiads .Better ignore it than post senseless comments ! THANKS IN ADVANCE !!

Full text and comments »

  • Vote: I like it
  • -19
  • Vote: I do not like it

By saba_tavdgiridze, history, 7 years ago, In English

Hi , I was trying to solve this problem , which is about finding number of unique palindromic substrings in string of size n . As n can be large(10^5) ,only feasible is nlogn algorithm for this problem.Can you help me ? ( I was trying to solve with suffix array but don't succeed )

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it

By saba_tavdgiridze, history, 8 years ago, In English

Can you give me an idea how to solve this problem ? Hotels thanks.

Full text and comments »

By saba_tavdgiridze, history, 8 years ago, In English

Can anyone give me an idea how to solve this problem ? Tour de Byteotia Thanks in advance!

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By saba_tavdgiridze, history, 8 years ago, In English

Today I've solved this problem Vertical Rooks . This is Nim , but you can also add some stones , in editorial it's written that that's no difference because if someone adds some stones , you can by the way reduce the heap by the same number of stones . (That's intuitive : every time opponent adds some stones , I can decrease the number and It will be the same state . At some time he will be bored and I will win with optimal play . ) But I think it isn't correct . [my solution] in spite of we can add some stones to the heap . Grundy number of one heap will be same g(x) = x , so it's also nim.Is is correct?

Full text and comments »

  • Vote: I like it
  • +2
  • Vote: I do not like it

By saba_tavdgiridze, 9 years ago, In English

DSW algorithm is used to balance binary tree.There are two phases:
1)Create backbone(linked list-like tree);
2)transform backbone into a balanced tree;
There are Pseudocodes for both phase :
1)

createBeckbone(root,n)
   tmp = root;
   while( tmp!=0 )
      if tmp has a left child 
          rotate this child about tmp;
          set tmp to the child that just became parent;
      else set tmp to its right child;

2)

createPerfectTree(n)
    m=2^( floor(lg(n+1)))-1;
    make n-m rotations starting from the top of backbone;
    while (m > 1)
       m= m/2;
       make m rotations starting from the top of backbone;
   

I understood first phase,but I can't figure how second algorithm can guarantee perfectly balanced tree.If you know this algorithm please help.

Full text and comments »

  • Vote: I like it
  • +12
  • Vote: I do not like it

By saba_tavdgiridze, 9 years ago, In English

My solution for 194C gnu c++ and MS c++ this two identically solutions get different verdict — gnu c++ it's wrong answer but Ms c++ Accepted .I think that problem is in getchar() but why i don't know.Can you help me?

Full text and comments »

  • Vote: I like it
  • -7
  • Vote: I do not like it

By saba_tavdgiridze, 9 years ago, In English

Hi ,my solution for this problem is getting MLE .Can you give me any advises how to lessen memory use .

And also i have one question: how can i initialize global variable in main() function that i could use this variable in every other function (like this) :


void foo(void) { cout<<x<<endl; x+=5; } int main() { int x=5; foo(); return 0; }

Of course this program gets Compilation error.
Thanks in advance ^_^ . (sorry for my bad English)

Full text and comments »

  • Vote: I like it
  • -13
  • Vote: I do not like it

By saba_tavdgiridze, 10 years ago, In English

Hello! It's my first useful and solid blog at all( well, i think so )

Recently i was searching some information about useful data-structures, built-in functions and other interesting shortcuts in python. python is vary popular language among programmers, so I came up with an idea to write there brief review of this tasks(these may not be "very" interesting for "redcoders" I think :D )

(You maybe think that you can look up everything that you need in Python documantaion, but believe me, there things are little hard and messy to understand ;) )

Contents:

  • I/O (input/output)
  • ...
  • ...
  • ...
  • ...
  • ...
  • ...
  • ...

I/O(input/output)

Allmost every program has three components : input, processing and output.Python has a built-in function, called raw_input(), that's used to get input from the user.

  • raw_input() function :

The raw_input() function gets a string from the user. The normal way it gets this is from the keyboard(stdin) .Let's see some examples :

print "Please ,enter your name :"
name=raw_input()
print "Hello",name

There is a shortcut for printing prompt messages. The raw_input() function can print the message for you, so you don’t have to use a "print" statement:

name=raw_input("Please ,enter your name :")
print "Hello",name

Because raw_input() get string from stdin you can use int() or float() for your needs ,to get number( and not string ) :

number=int(raw_input("Please ,enter your number :"))
print "You entered",number

There is another way to get numbers as input. Python has a function called input() that gives you a number directly, so you don’t have to use int() or float() to convert it. However, there are some reasons not to use input(). One of them is that the input() function is removed from future versions of Python (versions 3.0 and later). There is only raw_input() and They renamed raw_input() as input().

will be continued ...

sorry for my bad English... ( Any remarks will be appreciated )

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By saba_tavdgiridze, 10 years ago, In English

At first,sorry for my agnorance.So lets say: Everytime when I submit solution in UVa online_judge I get wrong_answer,wrong_answer,wrong_answer,.... and it's very annoying . Even on very easy,one-line problems.In internet there are many solutions on UVa problems ,so after disappointment i looked up others codes and there were nothing to distinguish.So I ask you,What's may be reason of this? thanks in advance!!!

Full text and comments »

  • Vote: I like it
  • -4
  • Vote: I do not like it

By saba_tavdgiridze, 10 years ago, In English

A positive integer N is smaller than the sum of its three greatest divisors (naturally, excluding N itself). Which of the following statements is true? (A) All such N are divisible by 4. (B) All such N are divisible by 5.
(C) All such N are divisible by 6. (D) All such N are divisible by 7. (E) There is no such N.

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it

By saba_tavdgiridze, 10 years ago, In English

Why it's useful for competetive programming? Ise there uses of this algorithms?If yes,please comment.

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it

By saba_tavdgiridze, 10 years ago, In English

At first,hello codeforces!! Ok, I want to submit my solutions for izho problems,can you suggest anything,also on site I'cant find izho2014's problems,or .zip file with testcases or authors solutions.Please ,help me !! Happy coding today !!

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it

By saba_tavdgiridze, 10 years ago, translation, In English

a,b,c are real numbers.X equal minimum in[a,b,c,1-a-b-c].Task is to find maximum X.I think it is 1/4 ,but i can't prove.Can you help me , and also , how to solve problems like this?Thanks in advance!!

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

By saba_tavdgiridze, 10 years ago, In English

Hello everybody.I'm looking at this problem and I've no idea how to solve it. It's about that,with minimum number of 1's and operations of addition, multiplication and parenthesis you must obtain positive number n.

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By saba_tavdgiridze, 10 years ago, In English

Hello,I want to make my math knowledge more big.Can you comment online math sites where i can find olimpic problems?

Full text and comments »

  • Vote: I like it
  • +2
  • Vote: I do not like it

By saba_tavdgiridze, 10 years ago, In English

N numbers : a_1 ,a_2 ,a_3 ... a_N are written like this a_1 / a_2 /a_3/ .../a_N (there /-means division).You Can add some brackets .For example if sequence is : 5/6/7 you can make it like : 5/(6/7) .Your task is to maximize this product.Like example below it is 5/(6/7).Any algorithms?Thanks in advance!

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it