Блог пользователя Vladik

Автор Vladik, 10 лет назад, По-русски

Всем привет!

27 мая в 12:35 MSK состоится очередной раунд для участников из второго дивизиона. Участники из первого дивизиона могут принять участие вне конкурса. Раунд будет состоять из 5 задач, на решение которых вам будет отведено 2 часа. Обратите внимание на время начала раунда.

Задачи раунда будут частично совпадать с задачами Открытой олимпиады Мозырского государственного педагогического университета, которая будет проходить параллельно с раундом. Полный комплект задач обязательно попадет в тренировки. В скором времени в отдельном посте постараюсь рассказать чуть подробнее об олимпиаде.

  • Авторами раунда являются: я (Владислав Вишневский), Валерий Камеко (v4lerich) и Юрий Шиляев (hloya_ygrt).
  • Тестировали раунд: Александр Керножицкий (gepardo), Арсений Колосов (KArs) и Илья Климко (klinchuh).
  • Координатором раунда выступил Алексей Вистяж (netman).
  • Вычитывали условия: Александр Дряпко (sdryapko).
  • И конечно же это все не состоялось бы без Михаила Мирзаянова (MikeMirzayanov), cоздателя платформы polygon и codeforces.

Всем выше перечисленным огромное спасибо за вклад, внесенный в подготовку раунда!

Главный герой раунда Владик, который очень любит решать задачи и себя.

Всем удачи на раунде! :)

UPD 500-1000-1500-2000-2500

UPD Опубликован разбор задач.

  • Проголосовать: нравится
  • +149
  • Проголосовать: не нравится

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Thanks for changing start time as don't wanted to miss this one and snackdown round A was at same time too...

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Can't register. Showing "rating should be 0...1899 to register ..."

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +31 Проголосовать: не нравится

3 consecutive rated rounds from hloya_ygrt . Amazing.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится

Is netman international grandmaster?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +19 Проголосовать: не нравится

What is MSPU Olympiad 2017 ????

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +15 Проголосовать: не нравится

Div 1 Users are not able to register. Update — It's fixed now.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Good start time , to prevent conflict between it and SnackDown Pre-elimination.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится -9 Проголосовать: не нравится

Is this contest rated?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится -26 Проголосовать: не нравится

Is this contest rated?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится -24 Проголосовать: не нравится

Unfortunately I am having a final exam tomorrow at contest time. I am thinking about not going to my faculty to be able to register =D

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Something wrong with registration. When I registered, I wasn't considered "out of competition".

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Just wanted to point out that the time link on "Codeforces Round #416 (Div. 2) has been moved to start on 27.05.2017 09:35 (UTC)." leads to The World Clock.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится

Codeforces round, Codechef May lunchtime and snackdown pre elimination all in same day == Busy day for me :3

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

hopefully short statements !!!

»
10 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +19 Проголосовать: не нравится

how about the scoring distribution ? UPD : fixed

»
10 лет назад, скрыть # |
 
Проголосовать: нравится -7 Проголосовать: не нравится

Am I the only one who loves standard scoring distribution?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Today's contest seems to be no delays. Wow!

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Submission stuck on the same pretest for over 8 minutes =/ Edit: fixed

»
10 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +2 Проголосовать: не нравится

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

could anyone tell me if I can unregister from any contest after submitting one solution, or it is not allowed ?

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

C is little bit tougher than usual :(

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

This contest was awesome but I'm really afraid of systest!!!

:)

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What is the hack for Div2B?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

After coding a solution for C i understood that it's wrong. So, how to solve C?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hack case for B?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

I got Unsuccessful hack for hacking a solution in Problem B that sorts every time.

How ? Isn't the complexity for this solution O(n * m * log(n)) ?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

nice problems, but I hate interactive problems.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve E? I thought about counting how many components we add/subtract on every prefix/suffix and then using that we can answer queries, but I don't know whether that's correct.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

