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

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

We will hold AtCoder Beginner Contest 130.

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

We are looking forward to your participation!

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

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

Auto comment: topic has been updated by chokudai (previous revision, new revision, compare).

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

The time link is not working. Please fix it.

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

Good problems. Atcoder must get someone who can write the problems properly in english for the beginner contests.

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

    I couldn't get AC on problem C. Now reading the AC solution I get it. I didn't understand the problem statement (I thought I did).

    I bet that the vast majority that got AC and not WA on problem C were reading the japanese problem statement.

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

      problem E too was quite unclear too. Problem C was quite clear i guess. Answer is always total/2. I guess many people got it wrong because they were trying to cut it only horizontally and vertically.

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

Could anyone show me a solution for E? I tried some algorithm but all of them seem to be TLE anyway.

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

How and where can I see the rank change and tutorial ?

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

Can someone explain problem C and how to approach the solution?

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

How to approach D ?

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

    I guess the easiest solution is using two pointers. Iterate through the first pointer, and increase the second one such that the sum of the current segment is $$$ \lt K$$$ and this subarray is the rightmost one. Then add the count of the numbers in the left as the sum from any of them to the current element would be $$$\geq K$$$. Code

    Another solution would be a binary search.

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

    We build the prefix-sum array s (s[i]=s[i-1]+a[i])

    For each i, we find the lower_bound of s[i-1]+k (>=s[i-1]+k). As the subsequence from i to pos (the lower_pound) will have sum >=k (because s[pos]-s[i-1]?=k). Because all the elements are positive so s[i] always >= s[i-1] so if subsequence from i to pos (the lower_pound) satisfy the condition, subsequence from i to pos+1, pos+2,... n will also satisfy the condition. So with each i res+=n-pos;

    #include <bits/stdc++.h>
    #define ll long long
    using namespace std;
    int n,a[100003];
    ll k,s[100003],res=0;
    int main()
    {
        //freopen("D.inp","r",stdin);
        ios_base::sync_with_stdio(false);cin.tie(NULL);
        cin >> n>>k;
        s[0]=0;
        for (int i=1;i<=n;i++) cin >> a[i],s[i]=s[i-1]+a[i];
        for (int i=1;i<=n;i++)
        {
            int pos=lower_bound(s+i,s+1+n,s[i-1]+k)-s;
            if (pos==n+1&&s[n]<s[i-1]+k) break;
            res+=n-pos+1;
        }
        cout << res;
    }
    
»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Where is the editorial available?

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

why no English editorial? For A,B,C problem, just paste the code should be ok. For C,D,E problems, just google translate from Japanese to English, and then some proofread. It should take less than an hour to finish it.

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

Can someone please explain F — Minimum Bounding Box.

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

    Bounding box area is a function which definitely has a minimum. Just check all bbxoes for time from 0 to 10^18 (could be less) with ternary search. All tests passed in less than second (will provide solution link later).

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

      Can you prove how the overall function is unimodal , like we could say/argue that (xmax-xmin) and (ymax-ymin) are both unimodal functions individually & independently , but can we prove that their product is always unimodal ?

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

        I don't think the overall function is unimodal, or a single ternary search is available here(Maybe it's formed by two or three unimodal parts).
        However, we have enough time to enumerate some 'important' time. Let's call a point '_vertical_' if it's D or U, otherwise horizontal. First, the initial situation should be important. Then, consider the following:
        - (Type $$$a$$$) the $$$minx,maxx$$$ for L, R and vertical points
        - (Type $$$b$$$) the $$$miny,maxy$$$ for U, D and horizontal points
        Within type a, note that the overall function may only change monotonic when two of the values meet, while the same set of points' $$$minx$$$ and $$$maxx$$$ never meet. So there are only 12 cases.
        Similarly, there are only 12 cases for $$$y$$$ coordinate.
        My submission
        Remember to give $$$min/max$$$ initial values!

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

          Thanks,

          I analysed them like this somewhat similar to your logic, firstly both of them are unimodal individually(we can prove it easily ) also another important thing is that graphs of xmax-xmin(t=time) is like union of line segments(proof: as x=x0+1*t; max/min of linear functions is linear ) . Observation: min of product of two unimodal functions def lies on one of extrema points of each function , Proof: consider a segment both can be increasing(overall product is also increasing ) , both can be decreasing(overall product of functions is decreasing ) , if one is increasing and other is decreasing(in this case overall monotonicity depends on sum of slopes but still we can gaurantee it as monotonic.) so basically we consider all points where there is a possibility of slope change of individual functions and evaluate of overall product function at these points only .

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

can u please provide editorials in English too . you expect us to compete at atcoder but you also know many are english speaking people here competing there and we beginners need that english editorials to understand those problems which cant be solved please .

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

Can somebody explain why the answer to Problem C will always be w*h/2 . I tried to consider two posibility first cutting vertically and another cutting horizontally. Last three test cases didnt pass.

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

Can someone tell me where i went wrong with problem E. Here's my solution https://atcoder.jp/contests/abc130/submissions/5980801

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

Is there is a people who solve the E with recursivic dp

If there is a people can he send him code?

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

next ABC is absence in google calendar

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

For the Problem D , We had to calculate the number of contiguous subarrays whose sum is at least K. I used Segment Tree for the Sum query and iterated over the N*N possible Subaarays. O(N*N*log(N)) which gave TLE for larger values of N. Max N = 1e5, Max k =1e10; Help me out !