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

Привет, Codeforces!

В Jan/29/2021 17:35 (Moscow time) состоится Educational Codeforces Round 103 (Rated for Div. 2).

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

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

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

Задачи вместе со мной придумывали и готовили Роман Roms Глазов, Адилбек adedalic Далабаев, Владимир vovuh Петров, Иван BledDest Андросов и Максим Neon Мещеряков. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

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

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

Место Участник Задач решено Штраф
1 sometimesnaive 6 176
2 SSRS_ 6 184
3 MagicalFlower 6 251
4 hank55663 6 255
5 Strigon-12 6 276

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

Место Участник Число взломов
1 stdmultiset 133:-79
2 Tsovak 98:-10
3 dapingguo8 68:-6
4 MohamedAboOkail 65:-3
5 peti1234 60:-1
Было сделано 3590 успешных и 2569 неудачных взломов.

И, наконец, поздравляем людей, отправивших первое полное решение по задаче:

Задача Участник Штраф
A Warawreh 0:01
B MysteryGuy2 0:04
C WZYYN 0:10
D peti1234 0:09
E CoderAnshu 0:06
F - -
G iaNTU 0:57

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

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

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

Please please please don't make it as hard as today's contest :/

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

As a ......

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

Let the comments with "as a" begin

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

I am new to Competitive programming, codeforces made me fall in love with it! Thanks to you all amazing people!

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

As a participant of today's contest kindly make the problems easier...

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

I hope it will be a good round

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

I will die if there will be adhoc problems in this contest too.

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

My current rating is 401 will I be rated in this contest?

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

I am a newbie, it really made me happy that I could solve few problems. Looking forward to upcoming contests!

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

I hope i will become expert today..

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

Hope to become specialist today

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

Hope those tasks will be easy, hope everyone can get a rating wich can satisfy you :)

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

Hope the tasks aren't too hard, hope everyone can get a rating which can satisfy you :)

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

There should be a third button IMO XD

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

I hope i can solve first 2 problems quickly :)

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

Writing educational contests is really good way to develop. Thank you for this contest and good luck to everyone!

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

hoping it to be a hard contest (and not containing math only ;-;)

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

Good luck everyone, I hope it will be a nice contest ♥

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

(

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

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

Waiting for the contest which would take me to specialist :)

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

It will be a wonderful contest. Best wishes!

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

Hoping for a good contest!!

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

Giving a contest after long time today ! Fingers Crossed..

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

Best of luck to all :)

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

A and B kinda sucked ngl

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

B — balanced

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

I wasted literary 1 hour on problem C because I forgot typing else... GG I will always be silver...

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

