Hi!

On Monday, July 31, 2017, at 14:35 UTC rated Codeforces Round #427 for participants from the second division will take place. As always, participants from the first division can take part out of competition.

The problems for this round were prepared by me. Many thanks to Alexey Ilyukhov (Livace) for help in preparations of the round and testing the problems, AmirReza PoorAkhavan (Arpa) for proofreading the statements and testing the problems, Gaev Alexandr (krock21) for testing the problems, Nikolay Kalinin (KAN) for the round coordination and, of course, Mike Mirzayanov (MikeMirzayanov) for great Codeforces and Polygon platforms.

The round will last for 2 hours, and you will be given 6 problems. I recommend you to read the statements of all problems. I hope everyone will find an interesting problem!

Scoring will be announced before the round.

**Scoring**: 500 — 750 — 1250 — 1500 — 2250 — 2250.

**UPD.**

Thanks for participating!

The editorial is here.

Congratulations to the winners!

Div2:

Div1:

wow, already another round, i'm exited!

yeah, I know, it's awesome!

Damnit codeforces, two consecutive rounds is too much.

There can never be too many rounds! :)

I think of contests as opportunities of improvement; you should too :)

Yes, but jesus. Let me rest for a bit.

Hey, nobody forces you to participate.

well said. ha ha ha

