By StopRacismInICPC, history, 17 hours ago, In English,

As you may not know, starting this year the ICPC Africa regional qualifications was merged with the Arab contest (aka ACPC) to form the new Arab and Africa Collegiate Programming Contest. I’m a part of an African team that participated in this year’s contest, I'm going anonymous since people mentioned stories that who complains, gets threatened to be disqualified. This was our first participation and we were really excited and prepared really hard for this opportunity. Sadly we were shocked by how much racism we faced in an “African” country, not only from ignorant people on the street, but even from the contest director himself, “Mohamed Fouad”.

Before the contest started, Fouad was moving between teams and checking up on some of them, telling jokes and so on. When he stopped nearby us and said “We have added a very trivial problem specially for you, I hope that you will be able to understand it hahaha” and then he left. This was so offensive and depressing for us, and I was so shocked that I couldn’t even say a word. What a shameful action by such a person who should be an idol.

Also during the closing ceremony, there was an african group performing some entertainment show (dancing mainly), and suddenly the assistant of Fouad came to us and said, “Hey guys, why don’t you join them” and started laughing.

We didn’t do well in the contest, but that’s because it’s our first participation and the problem solving community in my country is not that great. But seeing how racist the directors were, and (as people are sharing) how corrupt and money driven these people are, I really hope that the ICPC administration will take an action if they really care about the community like they say.

Read more »

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

By hmehta, history, 23 hours ago, In English,

Hey All!

Topcoder SRM 772 is scheduled to start at 07:00 UTC -5, Dec 11, 2019. Registration is now open in the Web Arena or Applet and will close 5 minutes before the match begins.

Thanks to abdullahkool768 and vivek1998299 for writing the problems for the round. Also thanks to misof and adamant for coordinating and testing the round.

This is the fifth SRM of Stage 1 of TCO20 Algorithm Tournament.

Stage 1 TCO20 Points Leaderboard | Topcoder Java Applet | Next SRM 773 — Dec 21, 12:00 UTC-5

Some Important Links

Match Results (To access match results, rating changes, challenges, failure test cases)
Problem Archive (Top access previous problems with their categories and success rates)
Problem Writing (To access everything related to problem writing at Topcoder)
Algorithm Rankings (To access Algorithm Rankings)
Editorials (To access recent Editorials)

Good luck to everyone!

Read more »

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

By --Someone--, history, 5 days ago, In English,

Hi!

I'm just university freshman and I've been doing cp for 2-3 years. I'm planning to spend my upcoming 3-4 years for learning cp. My current goal for this period is to reach grandmaster. From one side, for me it seems it's somehow possible, by working hard and also considering I've 3-4 years, but from the other side we can see so many people struggling in orange or purple for many years and also considering I'm not good at math and I don't have special skills.

So I want to ask you how hard is it to become red? Is it somehow possible for me or do I need to change my goal? Also it would be perfect if you (I mean red guys) shared your stories on making red(how much time did it take, how hard it was, etc.).

Thanks in advance)

P.S I'm not asking about how to become red because it's asked before in so many blogs, I'm asking about how hard is it to become red.

Read more »

Tags red
 
 
 
 
  • Vote: I like it
  • +171
  • Vote: I do not like it

By xiaowuc1, history, 34 hours ago, In English,

Hi all,

The first contest of the 2019-2020 USACO season will be running from December 13th to December 16th this weekend. Good luck to everyone! Please wait until the contest is over for everyone before discussing problems here.

Read more »

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

By snapdragon3101, 35 hours ago, In English,

Hi Guys !

You guys are truly amazing. I created CP Editor around 3 months ago just for fun and personal use, never wanted to make it public but anyways, I decided to make it public with this blog. I got so much love and support that I could not hold myself back from improving it, in following weeks I released the second version in this blog. Fixing a lot of issues and bringing new features.

Today I announce the final release in this iteration, CP Editor 3.0