How to solve C?

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

    I solved C considering three cases:

    1. If we are at index 0, we only have one option, i.e. to start a cycle from here.

    2. If we are at the last index, we only have one option, i.e. to end the current cycle.

    3. If we are at an index in the middle: We check if b[index+1] == a[index+1].

    • If this is true, then we need to terminate the current cycle and start a new one
    • We again have 2 options here. We can either continue the current cycle with the existing length summed with the Number_of_vertices[index] - 1 - (b[index+1] - a[index+1]).
    • The next option is to start a new cycle from here with length b[index+1] - a[index+1].
    • The reason why this is always true is that the rest of the cycle remains unaffected by the choice we make at this index.
    • Another option is to terminate the current cycle here after adding Number_of_vertices[index] - 1.
    • Remember to add 2 every time you expand the current cycle to count for the edges used to link the chains together.

    Link to code: https://codeforces.me/contest/1476/submission/105933562

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

    You can use some dp to store maximum length cycle including all vertices of a[i] as ans[i].

    See my solution:https://codeforces.me/contest/1476/submission/105907608

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

    It can be solved by dp; firstly, let dp[i] denote the longest length at ith chain, "the longest length" means the longest length you can get before the cycle is formed, so we can get dp[i]=max(dp[i-1]+c[i]-1-abs(a[i+1]-b[i+1])+2,abs(a[i+1]-b[i+1])), then we update the answer by dp[i-1]+c[i]+1. one thing to be noticed is that when a[i+1]=b[i+1], dp[i] should set to 0.

    #include<bits/stdc++.h>
    #define ll long long
    #define pb push_back
    #define FULL(x,y) memste(x,y,sizeof(x))
    using namespace std;
    
    const int N=100005;
    int t,n;
    ll c[N],a[N],b[N],dp[N];
    
    int main() {
    	cin>>t;
    	while(t--) {
    		cin>>n;
    		for(int i=1;i<=n;i++) cin>>c[i];
    		for(int i=1;i<=n;i++) cin>>a[i];
    		for(int i=1;i<=n;i++) cin>>b[i];
    		for(int i=1;i<=n;i++) {
    			dp[i]=0;
    		}
    		ll ans=0;
    		dp[1]=abs(a[2]-b[2]);
    		for(int i=2;i<n;i++) {
    			dp[i]=max(dp[i-1]+c[i]-1-abs(a[i+1]-b[i+1])+2,abs(a[i+1]-b[i+1]));
    			ans=max(ans,dp[i-1]+c[i]+1);
    			if (a[i+1]==b[i+1]) {
    				dp[i]=0;
    			}
    		}
    		ans=max(ans,dp[n-1]+c[n]+1);
    		cout<<ans<<endl;
    	}
    	return 0;
    }
    
»
6 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Was I the only one who went into C and D thinking that they are graph problems, but both of them turned out to be dp ones? :P

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

How to solve D?

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

How to solve A? I'm new here...

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

Omg -141 delta for me

Question D is far more simpler to me compared to question B and C :/

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

my contest in 1 photo :

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

Don't you think the copying during contests is increasing day by day?Also there are many smurfs account in the contest. Affects rating of a lot of people

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

You are asked to rearrange the patterns in such a way that the first pattern the j-th string matches is p[mtj].

This is ambiguous. I thought it meant the rearranged patterns index mtj, causing me to write completely wrong code.

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

E was really nice. for each string s, for all the patterns that matches it, I put a directed edge from the first pattern it should match (mt for that string) to every other pattern that matches it and the answer is YES if the graph formed is a DAG?

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

    I thought the same but dismissed it quickly because how is that not TLE? Each string can match to potentially all $$$m$$$ patterns. So $$$O(m^2)$$$ sized graph (or DAG) right there? The only explanation I can think of is that maybe because of the contraint that each pattern is distinct this bound can be tightened? Do you have the proof?

    EDIT: Oh got it. smh. Each string can only match to atmost 16 patterns (because of distinctness constraint) so size of graph is bounded $$$O(m)$$$.

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

      According to the question, all patterns are distinct. For a string s, given its maximum length is 4, we can have at most 2^4 + 1 patterns that match it (for all binary numbers from 0 to 2^4, if $$$ith$$$ bit is 1 then keep s[i] as it is, else replace it with '_').

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

      A string can match with at most 2^k patterns. Let's take an example string "abc". Which patterns can it be matched with? "abc", "a_c", "ab_", "a__", "_bc", "__c", "_b_", "___" So, for each position of a string, we can either keep the original letter as it is, or replace it with '_'. so, for this reason a string can match with at most 2^k patterns.

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

    Yes, and the answer is the topological sort of the DAG.

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

Can someone please tell me why is my code failing, I did a 2 way kadane-ish dp and printed their sum. WA_CODE

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

I think problem B needed more tests, although figured out how to get 99 on test 1 it doesn't seem like it for the other tests.

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

The most educational things I learnt from A and B is that don't forget to use ceiling when comparing

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

The hardest part of E was understanding it. Nice problem set though, thank you!

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

In Q2 multiplying by 100LL instead of 100 got me AC. Any reasons why ?

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

