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

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

Всем привет!

Завтра в 12:35 по Москве состоится Codeforces Round #376 для второго дивизиона. В это же время в Москве будет идти Московская командная олимпиада школьников, и, уже традиционным образом, на её основе мы составляем для вас раунд на Codeforces. К сожалению, сформировать хороший комплект подходящих задач для первого дивизиона в этом году мы не смогли, но, как и всегда, мы приглашаем участников из первого дивизиона написать раунд вне конкурса.

Задачи для вас готовили timgaripov, platypus179, wilwell, Flyrise, ipavlov и vintage_Vlad_Makeev под моим руководством. Также хочется поблагодарить членов жюри основной олимпиады Endagorion, Е. В. Андрееву и GlebsHP, который выступает также в роли координатора со стороны CodeForces. Не забудем и про стандартные слова благодарности в адрес MikeMirzayanov за систему Polygon, которая значительно упрощает процесс подготовки задач и координации деятельности большого количества вовлечённых людей, и за прекрасное сообщество, членами которого мы все являемся.

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

UPD Соревнование завершено, всем спасибо за участие! Разбор задач будет опубликован позднее.

UPD2 Прошу прощения за задержку с разбором. Наконец, он доступен здесь.

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

  1. DmitryBelikov
  2. ljsss
  3. kehKeLenge
  4. dilsonguim
  5. UoA_Menma
  • Проголосовать: нравится
  • +226
  • Проголосовать: не нравится

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

An automorphic Round (376)

376 * 376 = 141 376

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

Am I the last AC submission ?

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

