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

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

UPD: Отдельное спасибо Михаилу awoo Пикляеву за помощь с переводами и обсуждение задач, Максиму Neon Мещерякову за обсуждение задач, Артему Rox Плоткину, Дарье nooinenoojno Степановой и Tommy STommydx Li за тестирование раунда!

UPD2: Разбор опубликован!

<almost-copy-pasted-part>

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

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

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

Штраф за неверную попытку в этом раунде (и последующих Div. 3 раундах) будет равняться 10 минутам.

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

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

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

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

Удачи!

Также хочу сказать, что участники, намеренно отправляющие неверные решения и взламывающие их после окончания соревнования (пример), не будут показаны в таблице лидеров по взломам.

</almost-copy-pasted-part>

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

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

I can’t register for the contest unofficially. Is something wrong? Edit: Can now.

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

rtd?

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

Vovuh проводит отличные соревнования по div 3

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

what factor decides the number of problems ? Planetory motion?

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

Don't give up, Learn from your mistake

I've made some mistake on vovuh's previous contest Educational Codeforces Round 73 (Rated for Div. 2) and Codeforces Round 587 (Div. 3), It's my high time to apply what's I learn from that mistake.

Thanks vovuh for giving us another chance to improve our skills (and rating ;-) )

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

This contets is 1234 contest in codeforces Good luck to everyone.
Codeforces Round 590 (Div. 3)
https://codeforces.me/contests/1234

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

Will vovuh surpass awoo

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

I really like your contests, hope it doesn't get like Codeforces Round 579 (Div. 3) that the judge was so slow. good luck in the future contests vovuh :)

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

I_love_vovuh

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

I will AK this contest !!! And I will AK IOI2020 in just 3min with Denverjin !!!

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

I know that it is out of topic, but will the Technocup Elimination Round 1 be rated?!

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

Hope to become blue after this round.

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

Can anyone please tell me which problem has two subtasks? @vovuh

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

Hopefully problems won't be bad like last contest!

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

QueueForces?

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

What is the reason behind giving ~50 test flies for problem D?

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

Why always this problem -> Queue

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