imagining C graph cases gave me a headache but I liked this contest you have my upvote

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

How to solve G?

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

In C what does this mean that "First chain is skipped", does this mean we cannot take any node from first chain? I had initially set the ans to c[0]. That was the only reason I was not able to solve C and costed me wrong ans :)). First chain skipped means I thought I cannot connect any node to previous ones, otherwise I can taken some nodes from first chain.

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

Can Anybody Please give Me some counter test case i.e., Fail My Code

Question Link

Solution Link

I tried Everything but not able to find any counter case, Also did Stress testing, Still Not able to find it.

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

How to solve E?

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

    Take a look at this comment

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

    If there are multiple $$$p_i$$$s match the same $$$s_j$$$, then the specified constraint is basically implying the specified pattern exists before all other $$$p_i$$$s. Thus, we can keep track on the indices of patterns and build a dependency graph based on the constraints. For any specific $$$s_j$$$, there would be at most $$$2^k$$$ distinct patterns matching it. Thus, at most $$$2^k$$$ edges would be added to our dependency graph. Hence, the problem is reduced to check if a given directed graph with $$$n$$$ vertices and at most $$$m\times 2^k$$$ edges is acyclic, and if so, report any topological order. This can be solved by topological sort.

    There are a few trivial cases to notice, like the specified pattern not matching the given string or different occurrences of the same string being matched by different patterns, you may refer to my submission 105914103 for implementation details.

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

I was unable to sove even Problem A, can some one say the intuition to problem A. I tried binary search for problem B, but it did not pass 3rd test case

for i in range(int(input())):
	n,k=[int(i) for i in input().split()]
	arr=[int(i) for i in input().split()]
	prefixSum=0
	ans=0
	for i in range(len(arr)-1):
		prefixSum+=arr[i]
		if (arr[i+1])*100<=k*prefixSum:
			continue
		else:
			Min=1
			Max=(10**9)+1
			posible=Min
			while Min<=Max:
				mid=Min+(Max-Min)//2

				if (arr[i+1])*100<=k*(prefixSum+mid):
					posible=mid
					Max=mid-1

				else:
					Min=mid+1

			ans+=posible
			prefixSum+=posible

	print(ans)

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

simple dp for C . a is vector of heights , b and c are vector of endpoints connecting to previous. we have to recompute this dp between all the inclusive indices of where b[i+1]!=c[i+1]

dp[i]=abs(b[i+1]-c[i+1])+1 +max(a[i+1],dp[i+1]-1-abs(b[i+2]-c[i+2])+a[i+1]+1-abs(b[i+2]-c[i+2]));

simple code.

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

