Блог пользователя Anurag

Автор Anurag, 12 лет назад, По-английски

Contest Problems

A. A Simple Tree Problem How to solve this? My approach : Build rooted tree using two dimensional vector or say in form of linked list containing all the nodes for a parent.

operation — "o" use queue to negate all values. Query — "q" use queue to count all the nodes of subtree having values as non-zero.

My approach was leading to TLE. Can you please share your approach.

H. Happy Great BG

why my below solution is leading to WA?

Your code here...
while(scanf("%d%d%d",&N,&W,&K) == 3)
        {

            N=N+2;
            float cost=0.0;
            while(N > 0)
            {
                if(N>=K)
                {
                    cost+=(W*(K-1));
                    N=N-K;

                }
                else
                {
                    cost+=(W*N);
                    N=0;
                }

            }

            float ans=cost/2.0;
            printf("%.2f\n",ans);
            
        }

Полный текст и комментарии »

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится

Автор Anurag, 12 лет назад, По-английски

How we can find large Pell Number and its modulus in efficient way?

Problem 4: The Price of Death

Robert Baratheon, King of the Seven Kingdoms, is very insecure. He had led the rebellion which smashed the might of the previous king, Aerys (II) Targaryen (the Mad King). After the Mad King’s death, his wife gave birth to Daenerys who was then smuggled across the narrow sea to Pentos. Robert has now come to know of her existence and seeing that she holds a better claim to the Iron Throne, conspires to assassinate her. He thinks of hiring a Faceless Man to do the job. Little does he know of the price he would have to pay.

The Faceless Man assures that the execution will be a success but provides no definite time guarantees. For the nth minute he spends in Robert’s service, his price in silver coins is the sum of: the number of silver coins he earned the previous minute, twice those he earned two minutes before, thrice those he earned three minutes before and (once) those he earned four minutes before. For the first four minutes, his prices are 1, 2, 5 and 12 coins; the cost for the fifth minute is hence, 29. As payment he asks for the silver coins he earned in the Nth minute, where N is the number of minutes he is in Robert’s service. Since Robert does not know how much time the Faceless Man will take, he decides to find the cost for some values of N. Given this value, find the cost of the assassination modulo 10^9 + 7. Input :

First line an integer Q number of queries . Each of the following Q lines contains a integer N. Output :

For each query output an Integer which denote cost of assassination for Nth minute modulo 10^9 + 7 . Constratints :

1 <= Q <= 52000 1 <= N <= 10^18 Sample Input :

5

1

2

5

100

1000

Sample Output:

1

2

29

852799803

671754329

Source — IIT kharagpur Bitwise Programming Contest 2013

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Anurag, 12 лет назад, По-английски
  • Проголосовать: нравится
  • -22
  • Проголосовать: не нравится

Автор Anurag, 14 лет назад, По-английски

All of a sudden ,I can't see my rating graph as well as of others.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Anurag, 14 лет назад, По-английски
Options -

1. Misunderstanding the problem .

2.  Lack of Sample Test Cases.

3.  Tough to understand the Problem Statement.

4.  Corner Cases not taken into account.

5.  errors/bugs in the sourcecode

Please put ur opinion....

Полный текст и комментарии »

  • Проголосовать: нравится
  • +18
  • Проголосовать: не нравится

Автор Anurag, 14 лет назад, По-английски
Its a dream cup true for Master Blaster . Its a memorable moment for all indians. It happens ones or twice in a life time. I enjoyed seeing India winning this world cup.

Great effort by Gambhir. Without him we were at loss. Great captaincy by MS Dhoni






will add some more content to it......

Полный текст и комментарии »

  • Проголосовать: нравится
  • -28
  • Проголосовать: не нравится

Автор Anurag, 14 лет назад, По-английски
It was a great match. I loved watching it and finally saw india wining it comfortably. Yuvi is in great form . Raina paid no mercy to Lee and hit 6. Sachin and Gambhir built the early overs. After more than a decade Ausies are out of the World Cup. Next Match is more interesting where India meets Pakistan in Semi-final.......jeeto india jeeto.....

Полный текст и комментарии »

  • Проголосовать: нравится
  • -25
  • Проголосовать: не нравится

Автор Anurag, 14 лет назад, По-английски
Sub-round1
1. After the Dance Battle
2.
3.

Please tell on how to solve these problems?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

Автор Anurag, 14 лет назад, По-английски
The response of each page is very slow.Please fix it.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +17
  • Проголосовать: не нравится

Автор Anurag, 14 лет назад, По-английски
  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

Автор Anurag, 14 лет назад, По-английски
We Indians are celebrating  64th Independence Day .On this Auspicious Day I wish the whole world live in Peace and prosperity.

 

Полный текст и комментарии »

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

Автор Anurag, 14 лет назад, По-английски
Yesterday i participated in this contest On UVA OJ from Bangladesh

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=13&page=show_contest&contest=253

I am here to discuss about problem C(Cheerleaders) which i couldnot submit. The first two problems A and B were easier for me.
Problem C link
http://uva.onlinejudge.org/contests/253-dead8a0b/11806.html

Am i right? The problem can be solved considering the following cases
Case1 : There is non-zero solution only when K>=2. otherwise zero solution
if Case1 is true, then
Case2 :  The arrangment can be done in following way:
I. place 2 Cheerleaders on the one of the opposite corners and the rest          leaders can be  put in the rest of N*M-2 cells .
II place 2 Cheerleaders on other opposite corners and the rest leaders can be put in the rest of N*M-2 cells
III place 2 cheerleaders in adjacent corner and 1 leader on one side and the rest in the remaining N*M-3 cells
IV III way can  be repeated 3 more times
V place 3 cheerleaders in 3 corners and the rest in N*M-3 cells
VI V way can be repeated 2 more times
VII place 1 cheerleader(it will cover 2 sides) on one of the corner and 2 leaders on the other 2 sides and the rest leaders on N*M-3 cells
VIII VII way can be repeated 3 more times as we have 4 corners in total
IX
place 4 cheerleaders on all the 4 sides aand the remaining cheerleaders on the N*M-4 cellls

Thats'all
K
  should be appropriately dealt as sometimes (k has to be)
 I K>=2
 II K>=3
 III K>=4

Please comment whether this can provide a solution or not
One thing more at the UVA site can't i submit the solution to this problem any more?

Thanks for ur response

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Anurag, 15 лет назад, По-английски
Can any one tell how this algorithm works?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

Автор Anurag, 15 лет назад, По-английски
Its a "substring" searching problem. I misunderstood it for "subsequence" searching.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится