Comments

Me after reading the solution of problem C

Thanks!! I have added this little function to my .zshrc file which will automate the process of generating the templates and opening the cpp files into vim (I am using MacVim)

function race() {
  cf race $1
  cd /Users/mountasser/cf/contest/$1
  find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && cf gen" \;
  vi */*.cpp
}


All you need now is type race 'contestid' and start solving the problems. thanks again!

On galen_colinMy approach to problems, 5 years ago
+10

You can check his channel he has already done two dp videos
Part one
Part two

On galen_colinMy approach to problems, 5 years ago
+8

Nice tags LOL

+25

You're trying so hard bro.. go get a life and stop trying to be codeforces sherlock holmes, but what would we expect from a new account that doesn't have balls to comment with his main account.

+25

I don't think that this is about IQ. why? because I see some improvements on my performances after practicing some few problems and I don't think that my new me is more smarter than old me just because i can now solve 3/4 problems on div3 and 2 problems on div2 (I wasn't able to solve any problem on my first 3 contests). It's all about practice. and about getting job c'moon dude we just kidding here and I was able to make money as a freelancer when I was 13 as a web developer.. and I'm doing cp just because I like it, i can get a job without cp.

+14

"competitive programming won't guarantee you any job but it is a nice way to spend time if you're jobless"

On jd_salDIV 2C and DIV 2D topics, 6 years ago
0

I don't think this is a good idea! if you find your solution needs a hash table of vector as a key try to think about another approach to the problem.
About your question yes you can use vector as a key, All you need is to have a GOOD HASH FUNCTION to avoid collisions (No different vectors with the same hash)

This is an example how you can do it, and I don't think that this is the best hash function you can came up with.

struct HASH {
    int operator()(const vector<int> &V) const {
        int hash=0;
        for(int i=0;i<V.size();i++) {
            hash^=V[i];
        }
        return hash;
    }
};
int main() {
        unordered_map<vector<int>,int,HASH> mp;
	vi test = {1,5,6,3,6};
	vi test2 = {1,5,6,3,3};
	vi test3 = {1,5,6,3,8};
	mp[test] = 10;
	mp[test2] = 11;
	mp[test3] = 12;
	cout<<mp[test]<<"\n";  // output : 10
	cout<<mp[test2]<<"\n"; // output : 11
	cout<<mp[test3]<<"\n"; // output : 12
	return 0;
}

+15

is Vim good for competitive coding? Yes if you master vim you can do any text typing/editing faster including coding.
Should you learn it? it's not a necessary for competitive programming you can use any text editor and you will be fine. But if you want to learn vim to make you a better developer Go and learn it, otherwise you can use any text editor:(Sublim, Vscode, atom) or use a vim plug-gin in your IDE like I did with xcode and now I'm using MacVim.

On malfpleCP Series, 6 years ago
+19

Now I can read manga and learn CP at the same time, thanks!

On JatanaCodeforces Round #612, 6 years ago
+11

On JatanaCodeforces Round #612, 6 years ago
0

Thanks I will train just in virtual contests maybe that will help me

On JatanaCodeforces Round #612, 6 years ago
0

I know how to debug but I have a problem in generating test cases by myself

On JatanaCodeforces Round #612, 6 years ago
0

Terrible
I have a problem with live contests usually I can solve div2A in < 15 min and div2B in < 30 min (in training)
But I need to see the test cases to see why I get WA... if someone know how to get over such a problem..
Yes and i will be newbie after this round

On antontrygubO_oGood Bye 2019, 6 years ago
0

Create a new account and start joining live contests. and when you start felling that you're doing well you can start with your main account.

On antontrygubO_oGood Bye 2019, 6 years ago
0

Problem C:
-> s = sum of all Ai
-> x = xor of all Ai
if you add x to the array
-> now the sum is s + x and the xor is 0 (x xor x = 0)
after that you add s + x to the new array
-> the sum is s + x + s + x and the xor is s + x ( a xor 0 = a )