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

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

I cant understand whats the problem with test case 66(n=10^5 k=1).It gives TLE. During the contest I submitted this code and it gives TLE in 66. After the contest when I saw the test case ,I put a condition of checking if k=1 for immediate passing ,just to see if it worked,and it again gave TLE(code). I used BufferedReader to check if its because of large inputs,but again TLE(code). And its not only me but many who got TLE in 66 using java(see this page). Please tell me where is it going wrong because in test case 65 also n=10^5,k=1 so it cant be a sorting issue or a input issue...But immediately after reading inputs and sorting I am displaying the result for k=1.Then why is it passing for 65 and failing for 66.

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

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

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

Recently I had seen a blog titled something like -**bookmark** and had the links to all tutorial blogs in codeforces.However I was busy that time preparing for my exams, so I could not read it...But now I cant access that blog.Is there a way to find the "older blogs" or does anyone remember that blog...Please share it if you have

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

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

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

Today I had an argument in the viva session with my teacher on the limitations of the Dijkstra algorithm :(
I told that Dijkstra is not applicable if the graph has a negative weight cycle while the teacher says that it is not applicable if it has negative weight edges.That is the graph containing negative weight edges does not compute shortest path correctly even if it does not contain negative weight cycles.
Please anyone clarify my doubt and also give any book or site ,so that I can show it  as a proof to my teacher,(in case I am correct).

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

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

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

Hi there!!
I do not know hoe to implement the Dijksta so could not submit to 144D of codeforces round 103.
After that I took the help of somersault's code.
But my implemtation gives me a compilation error.Note that I have not written the full code.I just wanted to implement Dijkstra.Please help me.

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

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

Автор phantom11, 13 лет назад, По-английски
During my routine practice of topcoder problems, I was troubled a lot by the HourGlass Problem.
In the editorial the author talked about a different approach in the last paragraph but failed to explain it.
Can somebody please explain me why the formula works??

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

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

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

I have just started to learn the 8086 assembly language.The task is to print the sum of 2 16 bit numbers.Here's my code:
org 100h
start:
mov al,5
add al,3
mov dl,al
mov ax,2h
int 21h
end start
But the output is the ascii value of 8.I want to know if there is a way to print the decimal value of 8.If yes then how???

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

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

Автор phantom11, 13 лет назад, По-английски
There is a maze of size NxN.You need to find the shortest path from 'S' to 'E' making sure you reach all blue positions marked 'B' and do not reach any red position marked 'R'.If there is no path then print -1.
How to solve this problem??

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

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

Автор phantom11, 13 лет назад, По-английски
Hello coders,
I was preparing for the regional finals and came across a question which asks to find the number of ways in which a circular array can be divided into two parts such that sum of elements in both parts is equal.
So this has to do something with cumulative sum in an array.One of the participants wrote the following code(presenting the snippet only)

total=sum of all elements/2
if total%2==1 return 0
for(i=0 to n-1)
{
sum+=a[i]
ans+=cnt[sum]
cnt[sum+total]++
}
print ans

I want to know what is the logic behind this...Also if some one has links/or has some more questions involving cumulative sum of circular arrays please post it(I guess this is author's favourite topic)..Thanks in advance

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

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

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

Here are a few suggestions from my side to the codeforces team...I hope they will give some thought on these:

1)Editorials-There should be an editorial tab like the problem set tab or may be an official editorial blog.So that after trying out problems form the problem set if one wishes he can look at the editorials .Even topcoder has an editorial page.

2)Contest timings-The contest timings are almost always the same and many people globally face issues participating  at that time.Since there are about 4 contests in a month each of them can be on the different quarters (24 hour has 4 quarters).

3)Deleting a blog /comment-There should be a provision for a user to delete his blog or a comment.After all it is his blog and therefore his wish to keep it or discard it.

4)Division layouts-At present there are 1485 in Div 1 and 8713 in div2(almost 6 times more).To balance this I suggest that there should be 3 divisions[ Div 1-(>=2000) Div2(>=1600) and Div3 (<1600)]..Implementing this in the present scenario we will have 350 Div 1,2358 in Div 2 and 7490 Div 3 participants .This will increase competitions in the division and give better scope to improve .This also smoothens the transistion from a Beginner->Intermediate->Expert

5)Annual Open Round-To make things different than the usual weekly contests, there may be 1 annual open round like topcoder does.That will make codeforces look even much more brighter among all other online coding systems.

I hope these will be looked at by the codeforces team.You people are doing a wonderful job making coding much more enjoyable for regulars and interesting for the newcomers.Thanks for your efforts.

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

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

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

I was reading convex hull for the first time from CLRS.I thought for another algorithm that would work in O(n) time.I tested it for many test cases and it works fine.Can anyone point out flaws in the algorithm or support it.(Sorry for my bad english)
Lokesh-Scan(Points P)
{
 1.find the leftmost,rightmost,uppermost and lowermost points.In case of ties take the lower-left and upper    right most points;//Since these points are the corner ones they have to be in the hull/
2.Join the above mentioned points;//i.e include them in the hull
3.Now treat the four lines as reference axes individually.i.e if suppose p1,p2,p3,p4 are the lower,right,upper and left points respectively then firstly take p2 as origin and the line p2->p1 as the positive x-axis.If there are any points in the 1st quadrant of this axis system, include the one which has the maximum positive height from the axis in the hull.
4.Do this for all the four lines.(p2->p1,p3->p2,p4->p3 and p1->p4)
}
This algorithm (if correct) works in O(n) time.Line 1 takes O(n) time and line 3 takes O(n) time..
I hope I have made myself clear.Looking for your replies......

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

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

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

