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

Привет, Codeforces!

В Oct/11/2020 12:05 (Moscow time) состоится Educational Codeforces Round 96 (Rated for Div. 2). Обратите внимание на необычное время старта раунда.

Продолжается серия образовательных раундов в рамках инициативы Harbour.Space University! Подробности о сотрудничестве Harbour.Space University и Codeforces можно прочитать в посте.

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6 или 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Адилбек adedalic Далабаев и Александр fcspartakm Фролов. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Удачи в раунде! Успешных решений!

UPD: Разбор можно найти здесь.

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

Rank Competitor Problems Solved Penalty
1 WZYYN 7 186
2 137_345_2814 7 194
3 jiangly 7 200
4 LayCurse 7 203
5 dreamoon_love_AA 7 258

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

Rank Competitor Hack Count
1 ViciousCoder 100:-9
2 ManasG 45:-13
3 Valera_Grinenko 57:-40
4 abu-halimah 36:-3
5 fstzyh 38:-9

Суммарно было сделано 858 успешных взломов и 2258 неудачных!

И, наконец, участники, получившие вердикт "Полное решение" первыми:

Problem Competitor Penalty
A sevlll777 0:01
B jkchen 0:03
C alireza_kaviani 0:03
D jkchen 0:12
E MagicSpark 0:05
F LayCurse 0:36
G MagicSpark 0:36

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

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

This unusual time makes me unusual :(

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

4AM for me :(

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

notice the unusual time getting usual

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

why unusual time for ECF...2AM

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

Hmmm.... from Edu 46, every Announcement blog was authored by pikmike and he was always included in the problemsetters' tab. Did he get angry from all the downvotes from last round? The last round was pretty great problem-wise, learnt a lot, especially from problem G.

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

Note that the start time is unusual, is getting usual to us :)

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

No vovuh , Roms , Neon and awoo! Are they okay?

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

my hope to return a cm

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

Normally unusual timings is due to a live contest happening at the same time. Is there any reason this time?

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

Lunchtime for me :(

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

ECF and opencup are at the same time, not cool

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

I will be doing online class and contest together. Shouldn't miss a single contest in this quarantine <3

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

The timing is great for me. Thanks :)

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

Can anybody explain me what does solution hacking means? Thanks in advance.

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

    Once the 2-hour problem solving round is over, participants have the option, to see the solutions submitted by other participants and try to generate possible inputs, upon which these solutions might end up giving incorrect outputs. This is what hacking means. All of this has to be done in a 12-hour hacking phase just after the contest. Once this 12-hour phase is over, solutions are re-judged based on all the hacks generated. Hope this helps!

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

Great start time for chinese participants:D

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

2 days Back to Back Contests

10 October 2020 HHKB Programming Contest 2020 Codeforces Global Round 11

11 October 2020 Educational Codeforces Round 96 AtCoder Regular Contest 105

Great for learning

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

I think there should be more contests of this Asian timezone. Maybe there should be two types of contests for Europeans and Asians.

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

11 minutes left time to be ready : )

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

Will BledDest be conducting the future rounds as well ? He's been conducting the last 2 EDU rounds too.

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

Please, less ad-hoc.

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

    please graphforces

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

    C and D without educational worth.

    C is just "try it, should work...somehow", D is kind of edgecase hunting.

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

      Nah, C was kinda cute. To minimise the end value, we had to keep as many smaller digits as possible was my conjecture (which I indeed took a few minutes to prove after a guess submission). The solution (I think) was to take the biggest two values and perform the ceiling operation and then continue. D was quite great too if we (at least I) didn't misinterpret what the problem statement. I thought E could be something to do with segment trees and inversions but that didn't end so well for me implementation-wise.

      I looked at your submission for C and it was kinda hilarious to see your struggle in comments. Well done though!

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

        I just recalled those two problems, and still, I think I did not learned anything from them.

        In C you see the intended solution by coincidence, or you do not. If you do not come up with the idea to simply add the two biggest values you'll get stuck at this problem. Or find some other algo which coincidently works, too, like mine. But for somebody who did not solve C the thing you get is "There is nothing you can do. Solve more problems, mayby then someday you'll get the intuition to have the right idea at the right time."

        And problem D is basically the same. You find the right pattern by blindly trying some pattern. Or you do not find it. I found the three points given as hints in the tutorial within like 10 minutes. But still did not found a way to make it a working algo for like an hour. And afterwards, just like in C, absolutely no knowledge of what I could have done differently or better.

        That might be nice riddles, but from my point of view no problems to educate anything.

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

