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

Автор vovuh, история, 8 лет назад, По-русски

Привет!

21 июня (четверг) в 17:35 (Московское время) начнётся Codeforces Round 490 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6 задач, которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Наверное, участникам из первого дивизиона они будут совсем не интересны, а для 1600-1899 покажутся простыми. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов. Я постарался сделать приличные тесты — так же как и вы буду расстроен, если у многих попадают решения после окончания контеста.

Вам будет предложено 6 задач и 2 часа на их решение.

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:

  • принять участие не менее чем в двух рейтинговых раундах (и решить в каждом из них хотя бы одну задачу),
  • не иметь в рейтинге точку 1900 или выше.

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

Спасибо MikeMirzayanov за платформы, помощь с идеями для задач и координацию моей работы. Спасибо Михаилу awoo Пикляеву, Максиму Neon Мещерякову и Ивану BledDest Андросову за помощь в подготовке и тестирование раунда.

Удачи!

UPD: Также спасибо step_by_step, kevinsogo и nhho за помощь в подготовке раунда и его тестирование.

UPD2: Таблица результатов!

Поздравляем победителей:

Rank Competitor Problems Solved Penalty
1 EricHuang2003 6 150
2 JerryKFC 6 151
3 Lovely_qgq 6 170
4 Meroeht 6 181
5 MYTH_vs_REALiTY 6 209

Поздравляем лучших взломщиков:

Rank Competitor Hack Count
1 djm03178 30:-2
2 2014CAIS01 13:-3
3 quailty 5:-2
4 Harmonium_Wale 4:-2
5 kimden 2

Было сделано 110 успешных взломов и 226 неудачных взломов!

И, наконец, поздравляем людей, отправивших первое полное решение по задаче:

Problem Competitor Penalty
A jh05013 0:01
B JerryKFC 0:02
C GrayGlobe 0:03
D T______________T 0:21
E NamikazeBoruto 0:11
F Counting_Stars 0:20

UPD3: Разбор

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

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

Thanks for conducting another div3 round!! Looking forward for participation :)

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

Why it's not in the homepage?

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

Can't be there some provision that people with rating(1600-1899 or maybe some lower) can also participate in div3(rated for them too) rounds with a totally different rank list i.e no cushioning for them and ensuring that ratings don't cross past 1899.

And as stated during announcement of div3 rounds problems will be easy for participants in the range 1600-1899,so it will be matter of just time.

OR

Maintaining a different rating graph can also be a way.

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

    I don't understand what the point of something like this would be. Maintaining two different rating graphs would be an enormous pain with very little payoff imo. If you really want to see how fast you can do it, just participate unofficially, it's not a big deal. Div 2 contestants get enough rated contests as it is.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится
div-3 rocks, I think you will give some critical test cases. Getting hacked after contest is too much painful.
»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится
Div-3 rocks. I think you will add some critical test cases.
»
8 лет назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

i do not like ACM_STYLE

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

I have doubt on using 20-min WA penalty for all ACM-ICPC style contests. Usually, the contests on Codeforces are length of around 2 hours and have 5-7 problems. But in ACM-ICPC contests, there are usually much more problems (10+) and they have long contest time (3+ hours).

Taking this mathmetically, let's say if a contestant A needs 5 more minutes than B to solve each problem. If they solve only 5 problems, A will get 75 more penalty than B, because every time you spent on the previous problems will affect the later solved problems' penalty. But when there are 10 problems, it becomes 275. In other words, it's proportional to the square of the number of problems. On the other hand, the penalty from the WAs would only increase linearly, as each wrong submissions have fixed penalty.

I'm not the only one thinking this way as I saw similar opinions on previous Div. 3 or Educational rounds too. I'm much like for having just 10-minute WA penalty for 2-hour contests, especially in a Div. 3 round, considering the accuracy of the official contestants would be quite low. How do you think about it?

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

I tried to make strong tests

I smelled FST :(

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

I like the term Hacked other than Failed System Test

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

2 hours to solve, 12 hours to hack... That's why I love CF... And then you get a "time limit" on the main test... :|

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

Looking for more frequent div3 contests such that beginners like me can learn! :) Best of luck everyone.

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