Let's get into what is new for us in the Final release of CP Editor

What's New

  • Now you can Expand the size of the Input, Output and Message box. (Right click on the box and Click Expand)

  • Now you can Read Input from files in Input boxes. (Right click, Expand and Click Read from file)

  • Editor now also Optionally accepts Expected Output that you can give to check if your output is same as expected.

  • Editor now also Shows Verdict If you have provided Expected Output. Verdict can be any of three :

    • AC : Accepted, Verdict given when Output matches with Expected Output
    • WA : Wrong Answer, Verdict given when Output does not matches with Expected Output
    • ** : Unknown, Either Expected or Your Program's stdout is Empty.
  • Diff viewer has been added to check the difference between the Expected and Produced Output. (Click More to view Diff)

  • Now you can set your tab sizes.

  • Added Competitive Companion in the Editor. So don't have to copy paste Input/Output manually, Competitive Companion fetches testcases for you. Set it up as follow :

    • Go to Extension Settings and change Competitive Companion port to 10045. (You can set anything above 10,000)
    • Open CP Editor go to Competitive Companion and Change Port, Set it to the value of you specified in last Step.
    • Enable Competitive Companion in CP Editor. If Everything went okay, CP Editor will start to listen on 127.0.0.1:<port>
    • Go to any problem in any competitive programming site. Like Codeforces, Codechef, AtCoder etc.
    • Click on parse Task Icon. This icon is added by the browser extension in status bar. (A Green Plus Icon)
    • Switch back to CP Editor. You will have a new session started with Input and Expected Output box filled with testcases. You will also see some comments in your source editor in the starting line. It will have information like Problem Name, Contest Name, Time and Memory constraints, followed by your template, if specified.
    • When you have written your solution, click Run or Compile and Run. Below the output Box you will see One of the above Verdict. You can click More to view difference between your produced and expected output. You can also change Expected output Manually or Read it from a file.
  • Always Save your code, as soon as you click parse and editor gets the request and It will delete the current editor buffer and start a new session.

What's Fixed

  • Fixed the issue where { always automatically added a new line with }

  • Fixed Tab and Spaces mix-up, in the old version if you enable Use Tabs, the editor still used Spaces for indentation.

  • Fixed issue where if user was not opted for beta. Still they get beta update notifications.

Troubleshooting and General Information

  • Make sure Competitive companion extension port and CP Editor Companion port are same and above 10,000.

  • Make sure no other server is listening on the port. If this is the reason you may have to change the port to something else that is not being used.

  • Two instances of CP Editor will not be able to run Companion, because only one of them can listen at one port.

  • Competitive Companion can also parse Contests. Make sure you are on a problem page when you press parse Task not on a contest page.

  • If a problem has more than Sample 3 testcases. The Editor will discard all testcases except first three.

  • I have not much experience with Windows, So if your OS has a firewall that prevents CP Editor from listening or request from arriving, you may need to add an exception for the port in your Anti-virus or firewall settings.

Screenshots

Verdict Bar

Diff-viewer

Parsed Problem header

Download

Sources : https://github.com/coder3101/cp-editor2

Download : https://github.com/coder3101/cp-editor2/releases

Support me with Stars as most of you guys don't earn money

Read more »

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

By Fype, 36 hours ago, In English,

Problem : You have an array a of size $$$n$$$. for each $$$i$$$ ($$${i \le n}$$$) you have to find maximum $$$j$$$ such that $$${1 \le j < i}$$$ and $$${a_j > a_i}$$$ and if there is no $$$j$$$, consider the answer for $$$i$$$ equal to $$$0$$$, solve the problem with total complexity $$${O(n)}$$$.

Solution 1 : Of course there is an easy solution using stack.

for (int i = 1; i <= n; i++) {
    while (s.size() && a[s.top()] <= a[i])
        s.pop();
    if (s.size())
        L[i] = s.top();
    s.push(i);
}

