ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1208. Legendary Teams Contest

TEST CASE
Posted by GastonFontenla 30 May 2016 06:01
Here's the big test case:

18
a b c
d e f
g h i
j k l
m n o
p q r
s t u
v w x
y z 1
2 3 4
5 6 7
8 9 0
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27

If you are using bitmask be careful with:

*Use long long to store the bitmask. There can be 58 contestant (18*3) as showed above
*Be careful with casting in C/C++. I was using the following:


#define ll long long
void SB(ll &m, ll x)
{
    m = ((m) | (1 <<(x)));
}

But the (1 << (x)) part auto-cast to int. Hence the overflow

The correct should be:


#define ll long long
void SB(ll &m, ll x)
{
    m = ((m) | (1LL <<(x)));
}

Hope it help!


Edited by author 30.05.2016 06:02