Rated or not? Maybe a silly question for others:(

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

IIR?

(Abbreviation of Is It Rated? :P)
»
8 лет назад, скрыть # |
 
Проголосовать: нравится -16 Проголосовать: не нравится
  1. Open Codeforces
  2. See a contest
  3. Checks contest starting time (worries might clash with Argentina's match)
  4. Checks contest length
  5. Gives contest peacefully.

PS- Thanks for not clashing it with Argentina Vs Croatia match.

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

A contest right after the senior high school entrance examination in China. Hope I will win the scores I lost these two days back as ratings.

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

Объясните пожалуйста, чем в итоге отличается достоверный участник от недостоверного, разве это поможет борьбе с неспортивным поведением? Ведь в итоге он рейтинговый для всех. Смогут ли недостоверные взламывать?

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

    Кажется, админы сами не поняли, что ничем не отличается.

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

    Недостоверные участники не попадают в таблицу официальных результатов. Они делят таблицу результатов с неофициальными участниками. Таким образом, они почти незаметны для "достоверных". С одной стороны это понижает дискомфорт для честных участников (это всегда неприятно видеть выше себя нескольких новичков, которые, наверняка, участники из первого дивизиона), а с другой — уменьшает мотивацию читеров так себя вести. На взломы и подсчёт рейтинга это разделение не влияет.

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

my first div-3 contest. feeling excited!

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

Does hacking solutions increases points of the hacker?

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

the predictor isn't working !

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

What is the test case 4 of problem E

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

How to solve Problem E? I was using DSU + DFS, but was getting WA!!

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

Last three problems were a little difficult for div3

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

Спасибо за контест , задачи интересные были;

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

That was a lot of fun! Thanks vovuh

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

What is wrong with test case 8 in D. Any strong test case?

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

how to solve E?

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

    I did it as follows : 1.)Mark all vertices that can be visited from s(by simple DFS). 2.)For rest of the vertices run DFS and count the number of nodes that can be visited by each of them.Sort according to the number of nodes visited by a particular vertex. 3.)Now run DFS from the last node in the sorted list and count the number of components left.

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

Was it only me who was facing problem to submit in the last 45 min?

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

For E, I removed all vertices that are reachable from s (excluding s itself), and then found the condensation of the new graph. The number of SCC's with indegree 0 (excluding the possible SCC that contains s and has indegree 0) is the answer. Is there a simpler way to do it?

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