Most of the schools are open at that time in Iran (and maybe other countries) :(

Missed four consecutive rounds just for the unusual time :(

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

Am I the only one feeling tired of reading comments like "Unusual is the new usual"?

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

downvote me plz

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

I hate this new usual time :(

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

Most of the Middle East universities are open in this time :'(

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

Did anyone notice a sudden increase in contribution points? My contribution went from -30 to -3 in less than 3 days, without any wave of new upvotes.

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

In contest invitation mail Zlobober isn't legendary!

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

The time is very good for Chinese competitor.

But it is a pity that the beginning time of this round is just the ending time of Dalian regional contest.

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

In the registrants list, Div. 1 participants are not marked as unofficial participants. Is that normal?

Update: it's fixed, actually.

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

why div 1 participants are not unofficial ?

Update : fixed

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

The round starts 1.5 hours after Google APAC 1D ends.

Will have to eat quickly, rest in that time and be ready for the round. :D

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

Love the timing of recent contests. Usual timing is 2am for me, so am happy to actually be able to participate in a few contests.

But I understand that others may not agree :)

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

Zloy bober

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

I'll join. It's my first time.

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

haha This time is good !

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

score distribution?

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

6 problems for 2 hours.Hopefully problem set will be easy at least 3.

Best wishes everyone.

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

10 minutes Late:)

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

Start delayed! How unusual!

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

Score distribution?

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

Типо на 10 минут ещё перенесли начало?

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

Upvote me, please!!!

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

Why Delayed ?

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

I just don't get what is this problem which happens right in the begin of the contest and can be fixed in 10 minutes !

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

800+ unrated users registered today we all know whats gonna happen

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

could some one say problem B more clear ? ! i cant understanr it : ( pleaseee ...

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

Problem B, Could He uses both coupons and discount at same time? like if it is 50 pizza, could he use 48 coupon and 1 discount?

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

My submission for D is in queue for 5 mins. Still waiting.

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

Am I the only one feeling tired of reading comments like "Unusual is the new usual"?

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

i hacked on F with complexity n*n for n=10^5. It failed ! Does the new server support 10^10 ??
Edit: Got it ! My test case wasnt good enough !

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

How to solve C?

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

    Hint: think about DFS

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

    dsu i think

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

      I too thought of dsu, but it kept failing at pretest 5. Any reason why it might not work

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

      Can anyone illustarate smooth dsu solution

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

        build a graph with undirected edges from each l[i] and r[i].now socks at indices l[i] and r[i] must have same color.now use dfs to find the connected components.its just like a normal dfs on undirected graph with edges from l[i] to r[i].each connected component should have same color.after finding components,for each component find the color which exists the most number of times and paint all other socks with this color.this minimizes the required number of paintings.for reference you can see my code.21497227

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

          Damn, I spent about 1.5 hours on this problem and couldnt solve it. How do you guys think up these solutions? I understand it, and it is quite simple, but why does it actually work? "find the color which exists the most number of times and paint all other socks with this color.this minimizes the required number of paintings" — I understand that sometimes you just see the pattern and cant prove it, but how to see this pattern... :( I failed many problems just not being able to see the pattern. How can I improve this skill? Thanks in advance

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

            me too couldn't solve it during contest and i realized it later. I think it all comes with practice.

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

            From my practice experience, whenver I think of a strategy in a scenario I go through steps like this:

            1. Come up with preprocessing ways that helps you analyze the situation.

            2. If it's a game then most of the time it is minimax considering it is the most frequent one that pops up.

            3. Go for greedy, enumerate a few test cases that I think that could be tricky to handle. If greedy still works, then go for it.

            4. If not, see if there is a dynamic programming relation between the states. Go for dp if it is available.

            5. If there is still no solution, then you are probably missing some major observation. Dig deeper into the sample cases for inspirations. Also check if the constraints are small enough for more naive solutions to pass.

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

    Build a graph like this : If you have socks l[i], r[i], then add undirected edge from l[i] to r[i]. Now for each connected component in this graph, you must have 1 color. So we can solve each component independently. It's optimal for each component to change colours of all nodes in that component to the colour that appears the most in that component.

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

    Consider socks as nodes and pairs as edges. Now in this graph,paint each component with the color which have highest frequency in that component.

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

    For input
    5 3 5
    1 1 3 4 5
    1 2
    2 3
    4 5

    You can split all the socks into groups (sets):
    S1 = {sock1, sock2, sock3},
    S2 = {sock4, sock5}

    All the socks in group S1 should be painted in a single color and all the socks in the group S2 should also be painted in a single color (probably, different from the color of S1).

    For the group Si we count the most frequent color among the socks and paint all the rest socks in that group to that color. In my example the socks in the group S1 have following colors:
    S1 = {black, black, red}

    The most frequent color in group S1 is black, so we paint the remaining sock (which is red) to color black. After repainting the set will look like that:
    S1 = {black, black, black}.

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

How to solve F?

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

please explain C I tried to do it bfs but it doesnt seem to be like that

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

    I did it using bfs, i made disjoint sets, and tried to find out the most repeated color in each disjoint set, and subtracted that value by size of the disjoint set.

    • »
      »
      »
      10 лет назад, скрыть # ^ |
       
      Проголосовать: нравится -30 Проголосовать: не нравится
      #include <stdio.h>
      #include <map>
      #include <queue>
      #include <memory.h>
      using namespace std;
      int n, m, k;
      int color[300000];
      map<int, map<int, int> > tree;
      map<int, map<int, int> > sorted;
      int index[300000];
      int index2[300000];
      int visited[300000];
      int cnt[300000];
      int ans, p;
      
      void bfs(int col, int s)
      {
          queue<int> q;
          q.push(s);
          int i;
          while(!q.empty())
          {
              int now=q.front();
              visited[now]=col;
              sorted[col][index2[col]++]=now;
              q.pop();
              for(i=0; i<index[now]; i++) if(visited[tree[now][i]]==0) q.push(tree[now][i]);
          }
      }
      
      int main()
      {
          freopen("input.txt", "r", stdin);
          scanf("%d%d%d", &n, &m, &k);
          int i, j;
          for(i=0; i<n; i++) scanf("%d", &color[i]);
      
          for(i=0; i<m; i++)
          {
              int l, r;
              scanf("%d%d", &l, &r);
              tree[l][index[l]++]=r;
              tree[r][index[r]++]=l;
          }
          int cur=1;
          for(i=1; i<=n; i++)
          {
              if(visited[i]==0)
              {
                  bfs(cur, i);
                  cur++;
              }
          }
          for(i=1; i<cur; i++)
          {
              memset(cnt, 0, sizeof(cnt));
              p=0;
              for(j=0; j<index2[i]; j++)
              {
                  printf("%d ",sorted[i][j]);
                  cnt[color[sorted[i][j]]]++;
                  if(p<cnt[color[sorted[i][j]]]) p=cnt[color[sorted[i][j]]];
              }
              ans+=index2[i]-p;
              printf("\n");
          }
          printf("%d", ans);
      }
      
      

      this was my code, when i realized that it fails sample test 2 please help me what is wrong?

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

    BFS works fine. The input is just not usual. For example, the input li = 10, ri = 42 may be repeated:
    10 42
    ...
    10 42

    this may lead you to insert 42 into adjacency list twice:
    adj[10].push_back(42);
    adj[10].push_back(42);

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

How did people use graph solution for problem C? What if graph is really dense ? It should go out of memory..

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

Что аномального в F? Почему так много участников прошли претесты на самую сложную, по мнению авторов, задачу? UPD: У меня второй контест подряд нулевое изменение рейтинга, лол. Стабильность — признак чего там? :)

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

Was F easy or there are some tricky cases waiting in system testing

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

ПО ЗАДАЧЕ С — АВТОРЫ ВЫ ЧЕГО КУРИЛИ,ЧТО БЫ ПРИДУМАТЬ ТАКОЕ УСЛОВИЕ.НОСКИ,БАНКА КРАСКИ,ДЕЛОВЫЕ ПЕРЕГОВОРЫ,ПОЙТИ ИГРАТЬ В КРУТУЮ ИГРУ,МАТЬ УЕХАЛА В ТЕПЛУЮ СТРАНУ.

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

I will fail b because I declared N to 1e5 and not 2*1e5, horrible mistake but I'm wondering why pretest doesn't cover such case!

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

Very interesting round to me !

I saw a lot of random solutions for F and some greedy for E... It will be a lot of WAs.

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

Can F be solved with a fenwick tree, and summing contents of the intervals between each power? I think that is O(n (log n)^2), is that fast enough?

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

How to solve F?

I noticed that the main card should be a prime, or 1.

Then I wrote a sieve and a map to insert a number along with its index (in sorted input) in the map for each of its prime factors.

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

D was really interesting. I got AC it using BIT. First of all, ans can be in range [0, c - 1]. For every successive interval, I found what intervals can lead to correct sorting order(handled by L and R), and what intervals cannot(handled by BIT). I maintained the interval [L, R] that contains the answer, and also BIT stores what index cannot be our answer. Finally, for any L ≤ i ≤ R, if BIT allows this to be an answer, print it. Otherwise answer doesn't exists.

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

Is the following approach for D right? I implemented this algorithm but it doesn't pass some pretests. Where is the mistake in this solution? Take two adjacent words, find the first position where letters are different. If the first letter is greater then we need to turn the wheel by minimum (c-a[i]) so that it becomes smaller than b[i]; if the second letter is greater then we can turn the wheel by maximum (c-b[i]) or else a[i] becomes greater. Store the maximum of the minimums and the minimum of the maximum and if the second value is less than the first then print "-1", else print the first value.

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

I used DSU for DIV2 C but I am getting TLE on pretest 6.http://codeforces.me/contest/731/submission/21488359

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

I solved the C problem with DFS, but I got TLE... How to optimize my code? http://codeforces.me/contest/731/submission/21484127 Or is it just recursive vs queue? XD

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

kudos to the author for such a nice contest!

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

What's the idea for solving E ?

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

As I see, problem F easier than problem D & E, problem B easier to WA then problem F :)) funny contest

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