Were F and G intended to be that much hard??

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

    I'm really surprised nobody solved F. I've been rechecking and stressing my solution for hours, and I'm still sure it is correct, but it's strange that nobody got this problem.

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

      How to solve it? Is it dp(i, j) — farthest covered positon to the right if we have processed i first positions and j is the farthest to the left uncovered position, with segment tree? Or it is wrong?

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

        $$$dp_i$$$ — the maximum prefix we can fully cover with $$$i$$$ first lanterns.

        Let's look at how can we solve it in $$$O(n^2)$$$ with this kind of dynamic programming. First of all, let's write it forward. Which transitions from $$$dp_i$$$ do we have?

        • iterate on the lantern facing left that will cover the lantern $$$dp_i + 1$$$. Let this lantern be $$$j$$$. It should cover all lanterns in $$$[dp_i + 1, j - 1]$$$, so all lanterns from $$$[i, j)$$$ can be turned to the right (and we need a max query to determine the new covered prefix);
        • if $$$dp_i \gt i$$$ (lantern $$$i$$$ is already covered), we can just extend the prefix by turning the $$$i$$$-th lantern to the right. Note that turning it to the right when it is not covered yet will be modeled by the first transition.

        It is obviously $$$O(n^2)$$$, how can we optimize it? Let's write this dynamic programming backward. The second transition is changed to backward dp easily, what about the first one? Suppose we want to turn some lantern $$$i$$$ to the left. Let's iterate on the prefix $$$j$$$ that we will "connect" to it; for this prefix, $$$dp_j$$$ should be at least $$$i - p_i - 1$$$, and we update $$$dp_i$$$ with the maximum of $$$i - 1$$$ (since it is covered by lantern $$$i$$$) and the result of max query on $$$[j + 1, i - 1]$$$.

        In fact, we need only one such prefix — the one with the minimum $$$j$$$ among those which have $$$dp_j \gt = i - p_i - 1$$$. So, we build a minimum segment tree where each pair $$$(i, dp_i)$$$ is interpreted as the value of $$$i$$$ in position $$$dp_i$$$, and with min query on the suffix from $$$i - p_i - 1$$$ we find this optimal prefix, from which we should update (and to update, we can use any DS that allows max queries on segment — in my solution, it's another segment tree).

        Source code

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

          I was able to upsolve using what I think is a different DP, with $$$O(n \log n)$$$ distinct transitions, so both solutions are probably correct. Yours is definitely a much easier idea to implement.

          I reached my idea by supposing for some $$$i$$$ that every lantern in $$$[0, i]$$$ has had its direction chosen and lantern $$$i$$$ is the first unilluminated lantern. Then, there must be some lantern $$$j \gt i$$$ which is turned left to illuminate lantern $$$i$$$, after which the set of lit lanterns is a prefix, and every un-set illuminated lantern would thus be wasted unless turned right, which lets me greedily illuminate every lantern less than some value $$$k$$$. If $$$k = n$$$, that is a success; if $$$k = j$$$ then $$$k$$$ is facing left; otherwise $$$k$$$ may as well face right.

          It then turns out that there are at most $$$1 + 3 \log_2 (n-i)$$$ meaningfully distinct choices for $$$j$$$, and these are "easy enough" to iterate over: If $$$j$$$ is not the farthest-right-reaching lamp in the $$$[i+1, k)$$$ interval, no other value of $$$j \in [i+1, k)$$$ can possibly get a better value of $$$k$$$. But $$$k$$$ is at least 2 times farther from $$$i$$$ than the previous usable value of $$$j$$$ was! So the worst-case progression looks something like $$$j_0$$$, then $$$j_1$$$ (furthest reach in $$$[i+1, k_1)$$$), then $$$j_2 \lt k_1$$$, and then $$$j_3 \geq k_1 \gt i + 2 * (j_0 - i)$$$.

          Submission link: 105953208

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

          I had the same idea after the contest. You can simplify the code by doing some observations:

          • $$$Dp[N]$$$ is going to be increasing, so you can do a binary search instead of a segment tree
          • To do that max query on the lanterns that go to the right you can just use a sparse table that you can actually compute while reading the lamp powers.

          With those observations, I managed to get my code size at a little below 100 lines.

          Submission: 106013279

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

Fs in the chat for question F

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

can someone say y my solution failed? i am confident logic is somewat rite. solution logic: cross multiplying the equality a*100<=k*sum and checking if condition false, add differnce to overall sum

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

How can the answer of this case of problem C be 4?

3

3 3 3

-1 2 3

-1 2 3

Can anyone please explain what I am missing?

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

How many tests will problem A have? There're 1000+ hacks...

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

Finally a time for me to be on the "+11" side of a widespread hacking event :D

I am deeply sorry for the people who got hacked though, I've been hacked multiple times before and I know exactly how that feels.

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

brilliant contest! Thank you

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

In problem E, "You are asked to rearrange the patterns in such a way that the first pattern the j-th string matches is p[mtj]." doesn't clearly state that index mtj is referred for initial arrangement.It should have been stated clearly.

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

C was harder than D

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

fuck u bitches for 'A' present tests... :'(

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

Problems were good, I liked how ABC needed more thinking than coding and more thinking speed than typing speed.

It was an interesting contest even tho problem D was a standard one LOL.

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

thank u guys for 'A's weak pretests... :'((((((((((((((

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

As a...... As a novice at code/algorithm, I like codeforces! It's amazing and I like the feel to try my best to solve the problem... also I can't solve D which made me sad

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

It was hard and my solution on GNU C++17 64 bits FAILED BUT SAME SOL. ON C++17 PASSED...LOL

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

My standard screencast, with the standard tradition of misreading at least one problem

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

Nice pretests for A, as an tradition of Educational Rounds.

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

is there any extra points for hacking in educational rounds ?

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

thanks for great contest (i have 51 hacking successful =)) )

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