scoring?

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

I am eagerly waiting to see the test case no:2 of problem D,,,huh.

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

Idea behind E?

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

Contest Finished.

Can we discuss the problem before system judge?

I have not too much ideas about F&G

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

problems just awesome in this contest.

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

How to solve D?

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

How to solve D????

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

Problems just awesome in this contest.

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

How to solve E?

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

    Have an vector of stack of size 26 where u push each character to respective bucket initially. Now we know that the first character has to reach the end. But the important thing to notice is that only the last occurence of the first character is required to reach end to save operations, that is why we maintain a stack to get last occurence.

    Now if we know that the last occurence of ith character is at position j, we also need to know how many of the characters from j to n-1 have already been push to right and for that we use segment Tree/BIT.

    So at each postion ans += n — 1 — (no. of char in [j,n-1] already pushed) — lastest position of that char

    Heres my Submission

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

      Could you explain why do we need to know the number of char already pushed? And how about handling the chars that has index larger than n/2?

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

        That is because set of character after the last character given in the input are already in reverse and we dont need to consider them. It would be better to explain with an example.

        Lets say we have the string: icpcsguru

        First move: We move the i at postion 0 to the end and get cpcsgurui. moves=9-1-0=8

        Second move: We move the c at position 3 to end(after u) -> cpsguruci. moves=9-1-3=5

        Third move: This is the important one. Here we move the p at position 2 but the moves wont be 9-1-2, instead it would be 9-1-2-1=5.

        This is because the c ahead of p is already moved to end and this is exactly why we need a range query from j to n-1 to get how many are moved to end.

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

Why did you not bold 'prefix' in D :(

delete the maximum length prefix consisting of the same characters...

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

I misread B and thought that only adjacent swaps were allowed.

(Sorry for the edits)

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

Helps for Problem D please

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

    precompute an array of sizes of chunks of 0s and 1s for [0, 0, 0, 1, 1, 0, 1, 0, 1, 1] -> [3, 2, 1, 1, 1, 2] now in each step first chunk would be removed anyway but we need to remove 1 other element before that, choose the chunk either after it or itself that has size > 1, if theres no such chunk remove the last element

    Since we never delete a chunk of size 1 from middle, it is ensured that two chunks are never merged. Hence we will always get the optimal answer.

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

      I used nearly the same approach. But when there is no chunk of size >1 then I just add (remaining unprocessed elements+1)/2 Here is my submission.

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

      I actually did this exact thing .. You would see if you go through my last two submissions .. I now want to figure out where it went wrong

      Upd : I got the bug .. actually I thought to use the first non one value and hence used a priority queue to keep the minimum next indices avalaible for operation only to realize now that we get a maxheap as a default.. my bad.. Got the same code accepted Now. Thanks for replying and help anyways :)

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

What on earth is Test Case 2 for D ?

UPD : my greedy fails for 5 10111, ans should be 3, not 2. Optimal way is to take 5th character first.

Damn, it seemed so obvious, the guy who set this problem is pure EVIL!

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

this contest actually had a really good combination of problems ! neither too easy , nor extremely tedious . Thanks BledDest for the contest

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

What hurts more?

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

please tell me why my answer for B is false this is my answer:

include<bits/stdc++.h>

using namespace std;

int main(){

int t;

cin>>t;

while(t--){

    int n,k;

    cin>>n>>k;

    int a[n];

    for(int i=0;i<n;i++){

       cin>>a[i];

    }
    int kk = sizeof(a)/sizeof(a[0]);

    sort(a,a+kk);

    int i=2;

    while(k--){

       if((n-i)>-1){

         a[n-1]=a[n-1]+a[n-i];

         a[n-i]=0;

         i=i+1;

       }

       else{

         break;

       }


    }

    cout<<a[n-1]-a[n-2]<<"\n";
}

}

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

Is there a greedy approach for D ?

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

why my solution got accepted after changing int to long long https://mirror.codeforces.com/contest/1430/submission/95208979

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

Anyone can tell how to solve F & G ?

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

    F is DP

    $$$dp[i][j]$$$ = minimum cost (in bullets) to beat $$$i$$$ rounds (and start the next round) with $$$j$$$ bullets remaining in your magazine.

    Note that since $$$j \leq 10^9$$$ you should use a map/associative array for that dimension.

    The initial state is $$$dp[0][k] = 0$$$. Each state can be the parent of up to two states, one with $$$j \lt k$$$ (no reload after round) and one with $$$j = k$$$ (reload after round; only transition to this state if you have enough time). A state may also "dead-end" if it is impossible to beat the current round from it; if all states dead-end the answer is $$$-1$$$.

    This fits in $$$O(n^2)$$$ or $$$O(n^2 \log)$$$ as the number of states increase by at most one each round (the $$$j = k$$$ state may create a new $$$j \lt k$$$ state, while the $$$j \lt k$$$ states only "move" about or merge into the $$$j=k$$$ state)

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