Hopefully become Expert:)

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

I think problem C can be interpreted in 2 ways.
1. Counting cost of colouring of both left and right pieces of i-th pair of socks as 2.(Counting colouring of each left and right sock seperately)
2. Counting cost of colouring of both left and right pieces of i-th pair of socks as 1.

During the contest, I have implemented assuming case:1, which failed on pretest 3.
After the contest, I see that I was supposed to assume the other case.

Here are my submissions with only difference being which assumption was considered among the above.
Assumption-1 : 21492459 Failed
Assumption-2 : 21493466 Accepted

Should have got this clarified during the contest :(

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

can someone identify the mistake in my submission for "C", i keep getting WA on 6.

code = http://codeforces.me/contest/731/submission/21492734

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

Rating Updated!

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

Got TLE for C at test case 33 mysolution . I tried with DSU. Could somebody help?

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

Сейчас бы за F 3000 давать

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

Finally I'm Cyan !!, and I solved 3 problems from the first submission.
Self confidence is rising here !
thank you Zlobober very much for the nice contest

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

No hacks this time :-)

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

http://codeforces.me/contest/731/submission/21485811 WA in test case 66 :( Can anyone help ?

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

    I also unintentionally did the same mistake...Since the values of array may not be distinct. So, we should avoid calculation for same elements , otherwise if we calculate for value say, 1 or 2, for many times, then this will lead to O(n*n)...I had sorted array, then was trying to escape repetition, but forgot to do that while coding,, finally, which causes TLE :( .

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

How do you solve problem B? I wrote "something" which passed the pretests but it doesn't work it some cases. What's the normal solution for this problem?

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

anyone can find my code bug for problem C ????? I'm using DSU , calculating all socks needed minus the largest number of colors for every parent. http://codeforces.me/contest/731/submission/21491376

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

:'( F gave TLE on 26th test passed just by fast I/O Yeah Life is unfair!

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

I don't know why, but I found Problem B very tough (I solved it somehow though :P). Can anyone suggest a simple solution?

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

There is something mystery in this contest for my case. My code for solving problem C returns 2 for Test 5, which is correct, on my computer. But when I upload the code, it became 3, which is wrong answer.

Because it's correct on my computer so that I have no idea where it went wrong. Please take a look: http://codeforces.me/contest/731/submission/21493963

Many thanks. P/S: Picture proof.

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

Nice round.. I think problem F was overrated ... it should have been a C or a D. however it was an interesting round. thanks

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

3 points from getting blue :C Anyways, can someone please tell me the solution for problem F?

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

Spent an hour and 2 wrong submissions on C because I thought you had to color socks dynamically every day and not just all of them at once beforehand. :D

Good thing I went and solved F before realizing how easy C actually was.

Just wondering, how to solve C if you can color socks dynamically?

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

anyone knows why my solution for c fails? http://codeforces.me/contest/731/submission/21498239

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

Can someone explain the solution to Problem D?

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

    Here is my approach:

    For each block i (0<=i<n-1), compare them in lexigographical order. It should fall under one of these cases: (Let j be the position where a[i] and a[i+1] differs)

    1. a[i] is a prefix of a[i+1] — Great! We don't have to do anything, a[i] < a[i+1] is always true.

    2. a[i+1] is a prefix of a[i] — Great! Now we are screwed! The door is always locked.

    3. a[i] is currently lexigographical smaller thatn a[i+1] — Then calculate when will a[i] and a[i+1] go through the cyclic shift at j. During the period where a[i+1] has gone through the cycle and a[i] haven't, a[i+1] will be smaller than a[i].

    4. the reverse of case 3 — We will also calculate the cyclic shift time. This time, only the period where a[i] has gone through the cyclic and a[i] haven't will allow us to open the door.

    You can see that there will be intervals where you can open (or not open) the doors. Now all you have to do is check for the earliest moment where you can open the door.

    (You can use the range fill technique to invalidate a time interval. See my code here http://codeforces.me/contest/731/submission/21498917 )

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

      Can u please elaborate the last part of your solution. Means how you are using the chk[] array to check for intervals where we can shift the lock ??

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

        Let's say we are counting the amount of intervals at a certain point. The most naive solution is to increament each of the points within the interval by one — but this takes O(n) time to mark each interval.

        Instead, we can increase the start of the interval by one, and the point near to its' end of it by one, and calculate the prefix sum after we have mark all intervals, and this will tell us how many intervals lie on a certain point. Why does this work? Consider each interval individually, the prefix sum will cause all points on interval [left,right] increase by one, yet since [right+1] has a value -1, therefore it gets canceled and the interval [right,n) remains uneffected.

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

mfw practicing and see F only have the "brute force" tag.

 Dude What

nvm they fixed it. =]

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

I liked how none of the problems used complex data structure and algorithms.

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

quite surprised about the AC number of each problem.
I think E is quite easy, the idea is easy and very easy coding.
D is a little complicated to code, but the idea isn't hard.

F is hard for me, I didn't figure out a way by myself even after contest.

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

I hope for an editorial for this contest, as well as for Technocup.

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

plz upload the editorial!!!

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

I Can't get What is wrong on my solution... Solution I get Pretest Passed at 1:59.. but failed to pass Main test at Test22.

Please Let me know Why my solution is not working on this test case like 19999 10001 10002 10003 10004 ...

I solved The Problem F bruteforce. 1. sort input 2. from the small number to large number in the input, vec[1...n], Iterated if the mainpower key is v[i], if v[j] % v[i] == 0, pass. or not, v[j] -= v[j]%v[i] ( to make secondary power) 3. print the answer

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

i think there maybe some mistakes of problem F. the two same codes, the first code, define maxn=1000100,it AC;21510847. the second code, define maxn=200100,it WR on31;21510692.

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

21506585 — > What is my off by one error? :(

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

Could anyone comment the Problem E example 2?

input: 1 -7 -2 3
a)
turn 1: A takes 1 -7 -2, puts -8
turn 2: B takes -8 3
totals: A - B = (1 -7 -2) - (-8 + 3) = -3
b)
turn 1: A takes 1 -7, puts -6
turn 2: B takes -6 -2 3
totals: A - B = (1 -7) - (-6 -2 + 3) = -1

Why (a) is corrent answer? (b) is better than (a)!
»
10 лет назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится

When will the editorials be up!?

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

Where is the tutorial?

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

@Zlobober Please add tutorial to the box names [→ Contest materials] on the righ_bottom of web-pages of the problems. Thank you.