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

Автор chokudai, история, 6 лет назад, По-английски

We will hold AtCoder Beginner Contest 163.

The point values will be 100-200-300-400-500-600.

We are looking forward to your participation!

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

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

Cannot access problems!!!

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

Can't see the problem statements. :(

Edit — Unrated. F

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

Can't see the problem statements only submit code is visible.

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

contest is unrated .

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

If someone wants to see the statements, press Ctrl + U and scroll the page down to the problem statement.

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

What does 'internal error' mean?

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

Looks Like Atcoder is getting Inspired By CF

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

Is the contest Unrated?

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

scalability issue

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

When E has more solver than A

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

How to solve D-F?

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

How to solve E?

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

How to solve F?

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

I don't know if it was just me, but the website had full functionality in Firefox and not Chrome for the duration of the contest.

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

Is E maximum weighted bipartite matching problem. I have heard of the algorithm but don't know the algorithm.

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

I need help for problem D. Somebody help me! Why I got WA? here is the code.

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

For D the key observation is, that for any set of $$$k$$$ choosen numbers, we can build any sum in the interval from smallest possible to the biggest possible.

And those both numbers can be calculated in $$$O(1)$$$, so we can calculate the sum in $$$O(n)$$$.

Min sum for $$$k$$$ of $$$n$$$ is $$$((i-1)\cdot i)/2$$$

Max sum for $$$k$$$ of $$$n$$$ is $$$n\cdot i - ((i-1)\cdot i)/2$$$

$$$ans=\sum\limits_{i=k}^{n+1}{max(i)-min(i)+1}$$$

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

Can someone explain the recurrence and DP transitions in E?

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

    I'll assume you already know that we should process the children from the biggest Ai first.

    Define dp[l][r] as the maximum happiness we can get if we want to put the remaining children to index l to r. The answer will be dp[1][N]. If the current state is (l, r), that means we are currently processing child with index i = N — (r — l + 1) + 1. We will have two choices, either put this child to index l or index r. If we put it to index l, then the happiness will be abs(l — child_initial_position) * A + dp[l + 1][r]. If we put it to index r, then the happiness will be abs(r — child_initial_position) * A + dp[l][r — 1]. We will take the maximum of those. Hope it helps.

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

    You can have a look at the English commentary of Problem E here.

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

    take the sample 1 3 4 2 as example, the impact of every element in array should like this: [0, 1, 2, 3] [3, 0, 3, 6] [8, 4, 0, 4] [6, 4, 2, 0] it is easy to know that for every element, the impact of it is increasing whit itself like the element 4, the position is 3 then the effect of position of 4, 2, 1 is 4, 4, 8

    now you can see that like two element ai and aj, ai>aj, both ai and aj wants position k, we need to put ai at k because: first put all ai and aj to k: (ai*(k-x))+(aj*(k-y)) now we need to move one to k-1 because just one can put to k, if we move ai we need minus ai, move aj we need minus aj, because ai>aj, so put ai at k is better.

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

O(1) Solution for Problem D

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long n, k;
  cin >> n >> k;
  cout << (2 * k * k * k - 3 * k * k * n - 6 * k * k + 3 * k * n - 2 * k + 
           n * n * n + 3 * n * n + 8 * n + 12) / 6 % 1000000007 << endl;
  return 0;
}

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

What am I doing wrong in Problem D? code

In my code, for sample case-1,

ind = 0 1 2 3

pre = 0 1 3 6

suf = 6 6 5 3

sum += (5-1+1) + (6-3+1) + (6-6+1) = 10

I am just calculating min and max sum using prefix and suffix sums, but this approach isn't working for sample case-3.

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

What's wrong?I can't see the statement!

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

Can someone tell how to solve F?

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

I finally passed a solution for F (in 1829 ms)!

I realized the obvious technique of counting the sizes of the regions between two colors, doing the N*(N+1)/2 trick, and then complementary counting.

However, my implementation was really messy (main code was nearly 200 lines long!).

I ended up doing a pre-order traversal, and keeping track of a Binary Indexed Tree for each color. Any other ideas?