Please subscribe to the official Codeforces channel in Telegram via the link: ×

Noureldin's blog

By Noureldin, history, 5 months ago, In English,

Hello CodeForces! I'd like to invite you to the online mirror of the 2017 ACM egyptian collegiate programming contest ,which will be held on Wednessday, 6 July 2018, 02:00pm Cairo time

contest link: ACM ECPC 2017

standings: link

ACM ECPC 2017 Highlights:

the problems were prepared and tested by : Thrax -chief judge-,Badry, Noureldin, SyrianPetr, safrout, Lvitsa, amrSamir, Amirnasr, islam-al-aarag, justHusam and RedStone

problems authors:

Assessment — islam-al-aarag

Breaking the curse — Badry

Cheering parabolas — Thrax

Dream Team — Lvitsa and Thrax

Evaluations — Noureldin

Forgot the Flag! — Noureldin

Glorious Stadium — SyrianPetr

Half Nice Years — Lvitsa and Thrax

Important matches — justHusam

Jacking ticket — Thrax

Katryoshka — Lvitsa

Lazy ERCD — Mohamed Fouad `

You will be given 5 hours to solve the problems.

Good Luck and have fun!

UPDATE as some of you found out the test sets weren't complete and only samples were ported to the gym version ... that's due to a mistake I made while porting the contest

what happened?

I tried importing the contest normally by coping the contest.xml to the ftp server but it generated alot of errors which I couldn't understand at the time so I imported the problems manually but forgot to run the and as a result none of the big test files were generated

now the contest is part of 'codeforces history' so I can't modify it, so I created another one with the original tests used in the contest so have fun with ECPC17

Read more »

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

By Noureldin, 4 years ago, In English,

for a competitive programmer the most important features are what C++11 has already introduced namely (range based loops ,lambda expressions ,brace initialization of aggregates, unordered containers ,..... etc) which can be found here .

in addition to:

1) numeric literals

now you can separate digits of a number with single quotes ( ' ) to improve readability

auto num = 10'000'000; // num = 10^7

this works for floating numbers as well

auto fnum = 0.000'015'3; // fnum = 1.53 * 10^-5

now you can initialize numbers using their binary form this feature was experimentally included in C++0x (the prototype of C++11) however it didn't become official until the announcement of the new standard

auto bnum = 0b0100'1100'0110; // bnum = (010011000110)2 = (4C6)16 = 1222

//note that the spacing of the quotes doesn't matter

auto snum = 1'0'0'000'00; // snum = 10^7

2) std::gets was removed due to its tendency to cause RTE due to overflow in its buffer

3) lambda expressions can now be generic:

in C++11 you had to specify the type of the inputs to the lambda expression

auto lambda = [](int x, int y) {return x + y;}; // C++11 --- had to specify type of x and y
auto lambda = [](auto x, auto y) {return x + y;}; // C++14 the compiler will decide the type for you ;)

4) improved std::tuple (in particular improved std::get)

in std::tuple introduced by C++11 (which was experimentally added to TR1 in 2007) to get the value of an element you had to use only its index

int element = std::get<2>(mytuple); //get the third element in mytuple

now you can do the same thing plus the ability to index by type

std::string element = std::get<string>(mytuple);// return the string element in mytuple

note: if the tuple had more than one element of the same type using std::get that way would cause compilation error

a feature of C++11 that's not mentioned in the link above that I find very useful

C++11 introduced the ability to pass rvalues by reference that's to pass temporary values by reference such as

// compilation error in C++03 .... legit in C++11 & C++14
string mul(string && a,string && b); 

as you can see from the specific example I used ,it speeds up calculuations in particular this snippet is from my biginteger implementation which sped up biginteger multiplication by 30-40% on average (tested on numbers containing ~ 50000 digits)

note: some legit C++03 && C++11 codes might break if compiled using C++14 standards

codes that use std::gets are the simplest case but there are others for more details you can refer to this link

finally ,there are some other additions and modifications in C++14 that are very important (relaxed constexpr restrictions ,improved lambda capture expressions ,the attribute [[deprecated]] ,heterogeneous lookup ,....etc) to name a few, yet their importance to a competitive programmer is less than that of the mentioned features (at least from my point of view)

Read more »

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