how to solve D ?

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

    first put all the remainders with counts less than n/m in a set and then iterate on each index with value greater than n/m and for each of them find the closest element in the set and add the required value.

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

      Can you please explain a little more what you did. What do you mean by "and for each of them find the closest element in the set and add the required value."

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

        yes, sure. First put all the remainders with counts less than (n/m) into a set and then iterate over each remainder which have value greater than (n/m) (let's suppose we are currently at 'i') and notice one thing we have to only move forward so, the best we can do is to conver current 'i' to it's nearest remainder having value less than (n/m) and so just do a binary search for that and find that index.(set's lower_bound will help you). Now, it may happen that we are at 'i' and there are no index in range [i, m-1] having value less than (n/m) so, in that case we have to search for the same from front.

        Hope it helps!

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

          Yes, Your comment made it very clear. Thank you :)

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

          Why should we convert "i" to the nearest remainder having value less than (n/m)? Can't we covert it to any remainder having value less than (n/m)?

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

            because it may happen that some of the remainders before it (nearer to the current one) has a value greater than (n/m) and so, if we convert that then we have to pay less.

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

              Anyway, all remainders have to be filled equally. So if we convert "i" to its nearest one, then there may be some "j" which needs to travel farther and satisfy the next remainder. Else, if "i" already travelled farther and satisfied the second remainder, then "j" will just have to satisfy the nearest (first) encountered remainder. Both ways seem the same to me. Am I going wrong somewhere? If yes, please explain with a small counter case.

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

                you forget that we can only move right!

                let's aarray be 3 1 4 1 1 and we have to make all 2's.

                Then if we add 3's 1 to the 4th position (instead of nearest 2nd) then we have to take the 4's 1 to the 2nd position in which we have a total cost of (3 + 2 + 4) instead of the optimal cost which is (1 + 1 + 2).

                Hope it makes your doubt clear.

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

      i thought abt it..but don't u thnk it's complexity will be O(n*n/4)??

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

        see there are atmost 'n — m' elements that are greater than n/m and similarly 'n-m' indexes are there which have less than value n/m. So, we are inserting 'n — m' elements and for each of 'n-m' element we are doing a binary search. so, O(NlogN)

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

    Consider every reminder c[i] a container that can hold at max n/m numbers. As you read the input you put a[i] in the container c[ a[i] % m ], if it's full: you put it in the next available container and add to a[i] the number of steps. To do it quickly the next available container is registered in another array.

    Let me know if that makes sense.

    EDIT: An array to store the next available container isn't good enough, a set is needed.

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

      Hey there! I am also very stuck on this problem and your solution is not making sense to me. I have some questions, hope you will answer.

      -- If C[ a[] % m ] is full, how do you decide the next bucket in the container? Why do you add a[i] number of steps?

      -- At the end how do you track what the final array is?

      Thanks

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

        This is the code if you couldn't find it 39498091.

        -I decide the next bucket by lower_bound(a[i] % m) in a set of buckets, every time a bucket is full I erase it

        -I add to a[i] the difference between the buckets, which is how many times I have to increase it

        -The final array is the original one that I changed every time

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

How to solve F?

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

Четкие задачи, но резкий скачок от C (3372 успешные посылки) к D (381 успешная посылка) — это мощно)

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

can anyone help me how to solve problem D????

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

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

Help on E appreciated, please let me know what's wrong with this approach (which fails pretest 4):

  • Mark all vertices that are reachable from the capital (via DFS);
  • For any vertices not reachable from the capital, count (via DFS) the number of child vertices that are still not reachable from the capital, and put them in a priority queue sorted in decreasing number of children;
  • Greedily add an edge from the capital to the first vertex in the priority queue, and mark (via DFS) vertices that are now reachable from the capital, removing them from the priority queue;
  • Repeat the previous step until the priority queue is empty.

Thanks a lot for any insight!

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

I don't think it's OK to have contests in which almost all participants solve the first X problems, but then only a small percentage of them solve the (X + 1)th problem. The difficulty distribution seemed a little off for this round.

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

Any miniature version of test 4 of E?

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

Can someone tell why 39491266 gives WA but 39491559 gives RE for problem D.

I only changed all "int" to "long long".

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

I had been debugging my solution D(39490746) for half an hour. When the contest is over and I saw the test case, I realized the result is long long. So it(39494662)passed...

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

I rage quited after 3WA's in E and D
After the contest I checked my E again and Saw this:

""Diagnostics detected issues [cpp.clang++-diagnose]: p71.cpp:92:12: runtime error: index 5000 out of bounds for type 'int [5000]'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior p71.cpp:92:12 in""

I wish I would have checked my array sizes rather than rage quieting cf after 3WA's
and also wish codeforces will give RTE verdict rather than WA for these :p

Nice Problems Overall :D

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

Contest was not beautiful as its id.

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

How MYTH_vs_REALiTY solved all tasks in an hour ?

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

So, this was my first contest on Codeforces and I can't seem to find any ROOM link on the top menu bar nor can I find a way to lock my submissions so that I can participate in hacking. Do first time users don't have this privilege of hacking or am I missing something?

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

Thank vovuh for your contest, it was more difficult than last div 3 round.

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

I solved only 4 problems and its my first constest, my rank will go up or down?

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

Why My code for D getting runtime error on test 8 ?

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

In problem D i used a queue to store the number remainders . If the size of the remainders > n/m then we move one by one to the next container with the value (previous + 1). And keep doing that until everything is equal to n/m (only 1 needed 1 for) and traces and etc, why am i getting TLE ? and how can i fix this or maybe another approach ? Code : https://ideone.com/Z6Y8I5

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