Just one thing: was it really necessary to have a two-letter variable like $$$mt_{j}$$$? First I saw that there is an $$$m$$$ variable, so I immediately interpreted $$$mt_{j}$$$ as $$$m\cdot t_{j}$$$, and that didn't help at all. I mean, I would understand $$$match_{j}$$$, but $$$mt_{j}$$$?..

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

I thought p[mtj] is a pattern after permutation :(.

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

Heh I did not solve B, got hacked on A, and solved C after 6 attempts

Which way is my rating going?

Down | | | | | | \/

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

I have to congratulate the setter of problem G. My solution looks like something well known, but I've never did something like that before. Really nice one, I definitely learned new stuff today. Thank you!

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

    What's your solution?

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

      I used Mo's algorithm. I didn't know about the trick to handle updates. A brief explanation of my solution:

      Keep track some stuff:

      • $$$cnt[x]=$$$ how many times number x appears in the range.

      • $$$tot[x]=$$$ how many numbers occurs x times in the range.

      • $$$vals=$$$ vector of distinct numbers in array cnt.

      It's really easy to update $$$cnt$$$ and $$$tot$$$ when you add/remove an element. For $$$vals$$$, simply push all the values to the vector while moving Mo's pointers, and after that remove values the ones that are irrelevant (those for which tot[x]=0). Also, avoid pushing an element to $$$vals$$$ twice. It's easy to see that after doing that, $$$|vals| \lt =\sqrt{n}$$$, because all elements are distinct and their sum is $$$ \lt =n$$$.

      Using the fact that $$$|vals|$$$ is small, you can answer the query with two pointers over the array $$$vals$$$.

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

        What is the complexity of this implementation? I can't understand the amortized analysis of the update part

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

          when you use Mo's algorithm with updates, you have you use size of blocks $$$S=n^{2/3}$$$. In fact, i read somewhere that it's optimal to use $$$S=(2*n^2)^{1/3}$$$.

          Time complexity for addittion/removal of elements and push/rollback of updates is $$$O(S*(n+q))$$$ amortized.

          Time complexity for iterating elements and removing values form $$$vals$$$ is $$$O(S*(n+q))$$$ amortized, because each operation pushes at most one element to the vector.

          Time complexity for answering queries after removing irrelevant elements from $$$vals$$$ is $$$O(q*sqrt(n)*log(sqrt(n)))$$$ because you need to sort the vector of unique values before using two pointers method.

          So, total time complexity is $$$O((n+q)*(S+sqrt(n)*log(sqrt(n))))$$$. Please notice that this analysis uses the fact that $$$S \approx n^{2/3}$$$ (not $$$sqrt(n)$$$). In practice, the solution works a lot faster (my code runs in 1500 ms).

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

Great contest. Problems are interesting and educational. I enjoyed solving them.

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

I don't know why, but I feel like at least 1 of my 4 problems will fail system testing :(

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

The penalty for each incorrect submission until the submission with a full solution is 10 minutes can someone explain what this 10 minutes penalty mean? and if we submit the correct solution after certain incorrect submissions there will be no penalty right?

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

Will it system test later,or just announce the final standings after the hacking time?

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

Can someone please tell me what error is there in my logic for this. I check for all elements in reverse order if the increase coeeff <= k and if its not I increase p0 by a sufficient amount. Link to soln: https://codeforces.me/contest/1476/submission/105888794

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

Difference between right and wrong in Question A

double n,k;
cin>>n>>k;
if(k<n)
k=k*ceil(n/k);
ll val=ceil(k/n);
cout<<val<<" "<<ceil(k/n)<<" ";

Input: 1 1000000000
Output: 1000000000 1e9
Both ans are correct but due to different format ans1 will be considered right and ans2 will be considered wrong.
So do typecast your ans

»
6 лет назад, скрыть # |
← Rev. 4  
Проголосовать: нравится -10 Проголосовать: не нравится
Your code here...
ll n,k,val;
    cin>>n>>k;
    vector<ll> pre,a(n);
    ll sum=0;
    loop(i,0,n)
    {
        cin>>a[i];
        sum+=a[i];
        pre.pb(sum);
    }
    ll add=0,maxadd=0;
    loopeqr(i,n-1,1)
    {
        val=a[i]*100-k*pre[i-1];
        if(val>0)
            add=ceil(val/(k*1.0));
        maxadd=max(maxadd,add);
    }
    cout<<maxadd<<"\n";

Question B :Using greedy approach.The basic idea is to take the maxdifference from all differences bcuz anything less than that will be satisfied by all other differences also either u start from begining or end of loop.
Here is my code which got accepted 105878231

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

hi

I really need help therefore I really couldn't understand what is the problem with the code which outputs that kind of format in test 3 problem b(but in math the number is correct)

submission:105899297

and its not just only mine

another submission of another person:105852796

help please

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

.

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

for C problem, my code failed in 4th testcase.I am not able to figure out the testcase,if anyone has any idea about what the testcase could be. Link to the code — https://codeforces.me/contest/1476/submission/105951904 My approach was to calculate number of vertices of every chain that will be added if i take that chain as an intermediate chain, ending chain, starting chain. i stored these values and calculated the maximum answer.

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

CodeForce is a great programming site!I love it.It brings me a lot of fun.The change of rating again and again makes me feel very exciting!

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

Why so long for the editorial? Or is it normal? Sorry I am new, but my past contests had editorials almost in an hour

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

I really do not understand, why my code for A problem had hacked .. why ceill function returns a wrong value While N & K are long Please can someone expert help me to understand what is the problem here !

this is my submission

https://codeforces.me/contest/1476/submission/105923499 }

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

How to solve the other version of the problem E, i.e where the first matching string is the $$$mt_j$$$ th string in the rearranged permutation?

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

    After reading your comment I realized I misunderstood the statement of E during the contest and tried to solve the problem you mentioned XD

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

    You can keep a condition array where if con[i]=x then it means we can assign the ith pattern in the initial array any index from x to n. Initially, all values in con will be 1. Now for each string, mt pair we can update the con array for all patterns which match with the string to max of their initial value and mt. Now after processing all strings, we assign indexes to patterns in decreasing order of their con value from n to 1 if we can assign index to all then ans is yes and we can print the order else it is no.

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

    In that version you don't need the graph/top sort. Instead, go through the strings s_i and enumerate all the patterns that it can match (by adding wildcard slots just like the original version of E). For each of the enumerated patterns check to see if there's a p_i that it is equal to and assign the mt value to that p_i (using some map-like data structure). If the p_i already has a value then only update the value if our new value is larger (that is, if s_i already set it to a value mt_i=2 for example and s_j has value mt_j=3 for it, then the pattern must be in position 3 or later — if it was in position 2 then it would violate s_j's mt_j=3 condition). Note that there might be pattern that don't have any value assigned — that means they don't match any s_i and they can be put anywhere. Make a filler queue and add these in.

    After you've gone through all s_i then you need to fill out the answer array. Go from index 1->n and for index i if there's no pattern p_j with value mt_q=i then you can put an entry from filler in. If there is a pattern, then you can put that in and then put the other patterns with mt=i into the filler queue (they can go anywhere behind i and they won't violate any requirements anymore). This will give you an answer array, but you need to actually be a little more careful for some edge cases.

    When a p_i has value j and is put in index j, every s_q with mt=j must match this (otherwise the first matching pattern won't be j). To make sure this is the case, you will also have to store a count for each p_i (in addition to the index value) — in the step when you updated values you also update the count when the old value and the new value is the same (this is just the number of s_i that will get triggered by this pattern when it shows up in that given position). Now, in the last step when you fill the answer array by picking a p_i for index j, you have to pick the one with the highest count, and the count has to equal the number of s_i that have mt_i=j.

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

    Unfortunately I solved this version of the problem E. Here is the code which I have tested against many random inputs and then realised that the intended problem is something else.

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

When rating changes are updated for educational rounds?? I am new here.

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

https://codeforces.me/problemset/submission/1476/105958353

https://codeforces.me/problemset/submission/1476/105956041

These are my 2 submissions for problem B. 2nd got accepted but first is giving wrong answer on test 5 case 994 (truncated). Can anyone tell me where I have gone wrong?

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

Editorial, please

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

when will the ratings be given and why did they roll back the ratings of previous contest,i was about to become a pupil :(

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

Editorial, please

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

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

How this submission is getting accepted and not TLE as clearly their is a for loop that goes till 'n' and 'n' is 10^9 and test cases 't'= 1000. and time limit is 1 sec. Link: https://codeforces.me/contest/1476/submission/105860386 I thought in 1 sec only 10^9 operations can be done

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

I have a question regarding the complexity of memset. Can this code pass in 2 sec?

Code

Original Submission: 105929137

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

    memset an array of length $$$n$$$ takes time $$$O(n/w)$$$, which $$$w=64$$$ for codeforces.

    You memset 3 arrays with length $$$4\times 10^5$$$ for $$$10^4$$$ times in the worst scenario, and when that happens it takes $$$\dfrac{4\times 10^5\times 10^4\times 3}{64}\approx 2\times 10^8$$$ time, which is able to pass in 2s.

    upd. tried a hack with the worst scenario mentioned above. the solution passed in 1.2s.

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

editorials please!!

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

editorials please!!

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

Hoping this round taught you that you shouldn't prepare contests anymore.

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

I got a message from system telling me that my solution for C problem is similar to In_Memories_11_08_2020/105891388, not_tehlka/105903063, yinuowang/105910649, sk_loves_Ritika/105921450, rivnam/105928243. In my opinion, the code is not at all copied and the only thing that is same is the fast IO template. Link to the template. Please look into the matter. It is the second time it has happened with me unnecessarily. Please restore my ratings

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

    i also got similar meassage with same accounts mentioned by you...

    i think that problem involve only certain conditions in loop thats it.. I AM DAMM SURE THAT I

    HAVENT SHARED CODE AND EVEN NOT COPIED ......i request them to please check it out and restore my rating ...

    please help even if there is some valid proof of my cheating or sharing i am ready that you delete my account else do not repeat this and restore my rating...

    i am so sad

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

    Same problem here, any help would be greatly appreciated :)

    As you can see from my submissions for this contest as well as past contests, I have used this fastIO code many times.

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

      same bro even i almost everytime using same template

      even ** i do not feel code are same ** i read 2 of them and campared with my code

      some responsible person have to say something upon this matter

      this is very bad .....i am saying this beacuse i am confident and need help of others to overcome this

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

I had just received a message from the system telling me that my solution for the C problem is similar to In_Memories_11_08_2020/105891388, not_tehlka/105903063, yinuowang/105910649, sk_loves_Ritika/105921450, rivnam/105928243. I had seen all these solutions only the fast io template is matching; the plagiarism checker is not working properly. Although my rating is dropping in this contest according to cf predictor yet plz restore my rating bcoz I don't want to have any bad spot on my id.

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

@MikeMirzayanov can any anyone please help !!!!!!

today i got a message that my C solution matches to someone ... but i say confidently that i haven't used

any public IDE platform to code and even i did not share code with someone

so why like this with me ??? i am so sad please clearify ...

my request to others please help us to raise this issue ....even i am ready to accept that delete my account if i really do cheating or sharing but don't do like this ... ruined my performance.

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

I just received a message from the system telling me that my solution for the C problem is similar to In_Memories_11_08_2020/105891388, not_tehlka/105903063, yinuowang/105910649, sk_loves_Ritika/105921450, rivnam/105928243. I had reviewed the solution of all these people only the fast io template is matching. So, Please look into the matter. I think the codeforces plagiarism checker is not working properly. Although my rating is dropping in this contest according to the cf predictor yet I want my rating restored as I don't want any bad spot on my id.

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

Your solution 105901746 for the problem 1476C significantly coincides with solutions Fubuki_AI/105892973, misra_17/105901746, samcpp/105933007.

This happened because we all are using template of user Um_nik . All our code inside main() is different.

What should i do now?

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

how this submission accepted ? plz anyone explain time complexity of this submission..Advance Thank you.. https://codeforces.me/contest/1476/submission/105860386

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

can anyone tell me why i have 51 hacking successful but i have no more bonus ? . Thank you and sorry because of bad english

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

I received a message from the system: Attention! Your solution 105913814 for the problem 1476D significantly coincides with solutions rk_no/105911811, nestedcode/105913814, MA7887/105919769, MayFlyyh/105931103, MTL_Sakura/105936065.

(I don't know these guys and didn't use idone or any other online compiler.)

The solution to the problem can be implemented in a standard dp approach and that is what I did during the contest. I saw the above mentioned codes and they are implemented in the same fashion. I think these type of codes should be treated differently during plagiarism check. This indicates that we can still improve the current plagiarism checker and stop such cases from happening. Innocent people deserve better. :( MikeMirzayanov awoo Please look into the matter.

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

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

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

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

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

Only one score to blue qaq. In addition, I've noticed one thing. Although the rating change of this game has come out, the rating change of div1 in the previous game is still frozen. Is it unrated? Or, the rating change will be recalculated at that time? I don't understand too much.

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

MikeMirzayanov awoo This round should be rated for me QAQ
I turned from Master to Candidate Master in Codeforces Round 698 (Div. 1) and then participated in this round.

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

Why am I not rated?

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

I participated in EDU Round 103 and got more than 70 places and qualified for the score. Why did I not gain rate??

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

Yesterday I have received two unexpected warnings from CodeForces plagiarism checker. The first one says, my solution 105930169 for the problem 1476D - Journey significantly coincides with solutions bleh0.5/105914875. After sometimes I got another warning that my solution to the same problem (1476D) significantly coincides with solutions bleh0.5/105914875, tejas10p/105917332.

There exists a very simple solution to the problem 1476D. So there is a high chance to match the solutions of two different persons. I have explored the submissions of the first 100 people according to the common standings of this round. Among these 100 submissions, I found 7 submissions that are almost similar to my solution. I'm mentioning these submissions here.

My submission:

The two submissions that matched with my submission:

Similar submissions:

  • 105883915 Here only difference with my solution is I used array and he used vector.

  • 105878527 He used vector and wrote the solution in a separate function.

Other similar submissions:

I am requesting MikeMirzayanov to look into these unexpected warnings. It's totally an injustice to me -_-

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

MikeMirzayanov awoo

rating Rollback -> update rating by this contest ->update rating(#698)

so, for example momohara, not update rating by this contest.

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

this contest rating changes :

lets add them :) -> roll them back -> add -> roll back

why?!