Hi friends,
I used the Chelper plugin of Egor and it works well in codeforces.
Then I tried to setup the moj plugin for topcoder arena.I installed it and got the"4 foundS" when I verified it.
But I am not sure how to use it in IntelliJ i.e. how to install it in IntelliJ or with Chelper, how to test my codes ,how to submit etc.(basically all the implementations of the plugins).
Any help to solve my queries will   be regarded...

UPD:Its done.lovro helped me do it.Thanks to him.For those who could not do it here's what to do:

1)Download the plugin.

2)follow the steps written in the instruction file .

3)Arena->editor->select CodeProcessor->configure->select fileedit->configure->goto template ->paste this code

And Yipee!!! now you dont have to test each and every test case in the arena.Your local editor does that for you(for JAVA and c++only).All you have to do is open the problem file in the arena ->the problem file is generated in the folder specified ->write the code(you can see the result for all test cases when you run it locally)->compile in the arena->submit and yipee you saved so much time.....:)





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

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

Автор phantom11, 13 лет назад, По-английски
Hi coders,
I was wondering of a way to sort a 2-D structure in which one set has keys and other  has value.
For eg-
A={0,7,4,7}
B={0,1,2,3}
B has the keys and A has the value.After sorting the arrays should be:
A={0,4,7,7}
B={0,2,1,3}

What is the best way to do this?What will be the best data structure for this?
I feel that HashMap can do it.but i have problems implementing it.

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

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

Автор phantom11, 13 лет назад, По-английски
Hello coders,
I have made several classes consisting of the different frequently used algorithm implementations like bfs,dfs,permutations ,combinations etc.etc.I have a couple of question:

1)Can I create a package of these classes and use it in different online judges like codeforces,codechef,topcoders.....like I only have to import algorithms.*;
2)If Yes,Then how to create such a package.If no then what are the other better options to use these in the problems of online judge(other than copying and pasting or saving them as a template).

Any help will be appreciated and regareded.
Thanks

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

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

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

Hello friends, 

I am looking for a coach who could enhance my programming skills.I am ready to pay the fees (provided its in my budget) ,but the teacher has to assure me that he will take regular classes and help me out.If anyone is interested or knows whom to contact ,Please tell me. My e-mail is lokesh.khandelwal92@gmail.com I live in Jamshedpur,India.It would be nicer if I get a live coach ,But I wont mind having an e-coach as well.  

 Regards.

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

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

Автор phantom11, 13 лет назад, По-английски
I am not able to reply or add my comment to the existing blogs from the last 2 to 3 days.Could anybody help me :Why this is happening or what should be done?? Whenever I click on the "reply" or "Write comment" the page just reloads.

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

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

Автор phantom11, 13 лет назад, По-английски
Can someone tell me how to calculate the coefficient of x^k in the term: (1+x+x^2......x^n1)(1+x+x^2+....x^n2)........(1+x+x^2.....n^m)

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

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

Автор phantom11, 13 лет назад, По-английски
I was going through one of the problems from the past IOI contests and got stuck..
Its the 1990 contest round 1 problem 1 .Please help me in this ,how to proceed???

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

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

Автор phantom11, 13 лет назад, По-английски
Hello everyone!! I just covered the dynamic programming and greedy methods from T.H.Cormen book but I have not understood 1 thing.
How can we come to a conclusion whether a program can be solved by greedy method or not???Plz answer my question
Any help would be appreciated.

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

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

Автор phantom11, 13 лет назад, По-английски
Hello everyone..I have to conduct a programming contest in my school and I want to make it as good as possible.So I am thinking of organizing it like Codeforces does.But I dont know how does a system work when it is given a solution.i.e. how are test cases checked by the main computer and how does it update scores instantly and also gives the participant the verdict instantly
So I need some help on this..Any help would be appreciated.Thanks in advance.
Note:Its a JAVA programming contest.

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

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

Автор phantom11, 13 лет назад, По-английски
Hi everyone...Is there any system in codeforces to give and accept friend requests???In other words how to make a friend in codeforces???

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

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

Автор phantom11, 13 лет назад, По-английски
Can anyone please tell me when are the ratings changed after the contest and system testings are done...(I mean after how much time)...

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

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

Автор phantom11, 13 лет назад, По-английски
Can anyone explain how and when to use the generator in the contest while hacking??

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

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

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

Hi!!! Is there any prizes for winning these Beta rounds???

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

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

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

I participated in the Unknown Language Round and fortunately was able to solve the first problem somehow..I got a rank of 212...Still why am i unrated???could anybody help me??

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

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

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

Is there any formula to calculate ratings??? does it increase on solving from the problem set??

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

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