More than 5 minutes testing queue :(

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

this queue affected me really more than 15 minutes !

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

Look at rank 17 (Alex_____Wei) and rank 18 (AIex_Wei). Are they the same person?

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

Жду когда в А начнут пихать подзадачи

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

    Какая разница, какая из задач содержит в себе подзадачу, если это сглаживает переходы по сложности между ними?

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

      Мне кажется, что если нужно сгладить переход по сложности лучше вставить новую задачу, а не разбивать задачу на две: тупейшую реализацию и собственно задачу.

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

Is F a well-known problem?

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

72150714_3373957409311801_8642731821810843648_n.jpg

:(

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

I tried to solve D using fenwick tree but I failed coding it terribly anyone can tell what's wrong in my solution
link

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

Sorry, but don't know the purpose of problem D unless there exist a solution without log(n) factor. C was far better than D. How to solve E?

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

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

How to solve C?

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

    There is one way from $$$(1,1)$$$ to $$$(2,n)$$$ in any dataset, for which answer is "YES", only .

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

    I have used the simulation strategy to solve this problem:

    start from column 1 and row 1 :

    if(pipe of type 1 or 2): you have to just move to next column with the same row else if(pipe of type 3,4,5 or 6): ... check the other row with the same column should have pipes(3,4,5 or 6), if(check = true): just change the value of row i.e from row=1 to row 2 or from row=2 to row 1 else if(check = false): you should print no as final answer

    at last if row == 1: you should print 'NO' else The final result remains as it is what you get from the previous steps

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

    You can understand better with my code: q=int(input())

    for _ in range(q):

    n=int(input())
    
    s1=input() #column 1
    s2=input() #column 2
    
    r=1  #value of row
    ch=1 #variable to check the results during simulation
    
    
    for i in range(n):
    
        if(r==1):
            if(s1[i]=='1' or s1[i]=='2'):
                ch=ch
                r=1
            else:
                r=2
                if(s2[i]=='1' or s2[i]=='2'):
                    ch=0
    
        else:
            if(s2[i]=='1' or s2[i]=='2'):
                ch=ch
                r=2
            else:
                r=1
                if(s1[i]=='1' or s1[i]=='2'):
                    ch=0
    
    
    
    if(ch==0 or r==1):
        print("NO")
    else:
        print("YES")
    • »
      »
      »
      7 лет назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      I used the same logic but there was a small mistake which I could fix only now :((

      while(q--){
              int n; cin >> n;
              int arr[2][200002];
      
              string s; cin >> s;
              for(int i = 0; i < n; ++i) arr[0][i] = (s[i]-'0');
              cin >> s;
              for(int i = 0; i < n; ++i) arr[1][i] = (s[i]-'0');
      
              int row = 0;// 0th row;
              bool done = false;
              for(int i = 0; i < n; ++i){
                      if((arr[row][i] == 3) || (arr[row][i] == 4) || (arr[row][i] == 5) || (arr[row][i] == 6) ){
                          if((arr[1-row][i] == 1) || (arr[1-row][i] == 2) ){
                              cout << "NO\n";
                              done = true;
                              break;
                          }
                          row = 1-row;
                      }
              }
      
              if(row == 1 && !done){
                  cout << "YES\n";
              }
              else if(row == 0 && !done){
                  cout << "NO\n";
              }
      
  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I solved C using recursion, but was able to submit after 20 min of contest(my bad was not able to figure out one error)

    Usually during contest, i coded with comments so i don't get lost for what i need to do.You can check my submission here: https://codeforces.me/contest/1234/submission/61665005

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

Can anybody tell me test case 4th in problem E?

EDIT Forgot to take long long :(

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

Why unordered_map fails for Problem B2? I got TLE using unordered_map, but I got AC using map.

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

Hi all I tried to solve problem D using segment tree , but gets TLE at test 4. What's wrong with my submission ?

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

Can anyone please tell me the difference between these 2 codes for problem B2 — https://codeforces.me/contest/1234/submission/61663199 (AC code)

https://codeforces.me/contest/1234/submission/61657941 (TLE code)

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

something wrong with the problem tags

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

I registered but didn't manage to enter the contest in time. Is my rating going to get affected ?

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

In Problem A, those who used ceil() function directly in cout, got WA.. Could you please explain why??

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

Can Anyone tell me what's wrong with my code for D. I'm getting TLE for this Sol link — https://codeforces.me/contest/1234/submission/61662523

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

haha, this div3 was more educational for me than all educational rounds.

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

Admin please rejudge the solutions of problem B2 for those who get TLE for using unordered_map and got AC by changing it to map . It wasted valuable time trying to figuring this out and I thought it was problem with my logic.

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

is there any way we can use binary search on TreeSet In Java. In problem D was adding all the indexes of every character in TreeSet but don't know how to use binary search on TreeSet.

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

How to solve F??

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

Why do I get TLE here? It is simple segment tree working in q * 26 * LOGN https://codeforces.me/contest/1234/submission/61659331

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

I came up with the ideal of problem C early but I can't implement it quickly. It took me more than 1 hour to implement C. So, I have about 30 min left for problem D, I also came up with the solution but I can't debug on time. Now I solved D, very funny experiment =)))

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

I used segment tree, stored set in each node, i think the complexity should be O(q*log(n)*27). And i got TLE, Any idea why?

CODE: https://ideone.com/D2AmFn

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

Pathetic Contest

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

the best hacker link

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

Can anyone explain why unordered_map solution is getting TLE and map solution is getting accepted for problem B2. Is there any specific case where unordered_map is slower than map.

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

how to solve C??

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

    First you can start with the idea that there is only a single path that can allow flow of water from (1,1) to (2,n+1),because if you receive water from one side of pipe, another end can only face a fixed direction if you are getting water from fixed and unique direction (except for the case when you have tilted pipe and receive water from left side to that pipe, so it could continue flow in up or down direction ). So simulate that flow till either an out of bounds occur, otherwise if you reach (2,n+1) before, your answer is "YES", otherwise "NO". Hope it helps

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

I see people complaining that unordered_map gets TLE, then why didn't I get TLE during contest, even I didn't get it after the contest. (Just submitted 2 min ago)

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

My question might be stupid but I gotta ask. What's the point of having a hacking phase in Div3 and Edu rounds if hacks aren't counted in the score?

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

I tried to solve D using sqrt decomposition but didn't manage to implement it right, can someone spot the error in my code?

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

After quiting codeforce contest for about 3 years, I participated in 590 and 589.
It seems the problems have become harder than that of 3 years ago, problem E and F of 590 div3 has similar difficulty of typical div2 E 3 years ago.

I thought I had been more skilled, but the problems have been harder...

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

For Problem F ; You can use SOS DP. Question Statement changed : We need to find out 2 substrings such that they contain different letters and are non overlapping.

If we were to consider the strings as integers, where each character represents a bit ( where in set bit means that, the character is present ). For eg : binary for ac would be 101. Now you need to form all such numbers(strings which cannot have length more than 20, as then it would for sure contain a repeat).So insert all the strings starting at one position without having any repeated character. And then you need to check for each number whether it has a subset of its complement. We will consider the subset having the maximum number of set bits, which can be found out by simple SOS DP. Link to the solution : Using long long int (not required) : it may give tle as this solution : https://codeforces.me/contest/1234/submission/61652445 Using int : https://codeforces.me/contest/1234/submission/61743609

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

Can anyone please tell me what's wrong with my code for B2? 61673618

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

WTF!!!!

How the Editorial published before end of the hacked phase?!!

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

The long queue really spoiled the contest to be honest With B2 not working for unordered_map i had to make three wrong submission(equivalent to 45 min long queue wait) to finally realize the error. :\ Could have solved c and d had the queue not been so long :(

Changed my dp cause the contest has really spoiled my rating

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

how to solve C problem?I have no idea.

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

My code for B2 got hacked (time limit exceeded) and i really can't understand why. I made a simple solution with a set and a deque. I have seen this kind of solution at everybody and they still got accepted. 61660949. What can be the problem?

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

A moment of silence for my fallen brothers and sisters who got TLEd/hacked in B2 because they were innocent enough to trust the default hash in unordered_map and unordered_set instead of using a custom hash. You were too pure for this cruel world filled with hackers.

You shall be honoured, your sacrifice shall not be in vain. Fear not, you shall rise stronger than ever, and ascend to your rightful place in this world !

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

Is it fair that a single person hacks 50 B2 questions with the same test case? The lack of test cases and the long queues made the contest worse!

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

Getting aged by waiting for system testing.

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

When will the ratings be updated for this contest ?

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

System testing is taking more time than the actual contest.

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

Round was cool, especially problem D and E. Hope in future will be rounds like this!

Thanks for vovuh for the nice div3 round.

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

Hello all! How can I find my position after a contest? (if I haven't a history)

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

My Solution to Problem D was skipped . According to the rules , there is no problem to use third party code if it was published before the contest. The problem is a reduced version of the problem DISTNUM . So , i used this as template and changed accordingly , This is my solution . I guess this solution also did something like that . It is a coincidence that both used the same source . So , can you please put me back to the contest ? MikeMirzayanov

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

I used segment trees for problem D. Each node of the tree was an unordered map of type < long long int, bool >. I am not able to understand how it is showing TLE for test 4. Any help would be highly appreciated. Down below is my code


#include <bits/stdc++.h> using namespace std; #define ll long long int #define rep(i,n) for(i=0;i<(n);i++) #define pb push_back #define mp make_pair #define ff first #define ss second #define all(c) c.begin(),c.end() #define endl "\n" typedef pair< ll, ll > lpair; string s; vector< unordered_map< ll, bool > > tree; void combine(unordered_map< ll, bool >& fin,unordered_map< ll, bool >& s1, unordered_map< ll, bool >& s2) { fin.clear(); unordered_map< ll, bool > :: iterator it; for(it = s1.begin(); it!=s1.end();it++) fin[it->first] = true; for(it = s2.begin(); it!=s2.end();it++) fin[it->first] = true; } void build(ll v, ll t1, ll t2) { if(t1 == t2) { tree[v].clear(); tree[v][s[t1]] = true; } else { ll mid = t1 + (t2 - t1)/2; build(2*v + 1 ,t1,mid); build(2*v + 2,mid+1,t2); combine(tree[v],tree[2*v+1],tree[2*v+2]); } } unordered_map< ll, bool > query(ll v, ll t1, ll t2, ll left, ll right) { map< ll, bool > ch; if(left > right) return ch; if(left == t1 && right == t2) return tree[v]; ll mid = t1 + (t2 - t1)/2; unordered_map< ll, bool > ans; unordered_map< ll, bool > s1 = query(2*v+1,t1,mid,left,min(right,mid)); unordered_map< ll, bool > s2 = query(v*2+2, mid+1, t2, max(left, mid+1), right); combine(ans,s1,s2); return ans; } void update(ll v, ll t1, ll t2, ll pos, char c) { unordered_map< ll, bool > ch; if(t1 == t2) { tree[v].clear(); tree[v][c] = 1; } else { ll mid = t1 + (t2-t1)/2; if(pos <= mid) update(2*v+1,t1,mid,pos,c); else update(2*v+2,mid+1,t2,pos,c); combine(tree[v],tree[2*v+1],tree[2*v+2]); } } void solve() { cin>>s; tree.clear(); tree.resize(4*s.length()+1); build(0,0,s.length()-1); ll q,type,x,y; ll n = s.length(); cin>>q; while(q--) { cin>>type; if(type == 1) { char temp; cin>>x; cin>>temp; update(0, 0, n-1, x-1, temp); } else { cin>>x>>y; cout<<query(0, 0, n-1, x-1, y-1).size()<<endl; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); return 0; }
»
7 лет назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

epic contest for epic programmers i congratulate you!1

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

WHY did you add anti-unordered set tests in B2? I could've become expert in this round https://codeforces.me/contest/1234/standings/participant/28564088# unordered set https://codeforces.me/contest/1234/submission/61718932 usual set

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

J Q K A