Can anyone tell me why this O(nlogn) solution for E gives TLE at test 41 solution link

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

D was EVIL :(

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

Hey, I don't know about the hacking scene yet. Can someone tell what's the points for successful hack and penalty for unsuccessful hack or link for blog which have information for all this?

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

Is there any other way to solve E without using fenwick tree/ segment tree ?

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

hi, can anyone tell me, what is hacking? and did it give score also?

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

Can C be solved using heap? This solution gave TLE but I just to know if there is any way to optimise it or if it can't be solved using a heap. This solution without heap worked correctly.

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

First I convert 1000111000 to [1,3,3,3] then if the chuck is greater than one than i add one to my ans , if the chuck is equal to one than i remove one from the biggest chuck remaining , 95255021 can someone point out what's wrong with the approach

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

    An example test case is -> 1 13 1010010101111

    Your approach gives 6 while the answer should be 7

    The problem is that we should not remove from the biggest chunk because we may exhaust it early. The ideal way is to remove from the first chunk which is greater than 1. That way we can optimally utilize the chunks. In the example, it exhausts (1111) which could have been used for 6th element while we could have reduced the (00) for the 1st element.

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

Prob C hurts me a lot. I even don't have time to catch up Prob D.

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

My screencast of getting 7th place [assuming I don't FST], along with solutions to all problems is being uploaded to my youtube channel. Youtube should finish processing it in 20-30 minutes or so. If you want to see it as soon as they finish processing, you can turn on notifications. Good morning and thanks to the authors for the cool problems! :)

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

Nice Problemset. Was E a standard question of Fenwick Tree ?

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

Why is this brute force wrong? (PROBLEM A)

#include<bits/stdc++.h>
using namespace std;
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        int n, i, j, k;
        cin>>n;
        int flag=0;
        for(i=0; i<=334; i++){
            for(j=0; j<=334; j++){
                for(k=0; k<=334; k++){
                    if(3*i+5*j+7*k==n){
                        flag=1;
                        break;
                    }
                }
                if(flag) break;
            }
            if(flag) break;
        }
        if(flag) cout<<i<<" "<<j<<" "<<k<<"\n";
        else cout<<-1<<"\n";
    }
    return 0;
}
»
6 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

For some reason, I'm really bad at educational rounds...

My last four ed-rounds
And this one will be even worse (expected -64)

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

    The problem for loosing rating in this contest has huge role of your mindset saying that "I will loose rating from previous pattern ,making you feel pressure and under pressure u don't do well". Thinking it to be any normal contest and being cool , you might have performed better.

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

Sweet
Slightly over an hour since the end of the contest and already 500hacks.

I'm not complaining though as it may seem. Just noticing a funny fact

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

Anyone else used Dp for problem A? XD

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

A lot of successful hacking attempts for A & B. It's sad.

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

Does anybody have proof for the fenwick tree solution of E. Why wouldn't there be a case where we need lesser number of moves than taking it to the last possible position.

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

    So, here is my solution : First take the reverse of the given string and try to get all characters into position starting from the last.

    Some sort of proof for this : It is always optimal to choose the rightmost matching character in the original string to swap and get to the final intended position. Assume it takes X moves for rightmost character to get into final position. Now any other character Y will take X + dist(rightmost character, Y).

    Now, on why it is better to start fixing from the end of the string : When we try to fix some position before fixing the positions to the right of it, then this character might get displaced once again when some other to the left of the fixed character needs to go to the right of it.

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

I want to know D's solution, shouldn't it be traversal string simulation operation? I have seen a lot of AC codes, they all have found a certain pattern, can someone tell me this pattern?

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

Not noticing the unusual time made me miss the contest.

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

Can someone explain the "flow" solution for G?

I only know the bitmask dp solution.

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

In fact, problem e is not difficult, but I don't have enough time to complete it. The slow hand speed is also one of my flaws. .

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

My solution is a perfect O(N) solution. But it got hacked for TLE. Problem A of this Educational round 96. 1430A - Number of Apartments Kindly look for yourself and tell me why this happened @ BledDest adedalic fcspartakm Submission : 95203970

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

Can somebody prove problem D solution ?

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