can someone help me to find out why the first solution was not accepted but second got accepted for problem B

http://codeforces.me/contest/999/submission/39483346

http://codeforces.me/contest/999/submission/39486399

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

    It is not advisable to insert characters in C++ string like this s[i]=ch. You are allowed to do this in character array string.

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

      Really? So... how did you do it in your solution?

      Are both of you joking?

      Maybe I miss something but...isn't the problem with s1[r--] operation? These parts of code aren't the same, of course:

      s1[r--]=s[i];
      

      compare with

      s1[r] = s[i];
      r--;
      

      Doing something with s1[-1] and s1[0] aren't the same.

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

        changing s1[r--]=s[i] to s1[r]=s[i] doesn't make any difference. Still runtime error in testcase 8.

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

          Oh, sorry. I was a little tired yesterday. aditya10 is right. Little more: string is an object. When you initialise "string s1;" constructor make it s1 = "".

          So, when you write "s1[r] = s[i]" you just change the element with address s.begin() + r (not s1). And... we don't no, what the rubbish is there. When you are trying to change it, you can get an error.

          When you print the s1 itself (cout << s1), you see that it doesn't change. s1 = "".

          So...just initialize "s1 = s;". Now it has got the same number of elements as s, and all will be ok.

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

        Doing s1[r--]=s[i]; and s1[r]=s[i];r--; are actually same. In post decrement value is decremented after being initialized.

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

Regarding question D

I wrote the code using lower_bound(st.begin(), st.end(), t) and got TLE but when i wrote the same code using st.lower_bound(t) it got AC. Why this happened???

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

A, B, C was too easy and C, D, E was too hard. So the standings will probably depend on penalties.

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

I just realized I really need to practice to be a better coder.. I got the idea of d but struggled alot coding it and didn't have the time to solve it because of some annoying coding mistakes :(

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

Why my solution for problem C is exceeding the time limit in testcase#5 despite having linear complexity? here is the link: http://codeforces.me/contest/999/submission/39496135

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

Че-то у вас уже второй раз нифига не див 3 получается.

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

Hello! Can someone help me with Problem D? I saw the comment, but I do not understand it. Will appreciate if someone can explain the idea and how you reached it.

For Problem D, I did a BFS from the initial array until one array suceeds. This I feel is correct, but I had a memory limit exceeded within test 5.

Thanks

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

Hack for Problem C?

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

Can D be solved using two pointers ?

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

What is the effect on rating after hacking others solution in this round?

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

can someone explain the idea of F?

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

    For a fixed type of cards you have x cards and c players that them likes this type, so compute the dp[i][j](maximum value that you can get) where i is the number of remaining players and j is the number of remaining cards initially dp[c][x]=0 and the answer will be in dp[0][0..x] I leave the link to my solution for a better understand of this idea: 39504913

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

Can someone explain question F to me? I've read it thrice but I do not understand.

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

My solution for D: 39490456.

I believe my answer is just a permutation of the correct answer ( 4 2 1 6 11 12 ). Should this not get accepted considering any array satisfying the required condition is correct?

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