Solution 2 : About 2-3 month ago I suggested a dp solution for this problem and i never thought that it would be $$${O(n)}$$$ but here I am sharing it with you :D
$$${dp_i = }$$$ answer for i.
So how can we update this dp?!, let's check maximum $$$j$$$ that can be the answer for $$$dp_i$$$. It's obvious that if $$${a_{i - 1} > a_i}$$$ the answer is $$$i - 1$$$.
what if $$${a_{i - 1} \le a_i}$$$ : then the answer isn't in range $$$(dp_{i - 1}, i]$$$ so the next number we should check is $$$dp_{i - 1}$$$ and if it wasn't answer that we need we should check $$$dp_{dp_{i - 1}}$$$, and then $$$dp_{dp_{dp_{i - 1}}}$$$ and so on.
Do you see the pattern?! :D

int find_ans(int i, int j) {
    if (!j)
        return j;
    return (a[j] > a[i]? j: find_ans(i, dp[j]));
}
for (int i = 1; i <= n; i++)
    dp[i] = find_ans(i, i - 1);

some problems :

Task Postering (pla)
Psychos in a Line
Task Little Bird (pta)
These problems aren't necessarily the exact problem but the main idea is same.

Read more »

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

By I_love_Hoang_Yen, history, 2 days ago, In English,

Hi,

We have added the problems from 2019 ICPC Asia Danang Regional on Kattis. I think the problems are very interesting and fun.

I have created a contest on Kattis on Sun, Dec 15th, 7pm GMT+7. But you can also create your own contests.

Problems were prepared by:

Read more »

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

By Nightmare05, history, 19 hours ago, In English,

Hi guys,

We recently gave ICPC regionals at Asia-Kharagpur site and there were some problems that we couldn't solve within the allotted time and we aren't yet allowed to make submissions on online mirror round on codechef, so is there any other way/loophole which we can use to make practice submissions on those problems now, we really wanna test our codes.

Any help would be appreciated.

Read more »

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

By white_horseman, 36 hours ago, In English,

C++ STL support all of the three data structures. Stack offers LIFO type operation, and queue offers FIFO type operation. But on the other hand, deque gives user the flexibility to add/remove elements from both it's end — front and back. Thereby deque can mimic the operations of both stack and queue if required. But there is more to it...

I conducted the tests on all three of them to test their performance by using a simple code that inserted 50000000 elements into the data structure then popped all out one by one. I found out that deque is roughly 10% faster than both stack and queue which can be understood from the fact that deque is the underlying container for both stack and queue which can be seen here as mentioned in comments. Also, deque supports range-based for loop iteration, which is unavailable for stack and queue(both of them require to create temporary copy for iteration). Thereby deque supports all operations much more faster than both stack and queue. So why not use dequeue instead of stack and queue ;)

Read more »

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

By z4120, history, 16 hours ago, In English,

tl;dr:

If you want to try to figure it out, read below and don't open this

Recently I was writing some code that looks roughly like this:

double value= /* something */;
for(double step=1024;step>1e-8;step/=2)if(value-step>0){
	value-=step;
	// long long code to check condition satisfied
	if(not ok)
		value+=step;
}

While it gives correct answer locally on all sample test case, the result is wrong on Codeforces machine.

I had no idea what's going on, then decide to add a debug statement to the begin of the // long long code block. However, when I add anything there (even cout<<"";) the code gives the correct answer.

Initially I thought there's some undefined behavior, but I compiled with sanitization turned on, and there's no error reported.

Switching to another compiler works well on that particular test case.

Can you guess what could be the cause? (It's a bug in the code, not a compiler bug.)

(Of course if You're given the complete code and debug it for a while, you'll be able to find out the bug as well. The point here is that, can you guess what's the problem?)

Spoiler

Even if you knew about the behavior already (like me while debugging the code), I hope this blog can be useful to you when your code happen to have such a hard-to-explain behavior.

Read more »

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