In problem D :

Why is it "always" optimal to pick just next chunk with more than one value and not any other chunk with more than one value , whenever we encounter 1 ?

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

Can somebody prove the solution to D ?

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

If someone has got a little free time, can they mind explaining to me dp approach for solving problem A. Thanks.

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

    A dp solution for such a problem would be based on the observation that if we got a solution for some n, then we can simply construct a solution for n+3, n+5 and n+7, each by adding that number to the set of numbers in the soluttion.

    So start at zero and go up to n. Foreach number if there is a solution, construct the next three soulutions and store them.

    This will finish after n loops with solutions to all numbers in range 0 to n.

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

Is there a way for java users to solve problem B, because I used Arrays.sort() and got hacked. Collections.sort() is even slower. If we use a priority queue then it has insertion and deletion time complexity of NLog(n) and is a min-heap so it will only work for some cases. So what is the alternative??

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

    Use mergesort Or sort Array of Object instead of Array of Primitives. Arrays.sort() uses quicksort for which worst case time complexity can be O(n^2) (only in case of primitve data type).

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

    HarnoorSta7 has already pointed out. So, we got a TLE because Arrays.sort(int[]) uses quicksort which can have a worst case complexity of O(n^2) when the array is almost sorted. Now Collections.sort(List) is indeed slow because of non-primitives but it is still O(nlog(n)) in worst case because it uses Tim-sort instead of quick sort. So, I think it would not be a TLE if we used Collections.sort(List) in this question.

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

      Thanks for the link. Java was a lie for me. All the java accepted solutions I saw are using Arrays.sort() for int. Let's see how many java users survive for question B after final testing is completed.RIP java users!!

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

    To avoid worst case of Arrays.sort() function for primitive data types which is O(n^2), first shuffle randomly the elements in the array then use Arrays.sort() function. The function which I use to sort the array is-

    static void sort(int[] A){

    int n = A.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            int tmp = A[i];
            int randomPos = i + rnd.nextInt(n-i);
            A[i] = A[randomPos];
            A[randomPos] = tmp;
        }
        Arrays.sort(A);
     }
»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can somebody please tell me why my solution on problem A doesn't get TLE on a test with 1000 of 1's in input? This is kind of a max text and it's not even close to TLE (around 300ms).

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

I'm almost sure the intended solution for problem G doesn't involve Simplex, but if you know this method and you prove (or assume :P) that the coefficients found by the algorithm are all integers, you can get a really quick accepted.

Also, this solution should work fast enough even if $$$n \lt =100$$$ and $$$m \lt =n*(n-1)/2$$$

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

95241114 Why is this solution showing unsuccessful hacking attempt even though it shows compilation error in online IDEs?

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

95295302 Can someone tell me how to optimize it to have an AC. This gives TLE. I saw solutions of other people with the exact same method having AC. Please help! Thanks!

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

Can someone plz help me why my solution shows TLE for the Barrels problem of today's div 2 B Here's the link-https://mirror.codeforces.com/contest/1430/submission/95296320

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

Me after using x / 2 + x % 2 in rounding up in the questions

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

Please, can someone proof C solution? Thanks.

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

Please, can someone proof C solution? Thanks.

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

To not keep you waiting, the ratings updated preliminarily. In a few hours, I will remove cheaters and update the ratings again!

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

No idea why my submission for Problem B gives TLE (got hacked in the hacking phase)
Can someone please check?

UPD: Got it fixed. Arrays.sort() is the problem here. Aaah, this thing ruined my contest big time. Why you implement it via quick sort java. Whyyyyy? 
»
6 лет назад, скрыть # |
 
Проголосовать: нравится +14 Проголосовать: не нравится

Please upload the editorial..

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

In Problem A I used two pointer method.Like this

lp(i,mx+1)
	{
		
		j=0,k=mx;
		while(j<k)
		{
			
			if(i*3+j*5+k*7==n)
			{
				cout<<i<<" "<<j<<" "<<k<<endl;return;
			}
			else if(i*3+j*5+k*7>n)
			{
				k--;
			}
			else
			{
				j++;
			}
		}
	
	

But still got WA .Why?

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

editorial?

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

Where are the editorials?

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

Editorials Please BledDest

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

Is it possible to get all the test Cases for the problem from Somewhere. My Solution for D fails on 149th input of test case 2. If not it would be great if someone provides some good cases for checking the fault in my code . I have tried all the cases given in the comment section and all the outputs(from my code) have matched with their expected output.

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

Very happy to get First-AC at problem E&G.

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

Problem E was awesome.