vovuh please check my submission for B it is not showing output on codeforces while the same is giving correct answer in my ide. This took my 40 mins. here is the code-!! :( Anyone having idea of this? Thanks for your insight!

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

Problems A, B, C vs problems D, E, F

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

    But really why was it like this? 100 participants with a full mark and almost all others with only three questions... Then the one who just codes faster, gets a better result. Is it a marathon or a contest???

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

Newbie here! Can anyone explain why I got TLE on problem C?? Problem C submission

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

My solution for D: http://codeforces.me/contest/999/submission/39505442. I think it's O(n) ?

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

Can anyone figure out the mistake in this solution for E? LINK

For tc #4, it is computing 1818 as the answer instead of 1817.

Approach : Run a dfs from source and mark all reachable nodes. Now, run a dfs from every unreachable node and mark all the ones that are being traversed from some parent. Suppose, we're running dfs from 2, we will mark every node reachable from 2 as visited, but we'll keep 2 as unvisited. This way, we will know the nodes(and components) which require a path from source.

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

Why is this http://codeforces.me/contest/999/submission/39505722 submission of mine for A giving WA on this case: 6 6 7 1 1 1 1 1 The answer is actually 5, but in cf it is showing 4. But in ideone compiler it is giving right answer. Link: https://ideone.com/je07LC

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

why rating is not updated yet?

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

did all the testcases are run or some testcases are yet to be judged during system testing

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

Is the system testing done? If not, when?

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

Can't believe that i have solved 5 problems!

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

For some reason 999F reminds me of game theory/mechanism design about auctions, when I first look at the joy level constraint I thought "oh this is a gross substitute valuation" instead of "oh it's strictly increasing"... Weird.

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

System testing has started now.

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

Need editorials!

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

.

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

Well I got TLE for C problem due to Java. That is why I am providing a link which could be helpful for Java programmers:

https://letsdocp.wordpress.com/2018/06/22/java-in-competitive-programming/

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

It would be great if someone can put editorial's link here. Thanks in advance.

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

I got TLE in Java for problem C and I got very confused about my logic. But then I researched a little more and I wrote this for Java programmers:

https://letsdocp.wordpress.com/2018/06/22/java-in-competitive-programming/

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

I am getting MLE in problem-D test-5 here. I have made vector and map of linear order.Anyone help ?

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

all those who got stuck on test 4 of problem E can try this test case no 47: 8 8 1 3 2 3 4 4 5 5 3 6 4 6 7 7 8 8 6 ans:1 you might be getting 2...

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

UPD: I got the mistake

In E, for test case 20, I get answer as 11, whereas the solution ans is 12. I even added the edges and put asserts to check that every node is indeed reachable from s, however I did not get any assert failures. Someone please point out what's going wrong with my solution, thanks! 39515068

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

I need help, even though my solution for test 1 was right, it gives WA on problem D. Here's the submission. Mine code outputs: 3 0 2 3 8 10 13 their answer: 3 0 2 3 7 10 14

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

I am getting WA at test# 4.

I tried Solving E: 1. Did the DFS on s, marked nodes visited. 2. initialized c = 0(counter: for counting connected components in Graph), then started running DFS on every node except S, forwardly(means when in the edges direction) and then took a step backwards(means run the loop to iterate over all the node which is pointing towards current node, for, eg, if 2 is current node and there is an edge 4->2, then I went back to 4.) and obviously marked the nodes visited. 3. then counted all the connected components.

here is my link: http://codeforces.me/contest/999/submission/39517716

Actually, my idea was simply to have the no of connected components fo graph. can someone please point out the mistake??

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

Since the system testing is done and my solution for E passed the tests,though i still don't know if its correct.

My solution:Find all the cities not reachable from capital and add a directed edge from capital to it.Now for all newly added edges just remove that edge and check if its possible to reach all cities from capital.If yes, then just remove that edge and continue checking for other edges,else add that edge back and continue checking.

I don't know how to prove that this gives the optimal answer.Can someone prove it or give some counter test for this?

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

    We know that an optimal solution is given by the following algorithm: for every SCC with in-degree zero, add an edge from the capital to some arbitrary node from that SCC.

    It is obvious that the edges your solution provides includes a set of edges that can be generated by the algorithm above (in other words, your solution does add an edge from the capital to every SCC with in-degree zero).

    What's left to prove is that your solution does not add any extra edges. Let's suppose via reductio ad absurdum that such an edge is added. Since it is an "extra" edge, it can fall into one of the following two categories:

    1) An edge from the capital to some SCC with non-zero in-degree. 2) An edge from the capital to some SCC where such an edge was already added.

    For case 1, that SCC is still reachable without this edge, so by definition your algorithm will have removed it, therefore it is impossible to have this kind of edge in the end.

    For case 2, since an edge was already added to this SCC, it means that its in-degree is now non-zero, therefore it can be reduced to case 1.

    We can conclude that your algorithm can not produce any extra edges, therefore your solution is optimal.

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

What is the solution of problem D????

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

I got WA test 8 problem D, I used set and binary search but I still don't know what is going wrong? Here is my code

EDIT: Oops, fixed it!.

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

editorial?