how to solve D ?

  • »
    »
    10 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +9 Проголосовать: не нравится

    Since there's guaranteed to be a path to finish, there has to be a . next to (1,1), either to the right or down, so you can check whether there is a swap on that direction. I assume I know that left = left, right = right, rest is symmetrical. Since there is a path you can go right until there's a '.' underneath you to test whether down/up are swapped. Right now you either reached the finish state or you have checked for both swaps. So you can get a path to finish state by using BFS and then just write all corresponding turns.

  • »
    »
    10 лет назад, скрыть # ^ |
    ← Rev. 2  
    Проголосовать: нравится +6 Проголосовать: не нравится

    1, If (1,1) is not a good place to test if R and L is swap, then test D and U, then use the result to find a good place to test R and L.

    2, If (1,1) is not a good place to test if U and D is swap, then test L and R, then use the result to find a good place to test U and D.

    3, Use normal DFS/BFS with tracing to find the path.

    4, Remember to terminate if you accidentally reach the finish square.

  • »
    »
    10 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +3 Проголосовать: не нравится

    just find out if Up and Down are swapped and if Right and Left are swapped then BFS it.

    My code:code

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Лютая ненависть к задачам на перестановки :(, все время безрезультатно убито на B.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

nice problems, but I hate interactive problems.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

After locking B I saw very easy solutions of B without segment tree :D

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What is the solution for E? And what do people hack on B? I could hack only one guy who used a segment tree to answer queries :D

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

Just wanted to know.

Is O(N*M*LOG(N)) passing for B?

»
10 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

Got some mysterious bug in D, and it's almost impossible to debug input which works when I test it and gets WA on first pretest.

And my 10+ wrong submissions don't even seem to appear in standings.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Did somebody get runtime error in Div2D on 5th test? What is kind of test?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

For problem C I got TLE on pretest 12, I understand the problem is : checking if it's ok to add segment [i,j] which work's in O(n) can it be calculated in O(1)?

  • »
    »
    10 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I think it can be calculated in O(1). For every element(city) keep its least appearance and highes appearance. Now we will precalculate ok[i][j]. Go from i to j, and for every next element ask where its highest appearance and lowest appearance is. Also, keep track of how many elements are bad (we call element bad if it appeared from i, but its highest appearance is after current right pointer (right border). When highest_appearance[current_number] == current_index that means one element is not bad anymore, so cnt--. If at any point cnt ==0, than that range is OK, othervise its not.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

What is the intended approach for the problem E? is it DP-like one?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

The same algorithm for Div2B gave Time Limit Exceeded on Pretest 10 in Python 2.7 (http://codeforces.me/contest/811/submission/27381826), however passed for C++ 14 (http://codeforces.me/contest/811/submission/27386544). This is wrong behavior, right?

I ended up spending all my time on this :(

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

задача А

111 111

ответ Valera ?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Didnt check B's constraints and used seg tree :/

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +5 Проголосовать: не нравится

Please start systest fast before AGC starts ;D

edit: denied :D

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

https://ideone.com/SlRErL

Can someone tell me what's wrong with my Solution for C?

  • »
    »
    10 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    If I understand right your code, you are wrong for two reasons:

    First, you only make operation XOR to value iff mx[ a[ i ] ] >= x && maxx[ a[ i ] ] == i, so if the previous sentence is ok you perform the XOR operation but all values between [ mx[a[i]], maxx[a[i]] ] that are different to a[i] and have a maxx greater than maxx[ a[i] ] you doesn't include them, so it is wrong because for definition in the problem statement the XOR operation includes all different values in the segment [l, r].

    Second, if you find an a[i] that have mx[ a[i] ] < x, you can't include the segment [ x, i ] in your current answer, because you never could take a valid segment that include all values equals to a[i].

    Maybe you have more mistakes but these are the most easiest to see.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What is the intended solution for B?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can anybody help me figure out the reason behind memory limit exceeded in Problem D? http://codeforces.me/contest/811/submission/27386058

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I tried to hack codes with O(n*m) for ProblemB; or even worse O(n*log(n)*m). Is O(10^8) or greater passed in 2secs?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

How come O(n*m*log(n)) solution is passing for the problem B?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

Can we solve problem E using Mo's Algorithm?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +23 Проголосовать: не нравится

please start system test.

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Solved 1 problem in last 2 rated contest, Then solved 2 problems in next contest, >>>>> unfortunately that was unrated.;( ;(

Finally a rated one... Can't wait for the ratings to be updated,

Please Finish the system test, for God's sake.... solved 2 problems.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

I tried hacking several O(n*m*log(n)) solutions using a full test case of just 1,2,3,...10000 (permutation in sequence).

On my own PC this test case takes 30 seconds, but all my hacks failed. Other people hacked those solutions later with "random" large case instead of sequence 1,2,3,4...10000.

Then I compiled my slow test case with "-O2" and it runs in 4 seconds on my PC instead of 30.

So the question is, what all does C++ sort() in "-O2" flag optimize, besides "numbers already sorted"? Does it check for "reverse sorted" and "almost sorted"? Thanks.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

"I am also going to tell you about the Olympiad a bit later." When??

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve C?

  • »
    »
    10 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    dynamic programming: d[i] -> maximum comfort of people numbered 1..i (or i..n)

  • »
    »
    10 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    First we find the first and last occurrences of numbers in the array (not just a [i] <= 1000). Then, for each number, look for the beginning and end of the segment, which must enter if we take this number. Thus, we have an array of pairs of possible segments, which are sorted by their beginnings. Obviously, if the beginning of one segment is inside the other, then the entire segment will be in it, so we need to either take each segment completely or split into sub-sections (choose the largest from this). This can easily be done recursively, for example. one segment is inside the other, then u

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

I was sure 10^8 cant fit in 2 seconds. I came up with O(n*m) idea very quickly but I didnt code it since I thought it wont pass...cri

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Why did I got TLE 27376612 works in O(m * n * logn).Please hepl..

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to take in C take account of xor of unique elements in a range ???? I used set and it gave TLE :( So stupid of me

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve problem B if constraints were 1 <= n,m <= 10^5 ?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Forgot to terminate the program in some cases, got idleness limit exceeded XD

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Got RTE in D because I didn't remove asserts :'(

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

anybody knows the reason for getting WA on Test-49 of C ?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

I solved 4 problems but it says 2 out of 5. Is anyone else facing the same issue?

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +16 Проголосовать: не нравится

That awkward moment when you spend half an hour explaining your O(msqrt(n)) solution for B to your friend, but their O(nm) solution also got AC.

Edit: it should be O(msqrt(n)log(n))

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone help me to find the error, in problem D? 27388425

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

It gave me TLE on case #87: 1 2 0 0 .F But I tested and it does in 3 moves, and the limit would be 2*1*2 = 4

»
10 лет назад, скрыть # |
 
Проголосовать: нравится -6 Проголосовать: не нравится

Was this contest rated or not????

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

Can anyone explain what was wrong in the following approach for problem C. I tried to break the problem into a weighted job scheduling problem. The start and end times for jobs are the minimum starting and maximum ending index of each element . The profit is the xor of non individual elements taking each element only once in an interval. Then our goal is to maximize the sum of xor of non overlapping intervals which is the same as job scheduling . My solution was failing on testcase 12

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится
»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Problem D, Idleness limit test 70?

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I had submitted this(http://codeforces.me/contest/811/submission/27386058) solution during the contest for problem D(811D - Vladik and Favorite Game). In the test case 6, there is no 'F' in the input given. In the problem, it is stated that there is exactly one 'F' to be given in the input. Am I missing something?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve D? I attempted below implement but WA(My English may not be that good to explain clearly):

We start at a corner, there are 2 "edges", there must be a solution so at least one direction is '.', we can try that direction and get the result(wether moved or not).

Implement a BFS and find the right path to 'F', there will be 2 situations:

1.we keep on going "on an edge", then one direction would be enough

2.we leave the edge at some moments, it means there will be a corner, we can apply the methods above again and get both directions right.

Seems right, but WA. Am I having wrong idea or just buggy code?

27384993

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Мне одному кажется, что такие задачи как сегодняшняя Dшка вообще нельзя считать за нормальные задачи и тем более давать их на раундах CF? Ведь в задаче почти не надо думать... надо просто писать.

P.S. Знаю, что заминусят, но я высказался.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Будет разбор ? Уж больно хочется С понять.

  • »
    »
    10 лет назад, скрыть # ^ |
    ← Rev. 2  
    Проголосовать: нравится +4 Проголосовать: не нравится

    Давай сначало посмотрим на сами числа. Пусть, допустим, у нас есть a[i] = 5. Если мы возьмем её, нам придется взять все 5ки. Допустим, вторая пятёрка находится на позиции j (j > i). Тогда, чтобы взять вот эти пятерки, нам придется взять элементы между ними. Пусть между ними есть числа '1', '2', '3'. Если у нас есть еще '1' за пределами отрезка [i, j], то наш отрезок увеличивается(нам придется взять все 1).
    Такими шагами увеличения мы доходим до того, что отрезок из [i, j] превращается в [I, J] (I <= i, j <= J) То есть, чтобы взять 5ки, нам придется взять отрезок [I, J]. Давай добавим в p[I] пару { J, ( xor на отрезке [I, J] ) }. Теперь будем считать dp. dp[i] — максимальная сумма xor'ов, которые мы можем получить из отрезков на префиксе, которые заканчиваются не позже 'i'.
    Динамика вперед.

    dp[p[i][j].first + 1] = max( dp[i] + p[i][j].second,
    dp[i + p[i][j].first + 1] );
    

    p[i][j].first — конец нашего отрезка, который мы хотим добавить. Прибавляем 1 потому что 2 отрезка не могут пересекаться.
    p[i][j].second — xor на данном отрезке.
    Следовательно, ответ будет в dp[n].
    Мой код

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Anyone else got WA Many requests even though number of request shouldn't be big? (While debugging I inserted return 0 after second request. EDIT: Apparently, I just forgot to comment debug stuff. :D

»
10 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Vladik MikeMirzayanov 811B - Vladik and Complicated Book I submitted python code and got 27390552 TLE same algorithm, with same complexity in C++ got 27390500 accepted. Any idea was it bug or it happens every time ? Isn't time limit different for different languages ?

  • »
    »
    10 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +11 Проголосовать: не нравится

    Python is a slow language, so it can get TLE on such problems (there are 108 operations). So it's better not to write problems that consume much operations.

    Isn't time limit different for different languages ?

    No, unlike contests like USACO, CF has one time limit for all the languages.

    P. S. Problemsetters try to make TLs for easy problems in the way that Python solution pass. But it's impossible for this problem, else codes pass easily and the authors tried to avoid this.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

In Q-2 constraints of test case and question didn't match . I got T.L.E in test cas 29 which contains 6*10^4 but in question constraints were 10^4 . Please correct your test cases.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится -7 Проголосовать: не нравится

I mistake a variable and it even passed pretest... thanks for weak pretests.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Found the Div2 C problem confusing. Can somebody please explain the question.

  • »
    »
    10 лет назад, скрыть # ^ |
    ← Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится

    Choose non-intersect segments with values of its XOR sum, each segment must contain one or more whole color set(if one color 'a' is in it, then all other 'a's must be in that segment too). Maximize the sum of the values.

    • »
      »
      »
      10 лет назад, скрыть # ^ |
      ← Rev. 2  
      Проголосовать: нравится +3 Проголосовать: не нравится

      But how do we make all possible intervals? Shouldn't there be O(n^2) possible intervals (for example when input is 1..5000)? In test 1 it would've been: [4, 4], [4, 4, 2, 5, 2], [4, 4, 2, 5, 2, 3], [2, 5, 2], [2, 5, 2, 3], [5], [3]

      So total complexity would've been O(n^3).

      I just solved it without making all possible intervals in O(n^2), for example, in test 1 my solutuion only considers intervals: [4, 4], [2, 5, 2], [5], [3]

      I don't get why this works.

      Is that because taking sum of two numbers allways gives greater result than XORing them?

»
10 лет назад, скрыть # |
← Rev. 9  
Проголосовать: нравится -8 Проголосовать: не нравится

Codeforces Round #416 (Div. 3)

Problem X

This is an interactive problem.

[Vladik and Unsuccessful hacks]

Valera was participating Vladik's contests. He found an O(nm log n) implementation on problem B.

He tried to hack the solution but failed so his ratings dropped.

Now, the task goes to Vladik. Given problem B, your program should output a testcase which can defeat the O(nm log n) code (preventing it from terminating in 2 seconds).

problem B:811B - Vladik and Complicated Book

Output

First line contains two space-separated integers n, m (1 ≤ n, m ≤ 104) — length of permutation and number of times Vladik's mom sorted some subsegment of the book.

Second line contains n space-separated integers p1, p2, ..., pn (1 ≤ pi ≤ n) — permutation P. Note that elements in permutation are distinct.

Each of the next m lines contains three space-separated integers li, ri, xi (1 ≤ li ≤ xi ≤ ri ≤ n) — left and right borders of sorted subsegment in i-th sorting and position that is interesting to Vladik.

Input

For each mom’s sorting on it’s own line print "Yes", if page which is interesting to Vladik hasn't changed, or "No" otherwise.

Interaction

To finish output buffer (i. e. for operation flush) right after printing testcase and newline you should do next:

fflush(stdout) in C++

System.out.flush() in Java

stdout.flush() in Python

flush(output) in Pascal

read documentation for other languages.

output

5 5

5 4 3 2 1

1 5 3

1 3 1

2 4 3

4 4 4

2 5 3

input

Yes

No

Yes

Yes

No

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

TLE in test-case 35.[ B category ]

please someone elaborate shortly what is the actual logic of "B" problem

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Would someone mind help me look at my code for Problem E? I suppose my code have a time complexity of O(N*(M+Q)*logM) with each merge action as O(N), but I suspect that I messed up part of the implementation thus causing TLE.

http://codeforces.me/contest/811/submission/27392571

Thanks in advance.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

Editorial please :DD

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

In hacking section there is many successful hacks on problem B of today's contest, But I got two unsuccessful hacking attempt on this problem. And after system test finished, I see the submission I try to hack get TLE in system test. Then what is the problem in my test case ?

I Use a test case like this-

10000 10000
10000 9999 9998 9997 9996 9995 9994 9993 9992 9991 9990 9989 9988 9987........
1 10000 1
1 10000 2
1 10000 3
1 10000 4
1 10000 5
1 10000 6
1 10000 7
1 10000 8
1 10000 9
.
.
.

Full test case is here in this link.

This test case give me unsuccessful hacking attempt. Can anyone explain why It pass in 0.997 sec while in my pc (Operating System: Linux Mint 18.03 Processor: Intel Core i5 4th Gen, Ram: 8gb) it takes 37 sec to run the same code in this test case ?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

will there be an editorial?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

can someone help me in problem C the code gets TLE on test 60 27397952

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

One of my solutions of C is slightly wrong, but it passed.

newx2 = min( newx2, first_index[ a[x--] ] ); is right, but I wrote newx2 = min( newx, first_index[ a[x--] ] );

I guess it's hard to create test cases that can catch every wrong program.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

The data of problem C is not strong enough! My friend"s code fails in my data 5 1 3 1 3 2

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

when eitorials will be published of questions of this round

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I'm new to codeforces here. I had participated in this round. I just want to ask how do we know when editorials of the round will be up. (I'm not entirely sure that the editorials are released was just hoping that they are)

»
9 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

27471809 This is my submission for Problem C Vladik and Memorable Trip.Getting WA on test case 29..Can anyone Point out my mistake..Thanks in Advance :)

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Problem D doesn't match the difficulty 2100.