I think that it`s a great chance to do your best tomorrow, if you had problems today, or a great opportunity to become stronger :)

You are right!

First off, there are two rounds to help you improve on your programming skills, and second, you don't need to participate, you can do what you want. I am pretty sure the reason you registered for Codeforces is to get better, am I correct? FYI, no swearing is allowed in Codeforces. :)

2 rounds who ?

try 4 :v

http://codeforces.com/blog/entry/49236

Has anyone ever told you you look like Russel from Up? :)

Way too many times.

Hope short statements like your announcement :)

how can registration? please tell me

By clicking " register now " in top right of this page/ home page ..

Register

click Contest from the bar in the top then you will find this contest click register

2 rounds in 2 days..amazing..

Two consecutive rounds.. in one time, when some people just are not able to take part — they are sleeping, including me :(

2 rounds in 2 days?

sign me the FUCK up good shit go౦ԁ sHit thats some good shit right there right there if i do ƽaү so my selｆi say so thats what im talking about right there right there (chorus: ʳᶦᵍʰᵗ ᵗʰᵉʳᵉ) mMMMMᎷМ НO0ОଠＯOOＯOОଠଠOoooᵒᵒᵒᵒᵒᵒᵒᵒᵒ Good shit

You look like you might need to take a break.

I think I might've taken the caffeine instead of the decaf. :(

it looks more like alcohol instead of caffeine :P

Ok baby you are right:)

Can't register. Says I'm already registered for the contest. Can someone help?

EDIT: Fixed now.

Errr...That means you ARE already registered and dont need to register any more...do you need help to un-register or what? :P

Nope, I'm not registered, and it still keeps saying "already registered". I know how to unregister.

If you look up the users who are registered for the competition, you will see your name there! It says that you are registered!

Yep, it's fixed. Edited the parent comment.

Will the problem statements as short as this announcement? :)

wow double div2 rounds! Brilliant!

Yeah, I think it's to make up for all the unrated rounds we had last month.

can u plz help and check whats wrong with my solution... DIV 2 C https://ideone.com/PXaoDh

Whom About this round ?

I hope no one

Two consecutive round that is awesome ! Thanks qoo2p5

3 day after today will be another contest so we should say : one week ,3 contest,what a beautiful week!!!!

There should be a coding weak every few months or so...where we get a competition each day of the week!

(Or will it be too much? )

<<There should be a coding weak every few months or so...where we get a competition each day of the week!>> that will be amazing ^_^ <<(Or will it be too much? )>> are you serious????

Well it would be t000000000 much for the people like that guy above with 84 downvotes who said "Damnit codeforces, two consecutive rounds is too much."

T00 much? lmfao!

I'll tell you guys what too much is, too much is the gap between these competition,thats what too much is! LOL :P

Exactly. Hope we'll get such kind of "Beautiful Weeks" in future also..

WOOOWW so good that 2 contests in 2 days

I hope electricity will be fixed till the beggining of the contest :D

Wow, I like have a codeforces round everyday.

nice

Wrong tag 417! Please edit.

is it going to be rated?

all the contests are rated unless it is mentioned as unrated.

hura first stop commenting from fake account

I had one question. is it rat

yes but not for me bro

is it?

Another Round very quickly.. So exited..

Not able to submit even though I'm registered.Anyone facing the same problem?

Yes, same problem, I couldn't submit for the past 10 minutes

Second question is not accepting soln , submit link is not working for second ques, what the hell is going on

Too difficult C these days .

C is at an acceptable difficulty IMO, but i don't think that D is a problem that worth only 1500 points...

I think it should be at least 1750 points.

some guy just opened an account and solved all 6 problems .... (I think this is a hattrick if memory serves me right) -_-

At this rate, there will be fewer div2 coders than div1 coders

i wanna know how opening another account helps?

be a grandmaster first then open a new account and participate in div2 contest. You will be quite surprised yourself to see your performance

I wonder why a grandmaster do that.lolz

Answering questions in this round was like.

We're sorry if the statements was not as clear as we thought

Haha, sould've just written that in the statement.

30 minutes spent after i came up with that. It is illogical to have 2 stars on a grid at the same position (and how can he see two starts at the same point?) so it was better to write it in the statement. (Me personally got the point when i realised that number of stars could be up to 10^5 and grid has 10^4 cells)

Usually in this type of statements, I see that the phrase "All thingys have distinct co-ordinates" is given in such cases. Like in problem F, you are told that there is no road that connects a city to itself. So if you see no such statement, you usually take the worst case interpretation. So from my point of view, I don't think there was anything wrong with the statement

That's why statements weren't changed

how to solve C ?

prefix sums

yes but what's pretest 3?

idk ...

multiple stars at a point

Pretest 3 has multiple stars on the same coordinates I guess.

There can be more than one star in any given position.

I (hope I) solved it with 11 2-dimensional Fenwick trees.

Super overkill, dude...

Yes...I realized that after the contest. Since the brightness of the stars is fixed for given moment, then we don't need the Fenwick tree at all. Still, my solution passed the system test, but I agree there's a cooler approach. :)

I did the same :)

Can you explain that solution? I solved it using dp.

Let's for a moment assume that time stops and brightness of the start doesn't change at all. How could we then calculate the total brightness for a given rectangle? A 2-dimensional Fenwick tree does this in

O(log100 * log100)per query.However, stars' brightness change in time over time. It's easy to notice their brightness state is cyclic and after

c + 1seconds it goes back to the initial state. Sincecis quite small (up to 10), we can maintainc + 1Fenwick trees for each remainder oft % (c + 1).Note that even though this works, as szawinis mentioned, this approach is quite an overkill and calculating the 2D prefix sum is much less verbose and easy approach.

Thanks:)

For every initial

scalculate 2dprefix sums of stars so we can answer queries inO(c), because for each initial star brightness we know how many were there in the given rectangle and we can easily calculate what will be the brightness at the given time for this particular brightness.How exactly to sum more than one star in O(c)? Please explain a bit for me, thanks

I don't totally know mraron's solution, but here's mine (got AC on sys test):

Check every star, for every t (it is 0-c, so from 0 to 10), add it to the star's coordinate's and store the sums for a given time and given coordinates in a 3d array [t][x][y] (it's [11][101][101]).

After you have the sum for every coordinate and every t, you can calculate 2d prefix sums for the table ([101][101]) and after that you can answer every query in O(1).

I see, I oversight to generate all possible t [0,10], my function to sum it is just plain wrong answer, and TLE. Thanks!

How do you calculate a 2D prefix in less than

O(n^{2}) time?We can calculate 2

dprefix sums of arrayx×yinO(xy) in this problemxandyare the order of 100.Aha. So do I take it that if the bounds on x_i, y_i where higher, this approach wouldn't work? The method I thought of was O(qlogn). Sort the points by x then y coordinates and binary search on them and use a 1D prefix sum to calculate their sum. Then you can easily get their updated brightness after t_i time. does this work?

Yeah because the overall complexity is

O(cxy). I don't understand your solution yet, how do you exclude the points with badycoordinates?You can sort the points by the x points, then by the y points. Calculate a prefix sum for this sorted array of points, then binary search on the points to get the right points to include and calculate their brightness as sum in prefix table + the number of elements*t_i and take it mode the number of elements * c. So each query should take O(log(n)) time for a total algorithm of O(qlogn) time.

Apparently a

O(n+xc(y+q)) solution passes (herex=y= 100) with a sufficiently fast language. First, keep an array of all coordinate and brightness possibilities; put each star into its appropriate array. Now, compute the prefix sums of each row/brightness combination. Given this, we can answer each query inO(yc) time: iterate over all row/brightness combinations and find the number of stars in that row with the specified brightness that is also inside the query (can be done inO(1) because you have prefix sums). I'm sure you can fill in the rest of the details.Nice pretests xD

How to solve D?

I tried hashing but it failed on test case 5 are there anti hash cases in pretest

mine gets tl and mle

I clculated hashes of substring using only a linear array

Mine failed pretest 5 too with hashing

How can you hash when the string can contain not only letter characters?

It does: The first line contains the string s (1 ≤ |s| ≤ 5000) consisting of lowercase English letters.

OMG WHY COULDN'T SEE IT MAN =(. Btw what is your MOD number?

It's always good practice to double-hash, so the two primes were 31, 37 and mods were the usual (1e9)+7 and (1e9)+9.

I think pretest 5 is not an anti-hash test, since with double hashing, the chances of ever getting a collision are so low, it's nearly impossible. So, we can conclude that our algorithms were wrong :)

Try using 2 hashes

I used hashing with unsigned long long int. I was getting WA on pretest 5, but the error was with the greater K I was testing

I tried to do so: DP[i][j][k]=DP[i][i+sz-1][k-1] && DP[j-sz+1][j][k-1] && leftside = rightside. When i figured out what my function for leftside==rightside is not right :( I think it is O(n^2log^2n)?

I think what leftside==rightside(i, j, k) can be done with binary search :S Mine failed, i made it like it was (i, j, log_2(j-i)+1)

Find values till logn. After that answer will be zero. Complexity n*n*logn

yes but i get tl

I was also getting TLE. Forgot to memorize dp.

well i even used a vector for dp to reduce the sive but still tle

How do you find 1-palindromes? I see solving to logn in n^2, but how you find palindromes in n^2?

d[i][j] = is substring [i, j] palindrome, d[i][j] = d[i + 1][j — 1] & (s[i] == s[j]).

Clickits easy for 1 palindromes lets say pal[i][j] = true if substring from i to j is palindrome now if j — i >=2 : if pal[i + 1][j — 1] = true and s[i] = s[j] pal[i][j] = true

How do you check if leftside == rightside in

O(1)?maybe hash ..

Use String hashing . My solution TLEd but If I cache the modInverse it might pass .

I think there will be test like aaa...aaa to kill hashing solutions :D

You can use 2 moduli

why aaaa...aaa kills hashing ?

You need to check the whole string n^2 times

I did something like this: you first have is_pal[i][j] = the substring from i to j is a palindrome. (is_pal[i][j] = 1 if is_pal[i + 1][j -1] = 1 and string[i] = string[j]) Now, notice that a K-pal is also a K-1 pal. So we need the maximum "degree" of a substring: 0 if it isn't a pal, 1 is it is a 1-pal, k if it is a K-pal. We will have dp[i][j] = the degree of substr from i to j. When we reach [i][j], we have to analyse its 2 halves and if [i][j] is a pal. Now notice that if [i][j] is a k > 1 pal, then it is a pal and its halves are also pals (so they are equal). If that is the case: dp[i][j] = dp[one half] + 1. Now add them to your answer. (Hope this will pass EDIT: it did pass )

For simplicity, put a

`|`

between each character, as well as at the front and the back of the string. Now all palindromes will have odd length (possibly centered at a`|`

). A radius of a palindrome is half its length, rounded down. (For example, the radius of`abcdcba`

is 3.)First, find longest palindrome centered on each character. Naive

O(n^{2}) search is fine.Now, we will compute , being the largest level of the palindrome centered at

mwith radiusr, minus one. , since a single character is a 1-palindrome. To compute , letr' = ⌊r/ 2⌋. If the longest palindrome centered atmhas radius less thanr, then . Otherwise, will be equal to , and you can set . Why it works is left for the reader, or I'll explain later.Now that you have your , we can prove that

a_{i}is equal to the number of that is greater than or equal toi. We can find alla_{i}'s inO(n^{2}) time.I used suffix arrays to be able to check in O(1) if a sequence is a palindrome. Then I just checked each sequence to see if it is a palindrome. If it is, I check whether half my sequence is a palindrome and so on. Total O(N*N*logN) it fit in 1.3 secs.

Basic insights. Every

k-palindrome would be a palindrome, can be easily proved using induction. Everyk-palindrome would also be a (k- 1)-palindrome.So, we only need to find max

kfor every palindromic substring ofS, such that it is ak-palindrome.Here's what I did.

S, let them beHPandHS.S[i][j], check ifHP[i][j] =HS[i][j], i.e. if prefix and suffix hashes are same only then the substring would be palindrome.S[i][j] is palindrome, recursively do the following.len(S[i][j]) = 1, return 1. (strings of length 1 are 1-palindrome)LandRbe left-half and right-half of the strings, as defined in the question. Check ifhash(L) =hash(R), i.e. checkhash(L) ≠hash(R), return 1. (given string is just a palindrome)hash(L) =hash(R) then do step 3 forL, and`return ans(L) + 1`

Now, this solution wasn't passing under time-limit, so to optimize I used an

`unordered_map`

to store answer for all palindromic substring hashes that I've seen and if I see the same hash for any substring again, I just lookup answer for it in the map.Very nice problems! Thanks, qoo2p5!

Short announcement, short statements. Cool!

Hmm.. SuspiciousKAN

you have to mention MikeMirzayanov for this one

yup, looking at his submission, he just change a comment to intentionally get hacked. Though, we cant be sure if the hacker co-operated with him.

IMO they should remove TheStupidOne, and take away the hacker's points gained from hacking.

HELP! Somebody help me with B. I didnt passed the pretest. Though it passed all tests i made my as per my intution on my pc. i dunno what i missed.

where is your solution ?

http://codeforces.com/contest/835/submission/29074754

I didn't read the whole submission but the number n can be huuuge, you can't store it in an integer type. A string will do though.

the problem is with variable

`p`

, because the range of it could be`10^100000`

!when you define it as

`int`

, you can assign numbers in range`10^9`

to it`long long`

is suitable till the number is not greater than`10^18`

if the number is bigger than

`10^18`

it's better to use`string`

Thanks . I blindly did that mistake.

Did you sort the string????

i think it could fit in an int still i used ll.

ten to the power of 1e5 CAN NOT fit in a long long...

It's 1e5 digits the maximum a long long can hold is about 18 digits I think

the maximum limit of an ll is 10^18, even ull is up to ~ 20^18, so n won't fit in any numeric type variables, you should've used string

oops! Just noticed. I didnt read the constraint very carefully and used ll :(

Thx for the short statements!

how to write a proper generator to cause TLE on B. I keep getting Generator crashed. I tried print(1e8) loop 1..1e8 : print('8')

String was only aloud to be 1e5 digits long

Does

O(N^{2}log(N)) pass for D ?not for me

It pass pretests, but I really doubt it pass the full system testing :(

UPD: It passed

I got MLE ! (time complexity as well as space complexity was O(n*n*logn))

space is way too much u only need the last two layers of dp

Not for me too :( I was so positive about it, since, N^2log(N) was equating to 3 * 10^8 operations and tl was 3 secs.

well its actually not 3 * 1e8 there are so many things in you loops which will make it more than 1e9

It did for me in 1.3 secs.

anyone has any idea about the third pretest for C ??

it should be having more than one star at some position

Any hack tcs for div2 A,B? Thanks!

How to solve E ???

PS: E was a very awesome problem.

I have an idea asking for each of bit of the position but dont have enough time to code

Let answer be A and B (A<B). For each bit position, find whether the bits at that position are same or different in A and B. For highest diff position, A has 0 and B has 1. For all other positions, find the bit at that position in A. Correspondingly, you get the bit for B.

To check if the bits at position

posare same/different for A and B, put all numbers having 0 at positionposin a set and query the system. If the number of occurrences of Y is 1, then the bits atposare different in A and B.To find the bit at position

posfor A (after you've found the highest differing bithigh), put all numbers withhigh=0 andpos=0 in a set and count the number of Ys in it. If the number of Ys is odd, then A has 0 at positionposand 1 otherwise. Now based on the relation found earlier (bits at positionposare same/diff for A and B), you know the bit for B too.To count the number of Ys in a set, use the following -

If size of set is even, the no of Ys is 0/2 if XOR is 0 and 1 if XOR is X^Y.

If size of set is odd, the no of Ys is 0/2 if XOR is X and 1 if XOR is Y.

You can see my code for an implementation of the same.

I was asking for each bit. Then answer for some bit must be y or x xor y and then I have numbers which have only one y. For first number I just make binary search on numbers with this bit.

For simplicity, suppose there are 1024 icicles numbered from 0 to 1023, so you can interpret them as 10-bit bitstrings.

First 10 questions: ask the icicles that has 0 on i-th position, for each i. If there are 0 or 2 of the special icicles, the XOR will be 0; otherwise, the XOR will be

x^y. Also note that it's impossible for all questions to give XOR 0.Now you know the answers to the questions. Suppose the special icicles are numbered

p,q, and their XOR isr. We claim that the i-th bit ofris 1 if the i-th question gavex^y, otherwise it's 0. It's actually not difficult to prove; you can try it, or I'll expand on it later.Now you know that there are 512 possibilities of pairs of the special icicles. Interestingly, each icicle is involved in exactly one of them. Pick one icicle from each pair arbitrarily, then binary search on them.

EDIT: Since

nis not necessarily 1024 (it's impossible to be that, in fact), you need to fudge with it a little. You're still asking the same question, but now the response is either 0 orx^y(if there are an even number of icicles), or eitherxory(if there are an odd number of icicles).Let set

A_{i}be the numbers from 1 tonthat have theirith bit on. Also letF(H) function be the xorsum of setH's elements. If for some setXor thenXcontains only one special element. We'll calculateF(A_{i}) for every 0 ≤i< 10 (this is 10 operation). Letjbe the first setA_{j}thatA_{j}contains a special thing. Let's do binary search in 9 steps to find it (we can do it because |A_{j}| < 512). So we have the index of one special thing, but remember the 10 steps we did earlier? Just invert those bits in this one to find the other special thing.Can someone please explain problem D in detail!!

First of all, observe that there can be no

k-palindromes such that 2^{k}>n/ 2.Let's calculate

dp[k][l][r] which denotes whether [l..r] is ak-palindrome (i prefer something likebitset<N>dp[K][N]).The basic case is

k= 1. This can be obtained inO(n^{2}) if we just launch from all possible middles of palindromes.For

k> 1 and [l..r] we just have to check several things (assumingmis the median of this segment): whethers[l..m] =s[m+ 1..r] and whetherdp[k- 1][l][m] anddp[k- 1][m+ 1][r] are (k- 1)-palindromes (depends of parity, but the main idea remains the same). Hence you get .if [

l..r] isKpalindrome , then its alsoK- 1 palindrome , hence you can get complexity down toN^{2}.Oh, nice observation. Didn't even think this way :)

How? Even then, there are N^2 log(n) states. Then how can you bring down the complexity to N^2?

Instead of using state DP(L, R, K) denoting whether str[L..R] is a K-palindrome, use the state DP(L, R) which stores the max K such that str[L...R] is a K-palindrome.

Can you please explain a little bit more about it. How can we find whether a number is k palindrome or the max K such that the particular substring is palindrome without checking whether it's a k-1 palindrome or not?

I used 2 DPs. A string is K-palindrome if it is itself a palindrome and its first half is (K-1)-palindrome. Non-palindromic strings are 0-palindromes.

is_palin(L, R)returns true if str[L,R] is palindrome.DP(L, R)returns largest K such that str[L,R] is K-palindrome. To find K, I first check if str[L,R] is palindrome itself or not and then use the relationDP(L,R)=DP(L,MID)+ 1, where MID is the end of the first half of the string.See my code.

Thanks a lot for this awesome explaination.-:)

I wonder why my n log n solution got TL.. I'll be very lucky if you helped me. :) 29077577

Is it all about bitset?

How can you know s[l..m]=s[m+1..r] without hashing? and also can you explain a good hashing function?

Calculate

lcs[i][j] — the length of largest common substring of indexesiandj.It can be easily seen than

lcs[i][j] islcs[i+ 1][j+ 1] ifs[i] =s[j] and 0 otherwise. So you compute this inO(n^{2}).How can I know now? I have to check whether

s[l][m+ 1] is greater or equal thanm-l+ 1.so lcs means longest common suffix right?

substring :)

My solution for D is pretty straightforward I think, let me know if something is not easily understandable from my code.

http://codeforces.com/contest/835/submission/29067296

It's really scared that In problem D I came out with a very complex idea( to me :) ),which make me code for more than an hour T^T,Hope it pass...

Waiting for round #428 ...

I'm curious did anybody manage to get AC on D with O(n^2logn)? My O(n^2logn) solution was about as optimized as it could be (super low constant) but got TLE.

I got AC on D with O(N*N*logN).

Check 29062545

This was a really nice and smooth contest, good problems, short statements and good pretests. Thanks to everyone involved for making this such a great contest.

I literally spent the whole contest trying to solve C but I kept getting WA on pretest 3

Here's one of my submissions 29072095

I'd be glad if someone tells me what I'm doing wrong, it really drove me nuts throughout the entire contest.

try this case:

2 1 2 1 1 1 1 1 2 0 1 1 1 1

answer should be 3

I was doing such a stupid mistake by iterating over the input multiple times in case of coincided coordinates, handled it, and ur test passes now, still WA on test 3 though.

New submission 29076795

Appreciate ur help.

Most people messed up because they didn't realize two stars could be at the same point. I didn't look at the code but perhaps that helps?

how to solve problem — C?

hint: use partial sum

what's the order of partial sum solution ?

does is it use memoization ?

O(C * MAX(xi) * MAX(yi) + q )

29058370

i have the same problem as your submitted code, but i solve it, the second operand of

`%`

should be on`c+1`

not`c`

!because the original problem tells us

`s<=c`

and if`s>c`

the variable`s`

have to be equal to zero, so the range of numbers that s can have is`0,1,2,...,c`

After that you will face with

`TLE`

:DAny discussions on the last problem? How do people write such long codes in such short time.

I cannot even write codes for C without bugs.

what have you done for problem

`C`

? your submission is like`DP`

could you please describe your idea for me ?

test cases for problem C were very weak.even O(q*n*n)(n=100) solution got AC. see this solution i think it should be rejudged with proper test cases.

I think there is maxtest in system tests, and I think judge can do 10^9 simple operations in 2 seconds.

Yeah its not fair!, The problem should be rejudged with proper test cases.

Yes, it's my fault, but the test cases are not weak. Codeforces invokers are quite fast, so 10 ^ 9 simple operations passes in 1.5 seconds.

I tried to make the contraints not too strict, but it happened that they were too small.

But, as I can see, the problem hasn't affected many participants, so everything is alright.

By the way, I would like to thank qoo2p5 for the absence of anti-hash tests for problem D :) This really makes me happy (although I should have calculated lcs in

O(n^{2}) time :D).:o lcs? to check palindromes?

It was a thrilling match. In the last three minutes, I came up with a solution, but I didn't have time to write. I am tooooo weak

Because of one symbol, I got WA. I erased this symbol after contest and got AC. I'm so sad...

how to hack in contest

lock your problem and click in other submission in your room

then it shows the solution of the roome then

double click on someones solution, after that you will see his/her code.

click on

`hack it`

and write a test case that proves the solution is wrongcan find hack it button :(

you can only do it while contest is running

ok

Could someone help with this one ? O.o Problem B submission I can't figure out why it should get WA on 24 :/

what are

`moar`

and`req`

?nevermind, I am a dumbass ._. found the silly mistake in line 179

When, calculating

`req`

you want to take`ceil((k - sum) / (9 - i))`

.`int req = (moar + (9 - i))/(9 - i);`

should be`int req = (moar + (9 - i - 1))/(9 - i);`

as in case`(k - sum) % (9 - i) == 0`

, your`req`

would be off by 1.Yes ._. I failed to notice this one.

How to solve F?

Scrolling to find a comment about rating change? If yes, like this comment :P

regmsif is a cheater for sure. Templates of his submissions are completely different. KAN

And he solved B and F almost at the same time.

he is not cheater: http://blog.csdn.net/lych_cys/article/details/51326079 F was from before :)

instead searching for other, go and read editorial and learn a new thing :(

Templates of his solutions of other tasks are still different.

Timestamps of your submissions also seem suspicious to me, by the way.

Why couldn't i write codes in different styles? i used to use one of the styles, and recently i'm trying to change to another one (you'll find it if you check my submissions before). These styles are both good and bad, one of them seems more beautiful, while another one seems shorter, and can be typed quicker. i don't mean to cheat.

Generally, when completing in a contest, people have a template and copy that base template for all codes.

So, when people see codes with two different styles, it appears that there might be two different programmers competing under one account.

I would suggest in the future, when competing in a contest, use a consistent style throughout the contest to avoid this type of situation.

you are crazy :)

I won't say he is a cheater for sure, but it doesn't explain the difference in tab width, and the small difference in submission time. and also there's quite some small difference in style like the use of class and line spacing etc..

does

`backtrack`

approach works for problem`C`

?any ideas ?

Is the educational round unrated? Or somebody just forgot to update the ratings.

yeah, all educational rounds are unrated.

In problem C, Is it possible that two stars are at same position?

Yes it is, knowing that there can be up to 10^5 stars and there are at most 100^2=10^4 pionts on the plane it's pretty clear that there will be some overlaping stars.

So for example if there are 2 stars at same place ( brightness 2 and 3, c=4). after 1 moment it's brightness will be 3 and 4(total = 7) ???

Yes, you are correct. Overlapping 2 stars would affect neither one of them.

Is it rated? Looks like not...

Or somebody just forgot to update the ratings.

Can someone explain why is't publish the final result of contest?!

Why aren't the ratings updated? 3 hours already since the contest ended.

It appears they are pulling cheaters out

KAN qoo2p5 Please check Ali.P and Ali.PI submissions, seems same thing to me, possible cheat. Ali.PI Submission , Ali.P Submission

Nowadays much submissions are being done in a contest compared to the previous ones.

Really astonished by this !!!

Ratings rolled back? weird. Edit: They are back with new ratings. Apparently mine increased. wtf?

They disqualified Ali.P.

What's wrong with the rating changes in this contest? My new rating disappeared and so does many others (I checked)!!!

UPD: NOW BACK TO NORMAL.

How this one passed C — 29077578 :| Just looping from (x1, y1) to (x2, y2). Shouldn't that give TLE? As it is O(1e5 * 100 * 100) ~ O(1e9) in worst case!

My rating disappears and my submission is marked "skipped". What's wrong

Your's C: 29067352

jt3698's C: 29073459

Your D: 29073399

delete4's D: 29073330

Only variable names differ! Notorious Coincidence or what?

CF usually forgives cheating for first time and second time bans both account :)

I think you also cheated in A & B. And used ~4 accounts, and one of those accounts also got outside of contest [I wonder why other's solution didn't get skipped -_- ].

Both of the submission you put are significantly later than mine. And you can check the codes are in agreement with my coding style.

If you I am considered cheating because I leaked my solution on ideone. Fine. But why is jt3698 and delete4 still in the competition?

And please clarify the reason you think I "also cheated in A&B"

After a closer inspection, I think jt3698's code is very different from mine. You should think more carefully before accusing other people.

Thank you for sending me the links, though.

Actually the problem F is quite similar to one problem in NOI(China)2013 . So if I have solved that problem before and I copied the code so I finished the problem very fast(only in less tha 5 min, for example ) , is that cheating?(Actually this time I wrote the code again)

Sorry for my poor English.

And I'm curious about how the anticheater system works.

The same solution for problem C using C++ got accepted link

but got TLE using C# during the contest Link

And I see many solutions like this.

very nice...

LOL. Another solution passed using C++ Link

but the same solution got TLE using C# Link

I tried to solve E using binary search, where first i'm finding index such that xor of indices 1 to index contains exactly one y. Then using binary search between [1,index] and [index+1, n] i'm finding indices of y. But due to redundant queries i'm not getting right answer for n > 500. Can someone optimize it or tell why is it not possible to solve using binary search. Here's my code http://codeforces.com/contest/835/submission/29088791. Thanks in advance

It is not possible to find using binary search the first Y in a sequence which has 2 Ys, because the prefix XOR function is not monotonous.

eg. Let the sequence be str[] = XXXYXXXYXXX (1-indexed)

The prefix XOR of str[1..2] is 0, of str[1..4] is X^Y and that of str[1..8] is also 0.

What do you do when you encounter a prefix XOR having value 0? Do you go left or right? In case of str[1..2], you need to go right. But in case of str[1..8], you need to go left. The prefix XOR values are NOT monotonous.

The algorithm you mentioned will work if the sequence has only 1 Y.

Let's say mid = (1+n)/2, now if 1 to mid values don't contain only one y i.e(value is not y or x^y) then we take mid1 = (1+mid)/2 and mid2 = (mid+n)/2, now we keep doing mid1 = (1+mid1)/2 and mid2 = (mid2+n)/2 until one of these mid values don't contain exactly one y. Then we assign values as i mentioned before i.e start1 = 1, end1 = mid(or mid1 or mid2), start2 = end1+1, end2 = n and proceed as before. If something's wrong here, please correct me.

I don't know why DIV.2 problem C is NA... 29145513

BUT!!! This code is accept.. 29145520

It's just different this codefor (int t = 0;t <= 10;t++) { sum_val_map[t][y][x] = ((c + t) % (C + 1));

(NOT ACCEPTH)for (int t = 0;t <= 10;t++) sum_val_map[t][y][x] += ((c + t) % (C + 1));

(ACCEPT)Somebody explain it to me plz!!

Do duplicates come in as inputs?

Yes a point can have more than one stars

OH Thank you