text:
By awoo, history, 10 days ago, translation,

Hello Codeforces!

Series of Educational Rounds continue being held as Harbour.Space University initiative! You can read the details about the cooperation between Harbour.Space University and Codeforces in the blog post.

This round will be rated for the participants with rating lower than 2100. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.

You will be given 6 or 7 problems and 2 hours to solve them.

The problems were invented and prepared by Adilbek adedalic Dalabaev, Vladimir vovuh Petrov, Ivan BledDest Androsov, Maksim Neon Mescheryakov and me. Also huge thanks to Mike MikeMirzayanov Mirzayanov for great systems Polygon and Codeforces.

Good luck to all the participants!

Congratulations to the winners:

Rank Competitor Problems Solved Penalty
1 Geothermal 6 183
2 qpEDop_MuXauJloBu4 6 216
3 hanbyeol_ 6 219
4 tute7627 6 221
5 fastmath 6 287

69 nice successful hacks and 304 unsuccessful hacks were made in total!

And finally people who were the first to solve each problem:

Problem Competitor Penalty
A Geothermal 0:00
B Geothermal 0:04
C Geothermal 0:07
D jayeshaw 0:18
E tzc_wk 0:28
F jiangly 0:30

UPD: Editorial is out

• +266

 » 10 days ago, # | ← Rev. 5 →   0 Hoping for a great contest!
•  » » 9 days ago, # ^ | ← Rev. 3 →   +29 Weak pretest of F even do not have cases of disconnected :(
•  » » » 9 days ago, # ^ |   -25 So this is the reason why it was a "good contest" lol
•  » » » 9 days ago, # ^ | ← Rev. 2 →   +10 There were disconnected graphs but no ones with a lot of edges. I personally think it was decent enough for pretests.To be honest, from your solution I'd say it should've been pretty fair for you to assume that it passes only if the tests are weak. Maybe I don't know the estimates on the number or the sparsity of hamiltonian paths in connected graphs, but you do. In that case I'd love to hear why that solution can be fast enough.
•  » » » » 8 days ago, # ^ |   +29 It is such interesting. I also don't know why my code can run so fast :D .But it seems to be slow when it doesn't exist a solution (disconnected or do not have a vaild path).I judged them before my programm and can AC now.
•  » » » » » 8 days ago, # ^ | ← Rev. 3 →   +21 There is a lower bound on the minimum possible non-zero number of hamiltonian paths for some fixed n and m. It seems to be somewhere around $10^5$ for 12 45-48. I guess you are abusing this fact implicitly.Maybe you'll be able to pass any test within given constraints with more optimizations. Feel free to tinker with my generator to make your solution (or my tests :P) stronger. It finds connected graphs with the smallest number of hamiltonian paths, spitting out every improvement (or same answer but not too often) into folder "tests". I run it with "./gen n m k 1e5 0.999", these temperature and cool down rate seem to get you nice graphs fast enough.
 » 10 days ago, # |   +4 Thank you all the people who have put in time and efforts in making this contest for us. Upvoted!
 » 10 days ago, # |   0 What are the score distributions for individual problems?? Looking forward to a great contest!!
•  » » 10 days ago, # ^ |   +13 bruh its icpc style, every problem carries the same score.
•  » » » 10 days ago, # ^ |   +5 OK DWIGHT!! THANNKS FOR REMINDING :)
•  » » » » 10 days ago, # ^ | ← Rev. 2 →   +49
 » 10 days ago, # |   -16 Looking forward to losing my newbie virginity to this contest !
•  » » 10 days ago, # ^ |   +3 Never thought u to be a saint, I believe that u r a slut , haha
•  » » » 10 days ago, # ^ |   -17 u are not my office co-worker. of course u know i am a slut
 » 10 days ago, # |   +24 Is it just me or half of the trickiest problems am not able to solve during practice are always authored by BledDest.?:)Looking forward to it!
•  » » 10 days ago, # ^ |   0 Same here bro!T_T
 » 10 days ago, # |   +11 Ok, new contest, new story, just gotta give virtual rounds of all contests by this author and that's enough practice. Wait...
 » 10 days ago, # |   0 This will definitely be another brilliant contest!
 » 10 days ago, # |   0 Really looking forward to this round. To improve my rating. It sucks.
 » 10 days ago, # |   +65 Our friends at Harbour.Space don't have any messages for us this time?
 » 10 days ago, # |   0 Another brilliant round, i hope this round improve my rating. Upvote for your kind wishes.
 » 10 days ago, # |   -14 Always like Educational Rounds :D
•  » » 9 days ago, # ^ |   0 In fact,Educational Rounds is good for our rating :)
 » 10 days ago, # | ← Rev. 2 →   +3 To be educated in educational round..
•  » » 10 days ago, # ^ |   +58 Tbh, Atcoder ABC's are more educational nowadays.
•  » » » 10 days ago, # ^ |   -13 bro you said Atcoder two times. ABC = Atcoder Beginner Contest. Atcoder ABC = Atcoder Atcoder Beginner Contest.
•  » » » » 9 days ago, # ^ |   -10 He meant problems A, B, C
•  » » » » 9 days ago, # ^ |   +4 Wow so knowledge, much smart.
•  » » 9 days ago, # ^ |   -7 In my experience with educational rounds, the only 'educational thing' with them is that they are not educational :/
•  » » » 8 days ago, # ^ |   0 They are educational because they teach you a lesson.
 » 10 days ago, # |   +15 Nowadays participating in ABC contests is helpful for CF edu rounds lol
 » 10 days ago, # |   -27 After a long time, an educational round is going to be held. I hope the problem set will be interesting and contest will enjoy the round.
 » 9 days ago, # |   +1 shinzou WO Sasageyo...!!
•  » » 9 days ago, # ^ |   0 What is freedom?
•  » » » 9 days ago, # ^ |   0 What is love?
•  » » » » 9 days ago, # ^ |   0 Mikasa.... :)
•  » » » 9 days ago, # ^ |   -25 Freedom is an action governed by nothing but your own free will. Eren Yeager (aka) Hitler2, tatakae yeager, Ereh, Hitler kin, Angry German kid, True Sigma, Suicidal Bastard.
•  » » » » 8 days ago, # ^ |   0 I'm not a fan of Eren but calling him Hilter2 is too far-fetched
•  » » 9 days ago, # ^ |   +1 what is the lie, what is the truth, what to believe
•  » » » 9 days ago, # ^ |   0 The truth is whatever lie you choose to believe...And the truth is that neither of us were able to solve problem C... I choose to believe that if I had some extra time... maybe I could have solved it...PS: This is what I chose to believe, It's not the truth.. the truth is I couldn't have been able to solve it even if I would have dedicated my complete day on it... but I chose to believe that I could have provided that I just had 1 more hour for it.
•  » » » » 9 days ago, # ^ |   0 factorial and mod disasterrrrrr
•  » » » » » 9 days ago, # ^ |   0 They are the true enemy of mankind... They must be annihilated as soon as possible so that the human race may be able to continue for eternity.
 » 9 days ago, # |   +2 This doesn't seem Educational at all. :( Not at all for Div-2 also
•  » » 9 days ago, # ^ |   0 Totally agreed...( ﾉ ﾟｰﾟ)ﾉ＼(ﾟｰﾟ＼)
 » 9 days ago, # | ← Rev. 2 →   0 Div-2 C : bool unsolved = true; while(unsolved) { crying due to mod&factorial = true; if(crying due to mod&factorial) unsolved = true; }
•  » » 9 days ago, # ^ |   0 I too am crying due to the 3rd question... :_)1st problem : combinatorics2nd problem : modulo
•  » » » 9 days ago, # ^ |   +6 Meanwhile me :WA on test 4 ll sub(ll a, ll b){ return (a-b) % mod; } AC ll sub(ll a, ll b){ return (a-b+mod) % mod; }
•  » » » » 9 days ago, # ^ |   +1 I am really tired ... was unable to solve problem C even after struggling for 1.5 hrs straight.
•  » » » 9 days ago, # ^ |   0 Me after this contest:Change my organization to "Fool of Combinatorics and Number Theory"
•  » » » » 9 days ago, # ^ |   +1 Count me in bro... :_)
•  » » 9 days ago, # ^ |   0 bro, i 've cried over 1hr :((
•  » » 9 days ago, # ^ |   0 what's it？
 » 9 days ago, # |   0 back to newbie
 » 9 days ago, # |   -8 the first testcase in C makes the solution obvious
•  » » 9 days ago, # ^ |   0 But you also need to be careful with other special situation!
 » 9 days ago, # |   +1 How to solve C?
•  » » 9 days ago, # ^ |   +1 SpoilerLet maxi be the index of the maximum element in a, then one of the following conditions must hold for a permutation to be bad. for every i < maxi, a[i]<=a[maxi]-1 for every j > maxi, a[i]<=a[maxi]-2
•  » » » 9 days ago, # ^ |   0 Thanks a lot!
•  » » » 9 days ago, # ^ |   +2 This logic is easy to come up with...I feel the tough part was to calculate bad permutations using combinatorics
•  » » » » 9 days ago, # ^ |   0 Exactly
•  » » » » 9 days ago, # ^ |   0 the tough part is to not mess up the calculation and mod correctly
•  » » 9 days ago, # ^ |   0 the only wrong case might occur iff all the second maximum numbers are behind the maximum number, if there are two maximum numbers then answers is fact[n]. To calculate we can note that the first thing is equal to the non integral solutions to a number. Also the numbers themselves are different so you multiply the factorial of the second maximum also. Rest numbers can be permutated also so we need to calculate the number of permutations with common objects and multiply that also.
•  » » 9 days ago, # ^ | ← Rev. 3 →   +2 The answer will only depend on the largest number, second largest number, and their respective frequencies. I'll denote largest number as $max$ and second largest number as $secmax$. If the count of $max$ is greater than $1$, then the answer will $factorial(n)$ (all possible permutations), because all permutations will be nice in this case. If the difference between $max$ and $secmax$ is greater than $1$, then the answer will be $0$ (since no permutation can be nice in this case).Now the only case remaining is when $max=secmax+1$ and count of $max$ equals $1$. Here, a permutation will not be nice only if $max$ is behind all the $secmax$ in the permutation. So the number of not nice permutations will be $nCr(n,(countmax+countsecmax))*factorial(n-countmax-countsecmax)*factorial(countsecmax)$. The final answer will be $factorial(n)$ — ($no.$ $of$ $not$ $nice$ $permutations$), which we calculated above.
•  » » » 9 days ago, # ^ |   +3 Could you explain the formula for the number of the "not nice"-permutations?
•  » » » » 9 days ago, # ^ | ← Rev. 2 →   +1 I just realized that I complicated the formula a bit. Basically, think of the permutation consisting of $n$ empty spaces. First we need to fill the empty spaces with all the numbers which are smaller than $max$ and $secmax$. There are $nCr(n,(countmax+countsecmax))$ ways to fill the permutation with the smaller numbers and $factorial(n-countmax-countsecmax)$ ways for the smaller numbers to permute. Now we only have to worry about the no. of permutations of all $max$ and $secmax$ in the rest of empty spaces. Since there is only 1 $max$ and it will be placed in the last of the remaining spaces, we only have to find the number of ways to arrange all $secmax$, which is $factorial(countsecmax)$.
•  » » » » » 9 days ago, # ^ |   0 Great explanation. Thanks!
•  » » » 9 days ago, # ^ | ← Rev. 3 →   0 Thanks alot for explanation.I am not able to understand that we have secmax whose count is "countsecmax" ,they all are same value wise, then why are we multiplying factorial(countsecmax) in invalid case.Lets say we have 333 , so to arrange them we only have 1 way right?
•  » » » » 9 days ago, # ^ |   0 The permutation they have asked for is for the indexes (1 to n) and not the values of the permutation themselves.
•  » » » » » 9 days ago, # ^ |   0 ohh , i got it thanks alot!
 » 9 days ago, # |   +2 Problems were hard.
 » 9 days ago, # |   +8 How to solve D
•  » » 9 days ago, # ^ |   +15 I missed the registration, but my guess is Spoilerprefix sums a pair is convenient only if one point lies on vertical and other one on horizontal OR if both points are on vertical then there's atleast one horizontal line between them OR if both points are on horizontal then there's atleast one vertical line between them. sort the points and check.Don't downvote if I'm wrong or I cry :(
•  » » 9 days ago, # ^ |   +6 Just separate the points into two parts one where the x of the point matches with any of the x of vertical roads and other part where the y of the point matches with the y of any horizontal road. these two parts may or may not be disjoint as it is also possible that point's x as well as y matches with any vertical and horizontal road then this point will be the part of both parts.Now solve the answers for both the parts separately ->for 1st part Sort it using a comparater which sorts first according to y and then according to x. Now just iterate one by one on the points since the points are sorted using the above comparater so the points will be divided into groups which lie on the same horizontal line(same y) and this group is also sorted according to x also. Now we can see that the vertical roads divides the x axis into some segments. (x0,x1) (x1,x2) (x2,x3) ........for calculating the answer we will maintain one array f of size (n-1) where ith element represents the number of points that lie in the ith segment and whose y is also less than the current y(on which we are currently at in the iteration).f[i]=number of points which lie in the segment (x[i],x[i+1]) end points not included.for finding the segment-number of a point (a,b) we can easily find it using binary search(using lower_bound in c++)now let us assume we are at a point (a,b) so to find out the pairs that this point will make with other points that are already visited in the iteration we can make use of the array f.first we find the segment to which the point (a,b) lies and then the bad pairs which it makes is equal to f[segment-number]. because f[segment-number] stores the number of points that lie in that segment in the previous horizontal line (yb) then we need to add the point (a,b) to its respective segment(increment value of f[segment-number]) so that it can contribute the points which lie on the horizontal line above it.what we can do is we can maintain a cnt variable which stores the number of points which lie on the same horizontal line and in the same segment of x axis.When we move to next segment then we can just update the value of f[prev-segment-number]+=cnt.for 2nd part-Sort it using a comparater which sorts first according to x and then according to y. It's exactly same the difference is just the change of axis now we will iterate vertical line by line and in increasing order of x.Now the y axis is divided into segments.Link to my code- https://codeforces.com/contest/1569/submission/128325617
•  » » » 7 days ago, # ^ |   0 Thanx
 » 9 days ago, # |   +4 adedalic vovuh BledDest I recently discovered this youtube channel https://www.youtube.com/watch?v=ScJlgbUDMq4, where solutions of the ongoing contest are being shared. I was not able to solve any problem in this contest since I m a newbie but I also don't go for these unethical ways to increase my rating. Can anything be done against this form of cheating?
•  » » 9 days ago, # ^ |   0 These guys now even seem to be crowd-sourcing solutions.
•  » » » 9 days ago, # ^ |   +4 yep, I would be really happy if something could be done against these people
•  » » 9 days ago, # ^ |   0 And then I think why my rating is not increasing for so long!! :(
 » 9 days ago, # |   +95 A very heavy meme :
 » 9 days ago, # |   +1 I might go -200 today , I am not losing hopes
 » 9 days ago, # | ← Rev. 4 →   +6 My soln 128273615 of F should be hackable. I just have an early exit in case a particular assignment of colors finds a palindromic path. It reduces the time taken from 35s (locally) to 1s (on present test cases). 128279840 takes 30s — 40s locally on a complete graph. Update: Hacked by pikmike. Accepted submissions would now get TLE on tc 103 during system testing.Update 2: 128290681 should still be hackable.
 » 9 days ago, # |   +3 Solved C literally a minute after the contest ended damn
•  » » 9 days ago, # ^ |   +9 If it makes you feel better I forgot take mod of the final answer.
•  » » » 9 days ago, # ^ |   0 I forgot to use LL for D, and got two WA at testcase 6. After contest finshed I just realized...
 » 9 days ago, # |   0 Could anyone give me a hint for problem B ? I thought about using backtracking but could not implement it.
•  » » 9 days ago, # ^ |   0 Just try for individual competitions... using brute force suppose there are two players i and j, if any of them is aiming for 1, you can simply draw the match '=', if both are aiming for 2, think... if A has won in any of the previous matches... declare B and the winner and A as the looser, else B as the winner....In the end just check if all of the players were able to achieve their goals or not... the problem is solved...This is my submission... ignore everything above //MARK :- SOLUTION=====...I hope this will help... ;)128236197
•  » » 9 days ago, # ^ |   0 SpoilerHint : For people with expectation 2, they should only win against people with expectation 2 (since those with expectation 1 don't want to lose any games)
•  » » 9 days ago, # ^ | ← Rev. 4 →   0 First of all separate all the players who are satisfied with not losing a single match from those who need to win at least one as games need to be won or lost only in the case of the latter. Now, a valid solution can only exist if the number of unique pairs that can be formed between the players of the second type is greater than the number of players of the second type. Why? SpoilerBecause the pairs represent unique games; and we need at least n unique games between n players so that each player can win at least one. These wins can then be assigned in a very simple manner (1-2, 2-3, ..., n-1).
 » 9 days ago, # | ← Rev. 12 →   0 could problem C be solved using combinatorics? i tried below solution but i got wrong answer let maxValue = maximumValue in the array nextMaxValue = maxValue - 1 maxCnt = # maximum Value in the array nextMaxCnt = # nextMaxValue in the array fact[n] = n! (factorial) comb[n][r] = nCr (n Choose r) case1 if (maxCnt == 1 && nextMaxCnt == 0) answer = impossible case2 if (maxCnt >= 2) answer = fact[n]; case3 if (maxCnt == 1 && nextMaxCnt >= 1) r = maxCnt + nextMaxCnt answer = fact[n-r] * (comb[n][r] * (fact[r] - (fact[maxCnt] + fact[nextMaxCnt]))) ----updates---I got AC. after I use modular inversion when divide it. solution: https://codeforces.com/contest/1569/submission/128287672
•  » » 9 days ago, # ^ |   +1 in the last case, basically its the number of ways to put the maximum element in any spot while there exists atleast one or more nextMax on it's right side you can see my submission here https://codeforces.com/contest/1569/submission/128280479
•  » » » 9 days ago, # ^ |   0 thanks for the sharing. but could you elaborate more? I cannot understand left and right in your solution. or could you provide a related thread for it? Thanks in advance.
•  » » » » 9 days ago, # ^ | ← Rev. 3 →   +1 Yeah sure, so basically for instance in the last test case n = 6 and there's 3 NextMax so NextMaxCnt = 3 and so we have 2 elements that's less than NextMax, right? if we put the Max(which is 4) at any spot from 1 to 3 there's gonna always be a nextMax on it's right side. So the answer is premutation of the 5 spots (all spots except spot of the Max). now from spot 4 to 6, the answer would be the number of ways to have atleast one nextMax or more on the right side of the Max. There's many ways to calculate this but i calculated it by totalnumber of ways to arrange 5 spots subtracted by number of ways to have NO nextMax on the right side of the max. In my case left is just number of ways to order the left remaining spots on the left and right is the number of ways to have NON nextMax values on the right. Apologies if my explanation isn't the best.
•  » » » » » 9 days ago, # ^ |   0 Thanks for the explanation it helps a lot!
•  » » » » » » 9 days ago, # ^ |   0 if you still didnt understand it lmk. But basically the idea is to calculate the number of ways to have atleast one or more nextMax on the right side of the Max given that the max can be at any spot. There's many ways to calculate that i assume
•  » » 9 days ago, # ^ |   0 Well, cases to consider, Suppose maximum number present in array is X and second maximum is Y. i) When are we not going to have any nice permutataion? The case when X-Y>=2. Otherwise, ii) If there are two or more occurrences of X, we can always permute the whole array in any way possible and get a nice permutataion. So, that would be n! ways. or There is just one occurrence of X and some occurrence of Y. In that case, We can try to solve it by finding count of all permutation — permutataion when X comes after all occurences of Y.
 » 9 days ago, # |   +6 Nice problem E. I came up with some backtracking optimizations but couldn't complete it on time :D
 » 9 days ago, # |   0 Waiting for the solutions....
 » 9 days ago, # |   +4 Nice set of problems, got the logic for D but found it implementation heavy, it took all my time, and couldn't make code for it.
 » 9 days ago, # | ← Rev. 2 →   0 In E, is it fast enough to do 2^28 * (some big constant) ? It looked way too slow to me so I didn't code it, but the idea was to brute-force the first three levels of the tournament, bringing the number of contestants from 32 -> 16 -> 8 -> 4, and for the final four to have precomputed in O(32^4*2^4) all the numbers that can be achieved, for every possible quadruple of people playing. (I can see the hash of the first three levels, and substract it from H to get the required hash of the last levels).
 » 9 days ago, # | ← Rev. 3 →   -11 As a contestant solved one problem give me contributions (◕‿◕)
 » 9 days ago, # |   +3 How to do E?
•  » » 9 days ago, # ^ |   +3 For k=5 you just can solve for k=4 (2^15) and get the solution with meet-in-the-middle (2^8).
•  » » » 9 days ago, # ^ |   0 Oh, so for the "upper" part of the tree and the "lower" part of the tree, and you combine them in the final game where the total winner is determined? Or how do you split it
•  » » » » 9 days ago, # ^ | ← Rev. 2 →   +3 If you know winners of first phase(16 matches), 16 teams will remain and it's same as k=4 (You can determine places with O(2^(2^k-1)) bruteforce). To determine winners, you can split first 8 matches, and last 8 matches, and combine the results with meet-in-the-middle.
•  » » » » » 9 days ago, # ^ | ← Rev. 3 →   0 Ok I'm too dumb to understand I'll wait for the editorialEdit: Ok I understand now, thanks. The 2^8 is, for four possibilities of the first 2^16, who will win, and weather he will win once or twice. And same for the second 2^16, teams from [16,32], who will win and will the winner win again or not.
•  » » 9 days ago, # ^ |   +3 I tried to reduce the possibilities of backtracking by fixing the sum of eliminated people for every stages. I believe that will be enough to pass the tests in 4 seconds.
 » 9 days ago, # |   +3 C is just abbreviation for crying
•  » » 9 days ago, # ^ |   +3 It's pretty hard for C, lots of combinatorics
•  » » » 9 days ago, # ^ |   0 can any one give articles on combinatorics ?
 » 9 days ago, # |   0 Solved A , but why does a 2 pointer approach to solving it give TLE ?
•  » » 9 days ago, # ^ |   0 No fast IO?
•  » » » 9 days ago, # ^ |   0 I put fast IO and still TLE
•  » » » » 9 days ago, # ^ |   0 never use endl when printing. use '\n' instead.
•  » » 9 days ago, # ^ | ← Rev. 3 →   0 ? Couldn't it be solved in $\mathcal O(n)$?Here's the approach:First, obviously, if all the characters in the string are 'a' or 'b', there must be no solution. Otherwise, there must be a position $x$ that makes $a_x\neq a_{x+1}$, scan this string directly to find the position $x$. The answer is $x,x+1$. UPD: AC Submission 128343804
•  » » » 8 days ago, # ^ |   +10 Did this problem really worth time of CM?
•  » » » 8 days ago, # ^ |   0 I solved it that way , i was just interested in knowing why my first 2 pointers code didn't work so I can know when to avoid it
 » 9 days ago, # |   -100 All those who cheated in this round I hope you all die due to Covid-19 :).Peace!
•  » » 9 days ago, # ^ |   +1 I guess codeforces has a good system to detect cheaters
•  » » » 9 days ago, # ^ |   -17 Yeah! but still just wanted to say that anyways :)
•  » » 9 days ago, # ^ |   0 Woah bro, chill, there are way worse people who are still alive than those who cheat in online contests.
 » 9 days ago, # |   +6 when the editorial will come out?
 » 9 days ago, # |   0 Hi everyone, thanks for the contest I can't seem to figure out what I have done wrong in problem B. If anyone can provide with a test case so I can understand I would greatly appreciate it. Here's my submission: 128271618Thanks all!
•  » » 9 days ago, # ^ |   0 This fails: 1 5 22222
•  » » » 9 days ago, # ^ |   0 Hey thanks man, just tried it. I get that it fails, but I can't yet understand why? Do you happen to know?Thank you
•  » » » » » 9 days ago, # ^ |   0 Hey! Thanks for putting in the time and effort! Really helped me understand my mistake :) My greedy approach does in fact not work and now I understand whyThanks once again, I would uovote you more if I could
 » 9 days ago, # |   0 In problem C, I found the maximum number in the array and if it exists more than once, the answer should be n!. Because they will go to the end of the discussion together. But if there exists only once, We should put at least one maxi-1 in front of this maximum. - If maxi-1 is not in the array we should print 0 - Else we will permutate other numbers:We will replace other numbers except for maxi and maxi-1 after we have replaced them. Maxi and maxi-1 can be in number_of(maxi-1)! ways. after we have multiplicated them. We will print n! — this.
 » 9 days ago, # |   -43 All those who cheated in this round i hope you loose your genitals. Peace :) !
•  » » 9 days ago, # ^ |   0 He/She won't be in peace after losing them.
•  » » » 9 days ago, # ^ |   -11 That is what I hope for :)
 » 9 days ago, # |   +3 When the editorials will be published?
 » 9 days ago, # |   +3 And tasks were pretty good.
 » 9 days ago, # |   +6 This is the first contest in which I am able to solve problem B
 » 9 days ago, # |   +2 I made submission of Problem D in contest it gives TLE here.But After contest is over I submit same solution with no change it is working fine here . Why this is happening? I wonder if my TLE solution rerun after hacking is over?
•  » » 9 days ago, # ^ |   +4 The AC solution is way too close to time limit and +/- 50 ms is expected natural behaviour imo which depends on judging machine. So there are lot chances it might still tle after systest
 » 9 days ago, # |   0 I have coded the 1st question(That is equal no of 'a's and 'b's) thinking that even finding "ab" is sufficient as they haven't mentioned that the substring should be largest . can anyone please tell me whether I had taken it right because actually I got wrong for that question.
•  » » 9 days ago, # ^ |   +8 Yeah, it's right, but make sure you're also searching for "ba".
 » 9 days ago, # |   0 In problen D I tried to calculate count for points between consecutive 2 x-axis-parallel lines, which were grouped by their y-axis-parallel lines. The same works on y-axis. However the answer might always be little different to the Jurys answer. Any situation I missed or over-counted?
•  » » 9 days ago, # ^ |   0
•  » » » 9 days ago, # ^ |   +10 If a point is on the intersection, you should not count it, it adds 0 to the solution. If a point is on an X line, don't count it in solving for Ys, and vice versa.
•  » » » » 9 days ago, # ^ |   0 My sol had taken them into accout, so I think it may be some sneaky bugs.. Anyway, thanks!
 » 9 days ago, # |   0 That Problem C was simply wow! I did not have this much fun facing a problem in many days. Thank you!
•  » » 9 days ago, # ^ |   0 yeah, I also really enjoyed it!
 » 9 days ago, # | ← Rev. 6 →   +9 Solution for problem C: First sort array $p$. If $p[n] > p[n-1]+1$ then there is no solution. If $p[n] == p[n-1]$ then every permutation is a solution. The only case remaining is $p[n] = p[n-1] + 1$, note that a permutation is a solution in this case, if and only if, $n$ comes before at least one element equal to $p[n-1]$. It is easier to count the complement and subtract from $n!$. So let's count number of permutations where $n$ comes after every element equal to $p[n-1]$. Let $freq$ = count of elements equal to $p[n-1]$. Suppose element $n$ is at position $i$ in permutation. Note that $i>freq$ is necessary. We must choose $freq$ positions in prefix $[1..i-1]$ (binomial coefficient $i-1$ choose $freq$) to place all elements equal to $p[n-1]$ and also permute them between these positions. Remaining elements can go in any remaining position. Thus $ans$ is equal to the sum for all $freq < i < n+1$ of $i-1$ choose $freq$ multiplied by $freq! * (n-freq-1)!$. Note we can group all factors $freq! * (n-freq-1)!$ outside the sum. The sum of $i-1$ choose $freq$ for all $freq < i < n+1$ is equal to $n$ choose $freq+1$ (Hockey Stick Formula).
•  » » 9 days ago, # ^ |   +6 The third case where p[n] = p[n-1] + 1 can be simplified. Let freq = count of all elements = p[n-1]. Then answer simply is (freq*fact[n])/(freq + 1)Please correct me if i am wrong ( may be with an example )
•  » » » 9 days ago, # ^ | ← Rev. 2 →   +5 You are correct. We can simplify the answer = $\frac{n!}{(freq+1)! * (n-freq-1)!}*freq!*(n-freq-1)!$ = $\frac{n!}{freq+1}$ When we subtract this from $n!$ we get exactly what you wrote!!
 » 9 days ago, # |   +1 What is the intended solution for D? Are we supposed to do 6-8 binary searches to find the number of elements in some ranges ?
 » 9 days ago, # |   +6 Observations on Problem D: I could not get AC, but I hope the ideas below can help someone. Note that person $i$ and person $j$ form an incovenient pair, if and only if, they are on roads of the same type (vertical or horizontal) AND there is a road of the other type between them. Therefore, if person $i$ stands on both a vertical AND a horizontal road then this person cannot be in an inconvinient pair. We split set of people in $2$: people in vertical road $vert$ (sorted by $y$) and people in horizontal road $hori$ (sorted by $x$). We solve for each set separately and sum answers. We consider people in $vert$ one by one. Suppose we are considering person $i$. We keep a pointer indicating highest line below $i$. We also keep a queue of people already considered AND above this line. We keep a frequency array for $x$ coordinate of people in queue. In each iteration we update line by moving pointer to the right AND pop elements is queue below line. We add $queue.size() - freq[i.x]$ to answer. Set $hori$ can be solved in the same way.
•  » » 9 days ago, # ^ |   +4 You don't need to use queue. You can get an AC by every Time Binary searching as well.
•  » » » 9 days ago, # ^ | ← Rev. 3 →   +8 I guess the ideia is the same, both solutions explore Monotonicity. The only difference is in complexity analysis. Using pointers and queue we get $O(k*log(k) + k + n + m)$ solution because we sort each array but answer each person in amortized $O(1)$. Using binary search gives $O(k*log(k) + k*log(n) + k*log(m) + n + m)$ because we sort each array ($vert$ and $hori$) and perform binary search for each person in both. Both are ok for time limit.
•  » » » » 9 days ago, # ^ |   +4 Yess you are right.
•  » » 9 days ago, # ^ | ← Rev. 2 →   0 Finally got Accepted on problem D after reading this comment (plus ~2 hours of coding/debug), thanks a lot.
 » 9 days ago, # | ← Rev. 4 →   +3 I don't understand why my solution for problem B fails. For 4 2212 (failing 24th test) on codeforces my solution gives YES X+== -X== ==X= ===X However, on my pc, ideone, and random other compiler my program gives correct output YES X+=- -X=+ ==X= +-=X What have I done wrong???
•  » » 9 days ago, # ^ |   0 Solution for problem B: I will explain a possible construction of solution matrix. If a person wants to not lose any game, then we set all this person's game as DRAW. We store people who want to win at least one game in vector $must_win$. If $must_win.size() > 0$ AND $must_win.size() < 3$ note that solution does not exist. However if $must_win.size() > 2$ consider array as cyclical and let person $must_win[i]$ win against person $must_win[i+1]$. All conditions are satisfied by this construction.
•  » » » 9 days ago, # ^ |   +3 I did exactly that! Except a bit of different way: i marked all 1st type persons as draw between each other, then I gave victory to 2nd type person as soon as possible (and assigning defeat in the correct place, of course), any later game between 2nd types in matrix above the main diagonal is a defeat, below — win. Resulting in a nice right solution. But I dunno why in codeforces last 2nd type person somehow treated as first.
•  » » » » 9 days ago, # ^ |   +4 I looked at your code and I think I know what your mistake is. You need to reset your matrix for each test case. A character '+' or '-' from previous test case can interfere with your current test case!!
•  » » » » » 9 days ago, # ^ |   0 Thanks a lot, that helped!
•  » » 9 days ago, # ^ |   +12 When you create an array (not a vector) inside your main function, it can be filled with some weird values (its contents are undefined). So, when you try to compare $b[j][i]$ with some other values, the result of comparison may vary between different systems or even different launches on the same system.
•  » » » 9 days ago, # ^ |   0 Thanks a lot for the explanation!
 » 9 days ago, # |   0 Can anybody come up with a case where my 128251114 for B fails?
•  » » 9 days ago, # ^ |   0 ans[twos[twos.size() - 1]][0] = '+'; ans[0][twos[twos.size() - 1]] = '-'; Should be: ans[twos[twos.size() - 1]][twos[0]] = '+'; ans[twos[0]][twos[twos.size() - 1]] = '-';
•  » » » 9 days ago, # ^ |   0 Thanks for pointing out the error.
•  » » 9 days ago, # ^ |   0 1 5 12221Answer says first row has a minus. However, first item is a '1'. There should be no minus on the first row (1 means zero losses).
 » 9 days ago, # |   +3 When would the editorials be live?
•  » » 9 days ago, # ^ |   +3 After hacking is finished.
•  » » » 9 days ago, # ^ |   +3 Thank You so much for the information.
 » 9 days ago, # |   0 tutorial??
 » 9 days ago, # |   0 It was mentioned that this contest is rated...but it is not. I was unrated and still. Please, tell me if there is a problem. Thank you.
•  » » 9 days ago, # ^ |   0 You will be rated when the hacking is complete and final standings are published.
•  » » » 9 days ago, # ^ |   0 In about 12 hours.
•  » » » » 9 days ago, # ^ |   0 Thank you
•  » » 9 days ago, # ^ |   0 You'll be rated once hacking is finished
•  » » » 9 days ago, # ^ |   +1 Thank you. I have earned the rating. However, I want also to ask about my contribution. It is now -1. What does that mean. Thank you.
 » 9 days ago, # |   +1
 » 9 days ago, # |   0 Can anyone tell me why I'm getting RUNTIME error on TEST CASE — 3 My_B_Code
•  » » 9 days ago, # ^ |   0 try to use char arr[N+1][N+1] instead of string arr[N+1].
•  » » » 9 days ago, # ^ |   0 Can you please explain why is it so ??
•  » » 9 days ago, # ^ |   0 change: string arr[n+1] ; to: //string arr[n+1] ; vector arr(n+1, vector(n+1));
•  » » » 9 days ago, # ^ |   0 Can you pls explain why so ??
•  » » » » 9 days ago, # ^ |   0 string arr[n+1] is a 1-D array of string, which is like a 2-D array of characters. However, each string's length is not specified. You are accessing arr as if it were 2-D array of characters: arr[i][j]. Not specifying each string's length is the problem. It works ok only when n is small. When n is bigger, it is not ok. This code below is similar to the issue, but a bit easier to understand:  cin >> n; string s; for (int i=0; i
•  » » » » » 9 days ago, # ^ |   +3 Thanks Buddy !
 » 9 days ago, # |   0 Can problem C be solved in O(1)?
•  » » 9 days ago, # ^ |   0 It is obvious that the time complexity of the input is $O(n)$ .
•  » » » 9 days ago, # ^ |   0 I meant the solution itself without regard to input, like an $O(1)$ formula
•  » » » » 9 days ago, # ^ |   +1 If you get an algorithm which can solve it in $O(1)$ time without regard to input , that means you can get the answer without using the input numbers (if you use the input numbers , the time of iteration of the input numbers is greater than $O(1)$) . So why we input these numbers ?Can you get the meanings ?
•  » » » » » 9 days ago, # ^ |   0 lol, you're right... Confused C with something else, My bad.
•  » » » » 9 days ago, # ^ | ← Rev. 3 →   +1 There is an O(1) formula but it happens only after you spend 2N time (2 loops of size n each.) More specifically the answer is n! — (n — cnt — 1)! * cnt! * nC(cnt + 1) where cnt is the number of juries with the second largest number of tasks to tell.You can refer to my video and the pinned comment for more clarity on the same.Video Editorial for CCode demonstrating the O(1) idea
•  » » » » » 9 days ago, # ^ |   +3 that's great, here is the same idea, but more simplified.after sorting the array, if last two elements are same, then our answer is n!, means all permutations are nice.otherwise we can just subtract number of not nice permutations, which is eventually n! / (cnt+1), where cnt is count of second largest element.so our answer becomes n! — n! / (cnt+1).Here is my python submission
 » 9 days ago, # | ← Rev. 3 →   -16 I see a lot of contestants haven't received any penalty for wrong submissions before their first correct one! Can somebody kindly clarify?
•  » » 9 days ago, # ^ |   0 Submissions which fail on the 1st test case don't incur any penalty.
•  » » » 9 days ago, # ^ |   0 Thanks for your reply! That's advantageous for some but really disadvantageous for many. For example I managed to check if my code passes the sample testcases locally but one of my friend made 3 wrong submissions which didn't pass those. He is ranked better than me.
•  » » » » 9 days ago, # ^ |   +1 This is how it is (and should be). The first test case acts as an example on which you can test your code (and the compiler of your choice, if there are multiple versions). The question of it being an undue advantage to some users just doesn't arise...
 » 9 days ago, # |   0 Why is education more difficult than ordinary div2 ？
•  » » 9 days ago, # ^ |   0 If I am not able to solve C in the next round (probable), it will be a hat-trick.
•  » » » 9 days ago, # ^ |   0 Come on, boss, I'll watch you
 » 9 days ago, # |   0 Hey, why this contest is not rated, even though it is written it will be rated for the participants with rating lower than 2100. Can please anyone explain this? As I am new to the codeforces and this was my first contest..
•  » » 9 days ago, # ^ |   +3 Be patient, it takes time for the ratings to update.
 » 9 days ago, # |   0 I guess the open hack is over. But the contest rating has not been updated yet and the editorials as well.
•  » » 9 days ago, # ^ |   +6 Please be patient, it takes time to update the rating after checking and removing plagiarism
 » 9 days ago, # |   -36 fuck the rubbish contest
•  » » 9 days ago, # ^ |   0 Keep calm bro.
•  » » » 9 days ago, # ^ |   -39 The C Problem is such a rubbish,isn't it???
•  » » » » 9 days ago, # ^ |   0 And may I know the reason,why?
 » 9 days ago, # |   0 how to solve C?
 » 9 days ago, # |   +1 Where's the editorials?
•  » » 9 days ago, # ^ |   +13 The editorials are somehow a bit slow on "Educational" Rounds . Maybe they want us to think more and be better "Educated" :)Don't vote me back or I will be sad :(It may be just a joke :)
 » 9 days ago, # |   -6 Is everyone else rating changed after the contest? My is still not changed and also contest is not being reflected in my rating graph.
•  » » 9 days ago, # ^ |   +3 Man, this is not your first educational contest, so I am pretty sure you already know how they work. Is it really fun to ask such questions repeatedly? I am also sure that if you scroll a bit before commenting yourself, you will find a similar question, or two.
•  » » » 9 days ago, # ^ |   -12 Lol...it's my first educational round contest
•  » » » » 9 days ago, # ^ |   0 You literally participated in 2 in a row.
 » 9 days ago, # | ← Rev. 4 →   -13 Update : I just misunderstood the contest.Sorry to everyone. :(
•  » » 9 days ago, # ^ |   0 Where did you hear that?
•  » » » 9 days ago, # ^ |   -6
•  » » » » 9 days ago, # ^ |   0 Maybe the rating changes are yet to be done...
•  » » » » » 9 days ago, # ^ |   0 I hope so.
•  » » » » » » 9 days ago, # ^ |   0 I will become pupil , after so long . If it goes unrated, then it will be very sad for me :(
•  » » » » 9 days ago, # ^ |   +1 before rating change it shows like this in every contest :)
•  » » » » » 9 days ago, # ^ |   0 It will be nice.I admit I am a newbie here.
•  » » » » » 9 days ago, # ^ |   0 I realize I just said something stupid.How can I delete it? :(
•  » » 9 days ago, # ^ |   0 Come on man, don't lie. I am about to become expert for the first time.
•  » » » 9 days ago, # ^ | ← Rev. 2 →   -6 I'm looking forward to be an expert again.
•  » » 9 days ago, # ^ |   -14 Man,no one will believe in such a fucking Chinese like you!
•  » » » 9 days ago, # ^ |   0 WTF man , did he do something ?
•  » » » » 9 days ago, # ^ |   0 YES,he lied to us all!
•  » » » 9 days ago, # ^ |   +8 Inb4 you get banned
 » 9 days ago, # |   0 My solution for problem C is just a formula- if(count(max-1)!=1){ print(fact[n]); } else{ int cnt=count(max-1); int ans=fact[n]*cnt/(cnt+1); print(ans); }
 » 9 days ago, # | ← Rev. 2 →   0 Can someone explain me the idea behind B?
•  » » 9 days ago, # ^ | ← Rev. 3 →   0 First i filled the matrix with '.' , then , if the string has '1' at position i , then the best case for us would be that , he doesn't wanna lose , so we draw all the matches in row i , ie. fill the row i with '=' and fill i = j with 'X'. Now , iterating through the matrix , we check if there are some dots left , if we find dot and the corresponding (corresponding for i,j is j,i) is also filled with'.', then we put a '+' and fill corresponding with '-'. The row i had to win atleast 1 , which he did , so put all the '.' in the current row to '-' and the corresponding to those are replaced by '+'. After all the iterations for checking the case of -1 , what i did was check if the string given in input had 2 but if the row did not have any '+' , then answer is NO, else print the matrix formed. No condition can also be checked using a casework Submission link : https://codeforces.com/contest/1569/submission/128246925
•  » » » 9 days ago, # ^ |   0 Okay, thank you!
 » 9 days ago, # |   -9 Is this a rated contest?
•  » » » 9 days ago, # ^ |   -8 A 2 letter Or 3 letter word would be a great answer :)
•  » » » » 9 days ago, # ^ |   +9 A scroll up with the mouse will be much better ig :))
•  » » 9 days ago, # ^ |   0 YES
 » 9 days ago, # |   0 Why hasn't the result been out yet?
 » 9 days ago, # |   0 not lighthearted meme
•  » » 9 days ago, # ^ |   0 :Sadge:Waiting for -ve delta like :')
 » 9 days ago, # |   0 When rank is rated :(( ?? I look forward a better rank through this contest hmu
 » 9 days ago, # | ← Rev. 2 →   0 For Problem D can someone please tell me how to find points like (2 and 7) in the second test case since I need to subtract these points from my final answer? i.e points which have either same x co-ordinate or y co-ordinate and there is no line which is intersecting between the points.
 » 9 days ago, # |   +20 To not keep you waiting, the ratings are updated preliminarily. In a few hours/days, I will remove cheaters and update the ratings again!
•  » » 9 days ago, # ^ |   +3 The comment every newbie was waiting for lmao. I'm not a bad person guysWishing +ve delta for everyone :')
 » 9 days ago, # |   +3 Can someone give some strong test cases for D? I thought of every test case I could and stil couldn't figure out the bug in my code.
 » 9 days ago, # |   0 yamete kudasai
 » 8 days ago, # |   0 Thank you because of this helpful contest!
 » 8 days ago, # |   0 Auto comment: topic has been updated by awoo (previous revision, new revision, compare).
 » 8 days ago, # |   0 Auto comment: topic has been updated by awoo (previous revision, new revision, compare).
 » 8 days ago, # |   +4 Contrary to all the comments complaining about problem C, I found solving problem C was very enjoyable. I felt it was a good Combinatorics problem, especially for newbies like me.When I read the statement I instantly realized that the largest element would always be the last to remain, and the same thing for the second largest element. Thus I only need to pay attention to these two. I then tried permutating the 2 elements to see what would happen if the second largest was before the largest, the largest was before the second largest, etc. I later deduced that: If the second largest equals the largest, they will be the last elements in the array together after deletion, so every permutation of that array is a nice permutation. If the second largest is smaller than the largest by 2 or more, we need extra decreases just for the largest element only. Hence, no matter how the array was arranged, the array remained not nice and the answer was 0. Else, the array is nice only if there exists at least one second largest element after the position of the largest element in the array. The first 2 cases could be solved simply by using $std::map$ or sorting. I did struggle with the last case at first since I couldn't come up with any formula to count, but then I found out I could solve it by counting the opposite case when the permutation was not nice. Let's call the largest element $x$ and the second largest one $y$. To start with, I fixed the position of the $x$, so it looked something like this:_ _ _ $x$ _ _In order to make the array not nice, in the last 2 slots, we should choose any elements other than $y$. It means that we need to choose 2 numbers from the set of numbers not including $y$, or $P(k, 2)$ with $k$ is the size of the set of numbers excluding $y$. We can calculate $k$ by subtracting the number of elements in the array (which is $n$) by the number of $y$ and then subtracting it by $1$ (the element $x$ itself). But that's not all, we can continue to permutate the first 3 slots, thus multiplying the answer by $3!$. So the general formula for $x$ at any position $i$ is: $P(k, n - i + 1) * (n - i)!$With $n - i + 1$ is the amount of slots after $x$ and $n - i$ is the amount of slots before $x$. Little note that when $n - i + 1$ is larger than $k$, $P(k, n - i + 1)$ is $0$ instead. I prebuilt a factorial array so I could calculate $(n - i)!$ in $O(1)$, then I used fast exponentation for the modular inverse needed to calculate $P(k, n - i + 1)$, making each position $O(logN)$. Finally I iterated every position from 1 to $n$, so the total complexity is $O(N*logN)$.Unluckily I didn't solve this problem quick enough, so I wasn't able to make a submission before the end of the contest. Still feel pretty bad now :(((
 » 8 days ago, # |   +9 I have earned the rating. However, I want also to ask about my contribution. It is now -1. What does that mean. Thank you.
•  » » 8 days ago, # ^ |   0 Well, that means that you are asking questions that were disliked by the community. The contribution is somehow calculated using the numbers of upvotes and downvotes your comments have.
•  » » » 8 days ago, # ^ |   +9 I got it. Thank you
 » 5 days ago, # |   0 For some reason, it showed plag for a certain question in this contest, they cancelled the contest for me. I'm not that very much concerned about that but are there any further measures?
 » 3 days ago, # | ← Rev. 7 →   0 The comment is hidden due to the large number of negative reviews about it, click here to view it
•  » » 3 days ago, # ^ |   0 Its the second time this happened today.


text:
anonymous 3 years ago Where 0<=x<360, Solve the equation

1. anonymous

$3\sin x-5+\csc x=0$

2. Mertsj

$3\sin ^2x-5\sin x+1=0$

3. anonymous

But I simplified that to $\sin ^{2}x-3\sin x+1$

4. Mertsj

I don't see how you get that?

5. anonymous

Give me a sec

6. anonymous

Oh wait.. I was looking at something else. My bad.

7. anonymous

Would I use the quadratic formula to find the roots of 3sin^2x−5sinx+1=0?

8. Mertsj

$3sinx \times sinx-5\times sinx+\frac{1}{sinx}\times sinx=0 \times sinx$

9. Mertsj

yes

10. anonymous

$\frac{ 3\pm \sqrt{5}}{ 2 }$ But then what? I can't isolate for x, can I?

11. Mertsj

sin x = (3+sqrt5)/2 or sin x = (3-sqrt5)/2

12. anonymous

So would I find the arcsin of (3+sqrt5)/2 and (3-sqrt5)/2 for x?

13. Mertsj

Can't be the first one because sin can't be bigger than 1.

14. Mertsj

so sin x = .3820

15. anonymous

Does there happen to be a way I could solve this without using a calculator?

16. Mertsj

If you have a table of values you could.

17. Mertsj

Did you get 22.5 degrees and 157.5 degrees?

18. anonymous

Do we need my assistance here or are we ok?

Find more explanations on OpenStudy

format: plain


text:
Zee's Nutshell: Feynman diagrams “baby problem”: Connected vs. Disconnected

On page 47 of A. Zee's QFT in a Nutshell, he explains how disconnected Feynman diagrams can be built from lower-order connected diagrams:

I don't know how to understand formula $(6)$.

I understand that there must be a way to "decompose" $Z(J,\lambda)$ into connected Feynman diagrams. After all, if we know the coefficients for the "straight line" $|$ and for the vacuum bubble $8$, we should be able to calculate the coefficient for the combined diagram $|8$ from the "parts".

But how exactly does that work? Maybe I can work out the details if I have one concrete example of a term $W(J,\lambda)$, but all my efforts so far were fruitless.

To show my efforts, here's one example: I tried to use $(6)$ on the concrete example $Z(2,1)$:

$$\frac{5}{16m^6}(-\lambda)J^2 = Z(J=2, \lambda=1) \overset{(6)}{=} Z(J=0, \lambda=1) e^{W(J, \lambda)} = \frac{1}{8m^4}(-\lambda)e^{W(J, \lambda)}$$

$$e^{W(J, \lambda)} = \frac{5}{2m^2}J^2$$

But how is that useful? How can I calculate $W(J,\lambda)$ without having $Z$?

EDIT: If you don't know the book, the "baby problem" is the integral

$$Z(J) = \int_{-\infty}^{+\infty}dq e^{-\frac 12m^2q^2-\frac{\lambda}{4!}q^4+Jq}$$

This is then expanded in $J$ terms, which yields integrals that can be solved using Wick's theorem. The result is a double series in $\lambda$ and $J$ with coefficients

$$Z(J^{2a}, \lambda^b) = \frac{(2a+4b-1)!!}{b!(2a)!(4!)^b} \frac{1}{m^{2a+4b}}(-\lambda)^b J^{2a}$$

• I'm not exactly sure what your question is. The equation $(6)$ is just the statement that the sum $Z(J)$ over all diagrams decomposes into the product of the disconnected and the partially connected diagrams. – ACuriousMind Oct 30 '15 at 17:16
• My question is, what is $W(J, \lambda)$ exactly? I know it is something like $Z(J, \lambda)$, but "contains" only connected diagrams. What is it quantitatively? Is there a formula to calculate it? As I said, maybe I can understand it if I have some concrete example, with the exact numbers calculated. An example like $Z(J=0, \lambda=1)=\frac{1}{8m^2}(-\lambda)$, but for $W$. – Bass Oct 30 '15 at 17:57
• Related: physics.stackexchange.com/q/107049/2451 , physics.stackexchange.com/q/129080/2451 and links therein. – Qmechanic May 6 '17 at 13:32

First, $(6)$ is just the definition of $W$. Since $e^W = Z(J)/Z(0)$ (suppresing the $\lambda$ dependence), it is given by the sum of all diagrams divided by the sum of all diagrams with no external legs. Now, when you have a disconnected diagram, it factors into the product of its connected subdiagrams. In your notation, the amplitude for $|8$ is just the amplitude for $|$ times the amplitude for $8$.
Now a magical thing happens. When you sum all diagrams (connected and disconnected) to get $Z$, you can sort of divide it into factors, where each factor is the sum of many copies of a single connected diagram. If you have $n$ copies you need to raise the diagram to the power $n$ and divide by $n!$ to account for normalization, so what ends up happening is that $Z$ is proportional to the exponential of the sum of all connected diagrams:
$$Z(J) \propto \exp(\sum_I C_I)$$
Where each $C_I$ is a connected diagram. Since $Z$ was also proportional to $e^W$, we get that $W$ is the sum of connected diagrams; this is the quantity we calculate when actually doing Feynman diagrams. This is because calculating observables amounts to taking functional derivatives of $Z$ with respect to $J$ and then setting $J=0$, which brings down factors of $W$.
By the way, Zee doesn't care about the proportionality constant but it makes sense to have $Z(0)=\langle 0 | 0\rangle = 1$; therefore, if we say $Z(J) = \exp(W(J))$ and omit vaccum diagrams from $W$, we get $Z(0)=1$.


text:
OpenStudy (anonymous):

Write an equation in slope-intercept form of the line that passes through the given points. 1. (1,3) (7,4) 2. (0,-3) (-5,0) 3. (-6,-7) (-5,1) 4. (4,2) (7, -4)

4 years ago
OpenStudy (goformit100):

Formula will be :- (y-y_1) = { (y_2 - y_1)/(x_2 - x_1) } (x - x_1)

4 years ago
Similar Questions:


text:
# Moogsoft Docs

## Template Matcher Moolet

### Warning

Template Matcher was deprecated from the release of Moogsoft AIOps V7.0.0. For more information see Deprecation Notice: Template Matcher .

The Situation Templates enable users to provide feedback to Moogsoft AIOps that indicates the quality of the Situations produced and consequently what AIOps should do if it detects a similar situation in the future.

## moog_farmd

The TemplateMatcher moolet should be activated in moog_farmd if you wish your system to discover “Priority Templates”.  By default, moog_farmd will always suppress the creation of SPAM templates, regardless of the moolet they are generated by.

There is no special configuration required for the moolet; it is either “on” or “off”.  TemplateMatcher should run after the AlertBuilder or AlertRulesEngine depending upon the system configuration.  The default configuration for the TemplateMatcher is shown below:

{
name               : "TemplateMatcher",
classname          : "CTemplateMatcher",
run_on_startup     : false,
}
sigaliser --moolet=TemplateMatcher


text:
# When can $\mathbb{Z}/p\mathbb{Z}$ be recovered by $[0]$ and $[k ^n]$?

One can see that $$\mathbb{Z}/19\mathbb{Z}=\{[0],[1],\ldots,[18]\}=\{[0],[3^1],[3^2],\ldots,[3^{18}]\}.$$ If I have $\mathbb{Z}/p\mathbb{Z}$, $p>2$ prime, when is there a $k\in\{2,3,\ldots,p-1\}$ such that $[k ^n]$ and $[0]$ recover $\mathbb{Z}/p\mathbb{Z}$? Further, when is there a prime $k$?

I'm a little removed from my last algebra course, but this interested me and I couldn't come up with a solution offhand.

Edit: nonessential to answer, but appreciated: Regarding when $k$ is prime, are there any partial results for any special classes of primes $p$?

• For your last question, see Greg Martin's paper linked in this answer. As long as $p$ is large enough and none of the L-functions of Dirichlet characters mod $p$ have zeroes of small height far away from the critical line, then there exists a rather small (less than some power of $\log p$) prime $k$ which works. In particular, GRH would imply this for all sufficiently large primes. – Erick Wong Jun 21 '17 at 16:33

The group $(\mathbb{Z}/p\mathbb{Z})^\times$ of non-zero elements of $\mathbb{Z}/p\mathbb{Z}$ is cyclic, which means there always exists an element $k\in\{1,\ldots,p-1\}$ whose powers, along with $[0]$, give every element of $\mathbb{Z}/p\mathbb{Z}$. Such a $k$ is called a primitive root modulo $p$. The number of primitive roots is $\varphi(p-1)$, the number of integers between $1$ and $p-1$ that are coprime to $p-1$.

Regarding trying to find a prime $k$ that does the job, this question gives an argument that the answer is probably yes, but that proving this might be very hard.

What you are really asking is "Can I find a generator for $(\Bbb Z/p\Bbb Z)^{\ast}$?"

The answer is "always", but there is no "general formula" for "how", and such a generator need not be some prime less than $p$.

The question of "if" there is always such a prime, is to the best of my knowledge, still open, but there "probably is".

As strange as it seems, trial-and-error is still the best method for investigating this question for any given $p$.

• Sure, but this prime is not necessarily less than $n$. – David Wheeler Sep 24 '15 at 1:15
• That there is such a prime (between $1$ and $p$ whose residue class generates the units modulo $p$). Feel free to edit my response if you feel this needs clarification. – David Wheeler Sep 24 '15 at 1:19
• Ah, your second line is saying a given generator needn't be prime, and the third is saying it might be open if there is always a generator that is prime ($<n$). Nevermind. – whacka Sep 24 '15 at 1:22
• I understand that the sequence $(a_k): a_k = a_0 + kp$ contains infinitely many (and thus at least one, right?) primes. This is the theorem you refer to yes? – David Wheeler Sep 24 '15 at 1:25
• Yes, that is Dirichlet's theorem that I referred to. – whacka Sep 24 '15 at 3:20


text:
# What happens to the resistance of a wire when its length is double?

This question was previously asked in
HSSC Police Constable 7 Aug 2021 Shift 2 (canceled) Official Paper
View all HSSC Haryana Police Constable Papers >
1. Gets doubled
2. Becomes half
3. Becomes nil
4. None of the above

Option 1 : Gets doubled

## Detailed Solution

The correct answer is Gets doubled.

Key Points$\mathrm{lllllfdjskf dfkdfj f}$

• The new resistance after doubling the length of the wire becomes double the original resistance.
• Resistance
• Resistance can be defined using Ohm's Law.
• Ohm's Law states that current through a conductor between two points is directly proportional to the voltage across those two points.
• Formula derived: V=IR; where V= voltage across two points, I= current flowing through the conductor, R= Resistance of material.
• Resistance acts as the proportionality constant in Ohm's Law.
• For a material, Resistance= (Resistivity*Length)/Area.
• As the resistance is directly proportional to the length of the material, the long wires will have more resistance as compared to short wires of the same diameter.


text:
Draw the following function and find its critical points, if any: f(x) = 3(x-4)e^{x-3}+3

Question:

Draw the following function and find its critical points, if any: {eq}f(x) = 3(x-4)e^{x-3}+3 {/eq}

Critical Points:

We can find the critical points of a function where the curve changes from increasing to decreasing or from decreasing to increasing. We can also find the critical points by equating the first derivative to zero or when it does not exist.

We have the function

{eq}f(x) = 3(x-4)e^{x-3}+3 {/eq}

Graph the function:

Equating the first derivative to zero, we find the critical points.

Differentiating the function

{eq}f'(x)=3\,{{\rm e}^{x-3}}+3\, \left( x-4 \right) {{\rm e}^{x-3}} \\ {/eq}

{eq}f'(x)=0 {/eq} when {eq}x=3 \\ {/eq}

Therefore, Critical point at:

{eq}(3, 0) {/eq}


text:
# Collatz conjecture— finite state machine transducer construction, origination?

wikipedia has an entry on the Collatz conjecture with a section on As an abstract machine that computes in base two. this apparently describes a construction of a FSM transducer computing sequential iterates starting from lsb to msb (least sig. bit to most sig. bit). [this is more a TCS, theoretical computer science construction.] however, there is no specific ref cited.

does anyone know where this FSM iterate transducer construction appears, or first appeared in the literature?

note, there is some relation to ref [4].

[ps, have some apparently new/possibly groundbreaking results related to this construction & intend to write it up on a blog, may edit this post later to incl the ref.]

[1] The ultimate challenge: the 3x+1 problem, Lagarias

[3] The 3x + 1 Problem: An Annotated Bibliography, Lagarias, arxiv

[4] Jeffrey O. Shallit and David W. Wilson (1991), The “3x + 1” Problem and Finite Au- tomata, Bulletin of the EATCS (European Association for Theoretical Computer Sci- ence), No. 46, 1991, pp. 182–185.

-
I'm afraid that self-advertisement is something particularly frowned upon here. Why not try math.stackexchange.com? The answer to your question is that the equivalence between the Collatz function and the one described in base 2 is obvious, and needs no reference. – user30035 Mar 3 '13 at 20:30
I don't see he is advertising anything. He just wants a reference for the automaton formulation. – Benjamin Steinberg Mar 3 '13 at 21:35
Actually I take it back. I didn't notice the small print on my IPhone but now that I see it on a real computer I noticed the small print. So I upvote wccanard's comment. – Benjamin Steinberg Mar 4 '13 at 16:57
If you would like to avoid problems of this kind, just do not refer to your work as "possibly groundbreaking" and there is no need to stress that the work is "apparently new". Why not only say that you are in the process of writing something related to this and thus would be interested in a reference you can quote. – user9072 Mar 4 '13 at 18:21
No, there is no discrepancy to be inferred! I said you should only say that you are writing something related to this (perhaps phrased in slightly nicer form than I sketched). As opposed to saying you should have left the ps away completely. The problem is not that you say you are writing something, but that you include some positive self-evaluation of it that, frankly, seems possibly exaggerated but even if it is not is is irrelevant to know whether (you think) this is "possibly groundbreaking." Indeed, I gave you some credit for including motivation, else it'd be closed already. – user9072 Mar 5 '13 at 20:01


text:
# Pure and mixed density operators of a Schmidt decomposition

Suppose we have Hilbert space factorisable in to K subsystems $$\mathcal{H} = \mathcal{H}_1\otimes...\otimes\mathcal{H}_K$$ in which we can express a pure state as the Schmidt decomposition $$|\psi\rangle=\displaystyle\sum_{i_1...i_K} c_{i_1...i_K}|i_1\rangle^{(1)}\otimes...\otimes|i_K\rangle^{(K)} = \displaystyle\sum_{i_1...i_K} c_{i_1...i_K}|i_1,...,i_K\rangle = \sum_I c_I |I\rangle$$

The density operator for a pure state is then

$$\rho = \sum_{I,J} c_{I}c_J^* |I\rangle\langle J| = \sum_{I,J} a_{IJ} |I\rangle\langle J|$$

Suppose we then use our Schmidt decomposition to form the eigenstates

$$|\psi_n\rangle = \sum_{I} c_{I,n}|I\rangle$$

From the spectral theorem we can then form a mixed density operator as

$$\rho = \sum_n \lambda_n |\psi_n\rangle\langle\psi_n| = \sum_{n,I} \lambda_n c_{I,n}c^*_{I,n} |I\rangle\langle I| = \sum_I b_I |I\rangle\langle I|$$ Suppose now I consider the following composition in to a bipartite system $$\mathcal{H} = (\mathcal{H}_1\otimes...\otimes\mathcal{H}_{J-1})\otimes(\mathcal{H}_J\otimes...\otimes\mathcal{H}_K) = \mathcal{H}_A\otimes\mathcal{H}_B$$ and I wish to consider a reduced density operator $$\rho_A$$, so I wish to write a general density operator as $$\rho_{AB} = \sum_{n,m} p_{nm} (\rho_A^n \otimes \rho_B^m)$$ I would therefore like as general a choice of $$\rho_A^n$$,$$\rho_B^m$$ as possible and my intuition tells me to choose mixed density operators but how I am reading it, I would think the pure state density operators are "more general" for perhaps the very naive reason that there are more indices giving more possible choices?

Hopefully this clarifies my overall question: can either pure or mixed states be seen as "more general" than one or the other in some sense, specifically with how many coefficients there are for each state represented?

• I don't understand the notation. But note that the Schmidt decomposition only works if you bipartite your system (again, I don't know if you did that since I really don't get the notation). Anyway, what is your last line actually showing? Of course a convex combination of (different) pure states is a mixed state, but why'd you need the Schmidt decomposition? Could you elaborate on what the question actually is? I don't understand the need for the Schmidt decomposition here at all. What do you mean with 'more general'? Apr 25 at 16:03
• @JasonFunderberker My understanding is that Schmidt decomposition can be generalised to a multipartite system, which is what I'm considering above, a K-partite system. I apologize for the notation, I've been working on trying to keep it concise. Also realised I made a mistake in the last line, should be fixed now. I'm using Schmidt decomposition as a way of considering states in large, factorisable Hilbert spaces. The goal is to compute various entropies for various configurations of entangled states with generalised expression for mixed and pure states! Apr 25 at 16:12
• But what is the question? Sorry, but I really don't understand.You haven't put any question mark and I still don't see the need for the Schmidt decomposition when writing a mixed state in terms of pure states or in terms of its eigenstates. Please put some sentences where you elaborate what you're trying to ask and specify what you mean with "more general". Apr 25 at 16:17
• @JasonFunderberker I've tried to restate it now, hopefully it makes more sense? Apr 25 at 16:40

The Schmidt decomposition is just a confusing red herring here.

Given a basis $$\lvert \psi_i\rangle$$ of our Hilbert space, we may expand any vector in that basis, and hence a normalized state is $$\lvert \psi\rangle = \sum c_i\lvert \psi_i\rangle$$ with $$\sum_i \lvert c_i\rvert^2 = 1$$. So its associated density matrix is

$$\rho_\psi = \lvert \psi\rangle\langle \psi\rvert = \sum_{i,j} c_ic^\ast_j \lvert \psi_i\rangle\langle \psi_i\rvert = \sum_{i,j} \rho_{ij}\lvert \psi_i\rangle\langle \psi_j\rvert. \tag{1}$$

You seem to be confused because this "looks" as if there is more freedom here in the $$\rho_{ij}$$ than in the $$\lambda_i$$ when we write a generic mixed state as $$\rho = \sum_i \lambda_i \lvert \phi_i\rangle \langle \phi_i\rvert,\tag{2}$$ in terms of its eigenstates $$\lvert \phi_i\rangle$$ - after all there are $$n^2$$ of the $$\rho_{ij}$$ and only $$n$$ of the $$\lambda_i$$.

There are a few different ways to note that eq. (2) defines a more general class of operators than eq. (1):

• Eq. (1) is an expansion of an arbitrary $$\rho_\psi$$ in a fixed basis $$\lvert \psi_i\rangle$$, something that works for all pure state matrices, while eq. (2) is specifically in the eigenbasis of $$\rho$$ - some other $$\rho'$$ would not have the same form in that same basis in general.

• There isn't actually more independent parameters in eq. (1) because there are only as much of the $$c_i$$ as there are of the $$\lambda_i$$ in eq. (2), and while the $$\lambda_i$$ are constrained by $$\sum_i \lambda_i = 1$$, the $$c_i$$ are constrained by $$\sum_i \lvert c_i\rvert^2 = 1$$, so in both cases you essentially have $$n-1$$ independent parameters, but in eq. (2) you can additionally choose the basis differently and this gives you different $$\rho$$s (see the first point again), so there is more freedom in eq. (2) than in eq. (1).

• A very "manifest" difference is simply that the pure state matrix fulfills the purity condition $$\rho_\psi^2 = \rho_\psi$$ by construction, while the mixed state matrix does not - it does not follow from eq. (2) and $$\sum_i \lambda_i = 1$$, while it does follow from eq. (1) and $$\sum_i \lvert c_i\rvert^2 = 1$$, so that alone shows you the second equation is more general.

• Thank you! The fixed basis you refer to, would that be a tensor product state in a multipartite system? While the eigenbasis is a linear combination of tensor product states? This is why I am using Schidmt decomposition, constructing a basis as a linear combination of tensor product states in a multipartite system! Apr 25 at 16:58
• @CouchAnalysis You can fix any basis you want (that's the nature of bases)... Apr 25 at 16:59
• Alright, so in my case, the constraints on $a_{IJ}$ mean that there are more degrees of freedom to $b_I$? Apr 25 at 17:08
• Another question that comes to mind. In eq (1), you mean to write $\rho_\psi = \sum_{i,j} \rho_{ij} |\psi_i\rangle\langle\psi_j|$ I presume? Apr 25 at 18:56


text:
Lemma 10.147.2. Let $R \to S$ be an étale ring map. Let $R \to B$ be any ring map. Let $A \subset B$ be the integral closure of $R$ in $B$. Let $A' \subset S \otimes _ R B$ be the integral closure of $S$ in $S \otimes _ R B$. Then the canonical map $S \otimes _ R A \to A'$ is an isomorphism.

Proof. The map $S \otimes _ R A \to A'$ is injective because $A \subset B$ and $R \to S$ is flat. We are going to use repeatedly that taking integral closure commutes with localization, see Lemma 10.36.11. Hence we may localize on $S$, by Lemma 10.23.2 (the criterion for checking whether an $S$-module map is an isomorphism). Thus we may assume that $S = R[x]_ g/(f) = (R[x]/(f))_ g$ is standard étale over $R$, see Proposition 10.144.4. Applying localization one more time we see that $A'$ is $(A'')_ g$ where $A''$ is the integral closure of $R[x]/(f)$ in $B[x]/(f)$. Suppose that $a \in A''$. It suffices to show that $a$ is in $S \otimes _ R A$. By Lemma 10.147.1 we see that $f' a = \sum a_ i x^ i$ with $a_ i \in A$. Since $f'$ is invertible in $S$ (by definition of a standard étale ring map) we conclude that $a \in S \otimes _ R A$ as desired. $\square$

Comment #7689 by nkym on

In the last sentence of the proof, I was wondering if you meant $S$ instead of $B[x]_g/(f)$.

There are also:

• 2 comment(s) on Section 10.147: Integral closure and smooth base change

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).


text:
# Is magnesium carbonate soluble in water?

As physical scientists we should look at the data. This source quotes the solubility as $0.0106$ $g$ per $100 \cdot m L$ of water. So the stuff is pretty insoluble.
Of course, this presupposes a neutral $p H$. Bicarbonates, salts of $H C {O}_{3}^{-}$ are very soluble.


text:
# Hydrophilic vs water soluble?

Is the term 'hydrophilic' a synonym of 'water soluble' or can you have a molecule that is water insoluble but hydrophilic (or water soluble and not hydrophilic)?

## migrated from biology.stackexchange.comFeb 3 '16 at 15:49

This question came from our site for biology researchers, academics, and students.

• Interesting question, but I think this is more on-topic in chemistry. There are substances as cellulose which are hydrophilic but not water-soluble. – Chris Feb 3 '16 at 9:16
• Possible duplicate of biology.stackexchange.com/q/23763/3340 – WYSIWYG Feb 3 '16 at 9:55
• Consider this example: glass is hydrophilic but not soluble. – Zhe May 22 '17 at 22:22

Hydrophilic substances are not necessarily water soluble, and the two terms are not synonymous.

On a molecular scale, "hydrophilic" is defined by the IUPAC Gold Book$^1$ as:

'Water loving'. The capacity of a molecular entity or of a substituent to interact with polar solvents, in particular with water, or with other polar groups.

Note that the term hydrophilic does not necessarily refer to an entire molecule, and that interacting strongly with a molecule or a part of a molecule does not imply that it must be soluble in water.

Also, entire macroscopic surfaces can be said to be hydrophilic, meaning that they interact strongly with water but certainly are not soluble in water. In this context, the degree of hydrophilicity is measured by the contact angle, which can be simply stated as the angle formed when a droplet of water is placed on a surface, where a small angle (as seen from inside the droplet) means that the droplet has spread out over the surface, and that the surface is therefore hydrophilic.

So, although small, hydrophilic molecules are frequently water soluble, solubility plays no part in the definition of "hydrophilic" on any scale or context.

1) IUPAC. Compendium of Chemical Terminology, 2nd ed. (the "Gold Book"). Compiled by A. D. McNaught and A. Wilkinson. Blackwell Scientific Publications, Oxford (1997). XML on-line corrected version: http://goldbook.iupac.org (2006-) created by M. Nic, J. Jirat, B. Kosata; updates compiled by A. Jenkins. ISBN 0-9678550-9-8

Yes, they mean the same thing actually. Going through any one of the several online sources available, you can clearly understand this: A Hydrophilic molecule is one in which interaction with water is thermodynamically more favorable than interaction with oil or other hydrophobic solvents. Such substances are generally capable of forming hydrogen bonding with water, which makes them soluble in water. One can in fact say that these types of molecules are soluble in all polar solvents, like alcohol and ammonia.

• Solubility depends on polarity but that doesn't mean that all polar substances will dissolve in water or any other polar solvent. – WYSIWYG Feb 3 '16 at 18:54
• @WYSIWYG That is the general rule: like dissolves like. Sure, there might be some exceptions. – ShankRam Feb 4 '16 at 1:55

Seems to me that a drop of oil hitting water beads up, showing no tendency to increase its area of contact with the water. On the other hand, a drop of gasoline, e.g. Heptane or Octane, will immediately spread over the water surface to such a degree that the actual thickness of the film will be one molecule. Such a tendency to maximize the area of contact sounds to me like hydrophilic while not soluble.


text:
# Problem with rotating objects by script

I have script (operator) which should align align all selected objects somewhat.

import bpy
from mathutils import Vector

class VCUTILS_OT_alignToLongest(bpy.types.Operator):
bl_idname = "object.align_to_longest"
bl_label = "Align Objects along their Longest Axis"
bl_description = "Create average vector from the longest edges and align object to have x axis along this vector"
bl_options = {'UNDO'}

shortestEdgeEvaluated = 0.8

def execute(self, context):
for obj in bpy.context.selected_objects:
if getattr(obj, 'type') in ['MESH']:
self.alignObject(obj)

return {'FINISHED'}

def alignObject(self, obj):
mesh = obj.data

# Apply object rotation
bpy.context.view_layer.objects.active = obj
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)

# Find longest edge length
longestD = 0.0
for edge in mesh.edges:
v1 = Vector(mesh.vertices[edge.vertices[0]].co)
v2 = Vector(mesh.vertices[edge.vertices[1]].co)

longestD = max(longestD, (v2 - v1).length)

# Find direction as an average of longest edges
axis = None
for edge in mesh.edges:
v1 = Vector(mesh.vertices[edge.vertices[0]].co)
v2 = Vector(mesh.vertices[edge.vertices[1]].co)
eVect = v2 - v1

if eVect.length >= longestD * VCUTILS_OT_alignToLongest.shortestEdgeEvaluated:
eVect.normalize()

if axis is None:
axis = eVect
else:
if axis.dot(eVect) > 0:
axis += eVect
else:
axis -= eVect

axis.normalize()

# Align the object according to major axis found
rotQuat = axis.to_track_quat('X', 'Z')
rotEuler = rotQuat.to_euler()
#        rotEuler = ( 0, 0, 0.785 )
print("Euler: " + str(rotEuler))
obj.rotation_euler = rotEuler

# Rotate the mesh back
for v in mesh.vertices:
v.co = Vector(v.co) @ rotQuat.to_matrix()

print("Obj " + str(obj) + " done")

If I try it with that "proper rotation" it rotates the first selected object and ignores all others. It prints correct rotations for all objects to stdout, however. If I uncomment that line with "Rotation for debug" it rotates all selected objects to that fixed rotation.

I'am screwed now, I cannot imagine, where may be the problem ...

EDIT> Images before and after . The leftmost selected is properly aligned. Other two selected not.

EDIT2> Added full script, python init and testfile

bl_info = {
"name": "VCUtils",
"author": "Vaclav Cermak <disnel@disnel.com>",
"description": "Various my utilities",
"version": (0, 9),
"blender": (2, 80, 0),
"location": "View3D",
"warning": "",
"category": "Generic"
}

import bpy

from . alignToLongest_op import VCUTILS_OT_alignToLongest

classes = (
VCUTILS_OT_alignToLongest,
)

def register():
for cls in classes:
bpy.utils.register_class(cls)

def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)

• What is the aim here? To give all selected mesh objects the same global rotation? Nov 25, 2019 at 13:27
• No, the aim is to reorient all selected mesh objects to have their local x axis along their longest edges. Every object receives different rotation. Nov 25, 2019 at 13:54
• Please provide a before an after pic. Could align longest edge to global x by rotating at object level, but IMO would need to rotate mesh data locally (ie in edit mode) to align edge with local axis (and back again at object level if alignment is to be kept) Somewhat related blender.stackexchange.com/a/121227/15543 note the use of rotation difference. Nov 25, 2019 at 14:35
• Added to original question. Nov 25, 2019 at 14:43
• Without testing I'd say the issue is bpy.ops.object.apply... works on all selected objects, wheras you are calling it in a loop whilst changing active object, quite likely only the last set active object appears to "have worked" the others will be zeroed because of the op call. Kudos for putting the time into the script. However I would strongly recommend you please check out how I have done this in my answer. It is using no operators. Looping over hundreds of objects and calling operators blender will slow down considerably. Nov 26, 2019 at 17:34

Transoform in place, align local $$X$$ axis to longest edge

the aim is to reorient all selected mesh objects to have their local x axis along their longest edges. Every object receives different rotation

• Get all the meshes of selected objects, could be anything from 1 (all share same mesh) to having a mesh each.
• Find the longest edge of each, rotate mesh about origin such that x axis aligns. Keep the inverse transform of this rotation.
• For each selected object transform by inverse. (ie rotate back to orginal global orientation with new local axis)
• Used rotation difference of two vectors. Using rotation difference of two tracking quats would help with aligning up axis too.
• Assumes all meshes have at least one edge, used bmesh purely for BMEdge.calc_length() could use mesh data directly.

Example of use, LOCAL axis of three objects shown. Running script Rotates them in place such that the longest edge is aligned with the $$X$$ axis

Test script.

import bpy
import bmesh
from mathutils import Vector

context = bpy.context
ob = context.object
meshes = set(o.data for o in context.selected_objects if o.type == 'MESH')

bm = bmesh.new()
lut = {}
for me in meshes:
bm.from_mesh(me)
le = sorted(bm.edges, key=lambda e: e.calc_length()).pop()
axis = (le.verts[1].co - le.verts[0].co).normalized()
q = axis.rotation_difference(Vector((1, 0, 0)))
R =  q.to_matrix()
me.transform(R.to_4x4())
lut[me] = R.transposed().to_4x4()
bm.clear()

for o in (o for o in context.selected_objects if o.type == 'MESH'):
o.matrix_world @= lut[o.data]

• Thank you, but I don't have problem with transformation itself, it works. But there is something strange in Blender and it transforms only first from selected objects. Rotation for all others is calculated fine (I can see them in stdout), but Blender refuses to apply it to objects .... EDIT> When I uncomment that line "Rotation for debug", it sets that rotation for all three objects. But when I try to use the result from previous calculation, it sets rotation only for first object from selection, despite correct output to stdout Nov 25, 2019 at 16:41
• As mentioned answer is in response to desired result. To debug your code would need the full code, and perhaps a simple test blend to run it on. If the objects have another rotation type than euler then setting euler rotation does nada. Recommend working on matrices as suggested in answer. Nov 26, 2019 at 4:20
• Added full source and testfile to original question. If I uncomment that line with rotEuler = ( 0, 0, 0.785 ), it works and rotates all objects. But if I comment it out and try to set calculated rotation, it rotates only one selected object... Nov 26, 2019 at 15:31
• Upvoted, but I don't have enough reputation... Thank you! Nov 27, 2019 at 13:25
• Upvoted for you, I have enough reputation, fortunately. Please consider to accept the answer, thanks @VaclavC How this site works: blender.stackexchange.com/tour Sep 6, 2021 at 17:15

I did some modifications on the code above given by batfinger (because it was not working for me) (blender 2.93)

copy active object rotation considering the longest axis to selected (rotation mode does not matter and if rotations have been applied or not)

import bpy
import bmesh
from mathutils import Vector

context = bpy.context
ob = context.object
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
objs = set(o for o in context.selected_objects if o.type == 'MESH')

bm = bmesh.new()
mw = None
for ob in objs:
me = ob.data
bm.from_mesh(me)
le = sorted(bm.edges, key=lambda e: e.calc_length()).pop()
axis = (le.verts[1].co - le.verts[0].co).normalized()
q = axis.rotation_difference(Vector((1, 0, 0)))
R =  q.to_matrix()
if ob == context.object:
mw = R.to_4x4().inverted()
me.transform(R.to_4x4())
bm.clear()

for o in (o for o in context.selected_objects if o.type == 'MESH'):
o.matrix_world @= mw


text:
## If the circumference of a circle measures 3/2pi cm, what is the area of the circle in terms of pi

Question

If the circumference of a circle measures 3/2pi cm, what is the area of the circle in terms of pi

in progress 0
3 months 2022-02-10T05:02:35+00:00 1 Answer 0 views 0

1. The area of circle in terms of pi is $$\frac{9}{16}\pi \ cm^2.$$

Step-by-step explanation:

Given,

Circumference of circle = $$\frac{3}{2} \pi$$  cm

Circumference of a circle is calculated by 2πr.

$$2\pi r=\frac{3}{2}\ pi$$

Dividing both sides by 2π

$$\frac{2\pi r}{2\pi}=\frac{3}{2}\pi *\frac{1}{2\pi}\\r=\frac{3}{4}$$

The radius of circle is $$\frac{3}{4}$$

Area of circle = πr²

Area of circle = $$\pi *(\frac{3}{4})^2$$

Area of circle = $$\pi *\frac{9}{16}$$

Area of circle = $$\frac{9}{16}\pi$$ cm²

The area of circle in terms of pi is $$\frac{9}{16}\pi \ cm^2.$$

Keywords: area, circle


text:
# A person invested Rs.10000 partly at 6% per annum and remaining amount at 4% per annum. If the simple interest for 2 years in both the schemes are equal, then what amount was invested at 6% p.a.

Free Practice With Testbook Mock Tests

## Options:

1. Rs.3500

2. Rs.4500

3. Rs.3000

4. Rs.4000

### Correct Answer: Option 4 (Solution Below)

This question was previously asked in

DSSSB TGT Natural Science Male General Section - 29 Sept 2018 Shift 2

## Solution:

Given:

Total principal = Rs. 10000

Rate = 6% and 4%

Time = 2 years

Formula Used:

S.I = PRT/100

Where,

S.I = Simple interest, P = Principal,

R = Rate of interest, T = Time duration

Calculation:

Let the principal at the rate of 6% and 4% be x and (10000 - x) respectively,

According to the question, we have

(x × 6 × 2)/100 = {(10000 - x) × 4 × 2}/100

⇒ 12x = 80000 - 8x

⇒ 20x = 80000

⇒ x = 4000

∴ The principal at the rate of 6% is Rs. 4000.


text:
A solenoid has a length of 30cm, a radius of 2cm, has 500turns and carries a current of 3A. (a) What is the strength of themagnetic field at the center of the solenoid?

(b) Suppose the current in the above solenoid decreases linearlyto zero in 0.5 seconds. What is the magnitude of the Induced emfwhich acts to oppose the decreasing current? (c) Will the inducedemf produce a magnetic field which opposes the magnetic field ofthe solenoid? Explain.


text:
# A cruise has 170 seats available Because people withreservations do not show up for theircruise 11% of the time,

###### Question:

A cruise has 170 seats available Because people with reservations do not show up for their cruise 11% of the time, the cruiseship always overbooks to prepare for this. There are more passengers that have tickets on the boat than there are seats. Suppose the cruise has 181 passengers booked for 170 seats. Assume one person showing up for the cruise does not affect others who may, or may not, show up. (a) How many people (with tickets) does the cruise ship expect to show up for this cruise? Provide the standard deviation as well. Enter your answers to two decimals. The expected number of people showing up for the cruise_______ Standard deviation of the number of people who show up for the cruise_____ (b) When the cruise is to depart, what is the probability that there will be 6 seats empty? Enter your answer to four decimals. _________ P(6seatsempty)= ______ (c) What is the likelihood that a passenger with a cruise ship reservation will not be accepted on the boat due to overbooking? Use four decimals in your answer. ___________

#### Similar Solved Questions

##### What are the values and types of the critical points, if any, of f(x) =x^2-sqrtx?
What are the values and types of the critical points, if any, of f(x) =x^2-sqrtx?...
##### Copper exists in the $+1,+2$, and $+3$ oxidation states. Which is the most stable? Which would you expect to be a strong oxidizing agent and which would you expect to be a strong reducing agent?
Copper exists in the $+1,+2$, and $+3$ oxidation states. Which is the most stable? Which would you expect to be a strong oxidizing agent and which would you expect to be a strong reducing agent?...
##### 25_ amethyl-6-hexanal dimethylhexanal , D) ~1,A-dimethylpentanal 1A4-dimethylhexanal What - is the IUPAC name for the following compound?sec- butyl ethanoate B) ethyl 3-methylpentanoate 3-methylbutyl ethanoate D) ethyl 3-methylbutanoate Which reagent combination could NOT be used to camy out the following transformation?A) Zn(Hg), HCI clemmensin reductio1 B) LiAIHy, ether C) HSCH-CHzSH, BF;; then Raney Ni (Hz) reducs t â‚¬tlz D) NHANHyKOHheat W_ ILschner reduas tCdlz
25_ amethyl-6-hexanal dimethylhexanal , D) ~1,A-dimethylpentanal 1A4-dimethylhexanal What - is the IUPAC name for the following compound? sec- butyl ethanoate B) ethyl 3-methylpentanoate 3-methylbutyl ethanoate D) ethyl 3-methylbutanoate Which reagent combination could NOT be used to camy out the fo...
##### Airbags in your car deploy through the explosive decomposition of sodium azide (NaN3) into its individual...
Airbags in your car deploy through the explosive decomposition of sodium azide (NaN3) into its individual elements (think about what this means you need to do). If 50.0g of sodium azide decomposes and fills a 68.5L airbag at a pressure of 1185.2 torr with N2 gas, what is the temperature of the gas i...
##### Long- parallcl wires cany currents of2,95 and I2 4,75the directions indicated the figure below , where23,5 cm , (Take the positive direction be to the right:)(a) Find the magnitude magnitude directiondirection of the magnetic fieldpoint midway between the wirescounterclockwise Irom the +X axis(b) Find the magnitude and direction the magnetic field point located gnitude direction counterclockwise from the axiscm abave the wire carrying the 75- cumrent
long- parallcl wires cany currents of 2,95 and I2 4,75 the directions indicated the figure below , where 23,5 cm , (Take the positive direction be to the right:) (a) Find the magnitude magnitude direction direction of the magnetic field point midway between the wires counterclockwise Irom the +X axi...
##### Reading an income statement Calculating Earnings and Dividends per share: U S Corporation 2017 Income Statement...
Reading an income statement Calculating Earnings and Dividends per share: U S Corporation 2017 Income Statement ($in millions) Net sales$1,509 Cost of goods sold       750 Depreciation         65 Earnings before int...
##### Answer the questions below about the highlighted atom in this Lewis structure:H = SC=0=Hhow many sigma bonds does the highllahted atom DarucloniipIn how Many bonds does the highlighted atom participate?What the orbltal hybridization of the highlighted atom?
Answer the questions below about the highlighted atom in this Lewis structure: H = SC=0=H how many sigma bonds does the highllahted atom Darucloniip In how Many bonds does the highlighted atom participate? What the orbltal hybridization of the highlighted atom?...
##### FindCsuch that the following function is a probability density: Then compute the second moment ofX, whenXis...
FindCsuch that the following function is a probability density: Then compute the second moment ofX, whenXis a random variable having the above PDF. If Y, Z areindependent and having the same PDFf, then write down the joint PDF of(Y, Z). С - 2 1>1 f() = 1 1/2 <r <1 1 <1/2 lo 0...
##### A wind turbine (you see these in large fields) has 3 blades of ! make 14 revolutions flength 45.0 m. If the blades per minute_ rotating about their ends. calculate the following values. Treat the blades as rods How fast is the tip of the blade traveling? Give your answer in m/s ad mph Ifeach blade has a mass of 10,000 kg, what is the rotational moment of inertia of the wind turbine with 3 blades? What is the energy contained in the spinning of the turbine? Ifyou have a 40.OkW braking motor attac
A wind turbine (you see these in large fields) has 3 blades of ! make 14 revolutions flength 45.0 m. If the blades per minute_ rotating about their ends. calculate the following values. Treat the blades as rods How fast is the tip of the blade traveling? Give your answer in m/s ad mph Ifeach blade h...
##### Ata certain temperature, K Is 4.13x 102 for the equilibrium: 2IBri) 1z(a1 +Brzia) Issume that equilibrium is established at the above temperature by adding only IBr(n) t0 the reaction flask What are the concentrations of Iztr) " and Brze) in equilibrium with 0.0124 M of IBrts)? (5)
Ata certain temperature, K Is 4.13x 102 for the equilibrium: 2IBri) 1z(a1 +Brzia) Issume that equilibrium is established at the above temperature by adding only IBr(n) t0 the reaction flask What are the concentrations of Iztr) " and Brze) in equilibrium with 0.0124 M of IBrts)? (5)...
##### (12 Mak:) The estimated waiting time in bus :tcp using sainple ofsize 100is mlinues If the tue variance. 04 =25_Construct a 9590 IWo-sided confidence inteival fcr Use Zo,ozs If u = 5.5, find P(R < 5).for this problem
(12 Mak:) The estimated waiting time in bus :tcp using sainple ofsize 100is mlinues If the tue variance. 04 =25_ Construct a 9590 IWo-sided confidence inteival fcr Use Zo,ozs If u = 5.5, find P(R < 5). for this problem...
##### A telescope has a 5-inch radius lens. When looking at two distant stars, what's the smallest angle of resolution required to resolve their images using 550 nm wavelength light?
A telescope has a 5-inch radius lens. When looking at two distant stars, what's the smallest angle of resolution required to resolve their images using 550 nm wavelength light?...
##### Mathxl, Lcom/Student Playertomeworkaspr?homeworkld-5560097098questior MAC2233 Section 291Homework: Section 1.7 Enhanced Ho Score: 0 of 1 pt 1.7.1 Differentiate the function, y= (Sx+6)3
mathxl, Lcom/Student Playertomeworkaspr?homeworkld-5560097098questior MAC2233 Section 291 Homework: Section 1.7 Enhanced Ho Score: 0 of 1 pt 1.7.1 Differentiate the function, y= (Sx+6)3...
##### Ifin Hu Wronsksn b)are ay linusrly Irdegtadoat ? 6fi- x -lo 5+2 x T:X+zx 6x2 Vi? I6r2| Vz 0 b? 3 Ht 72 2T ~3 27 Vz 2 Vz: V 4T GT Gtl
Ifin Hu Wronsksn b)are ay linusrly Irdegtadoat ? 6fi- x -lo 5+2 x T:X+zx 6x 2 Vi? I6r2| Vz 0 b? 3 Ht 72 2 T ~3 27 Vz 2 Vz: V 4T GT Gtl...
##### The point x = 0 is a regular singular point of the given differential equation _ xy (x 8)y' 4y = 0 Show that the indicial roots of the singularity differ by integer: (List the indicial roots below as a comma-separated list. )Use the recurrence relation found by the method of Frobenius first with the larger root r1- How many solutions did you find? 3x2 one solution given by Y1 = 1 2 34 28 1680 +9 xlO 7x12 one solution given by Y1 = 2 2 264 xlo 2 7x12 one solution given by Y1 = 2 264 xy xlo
The point x = 0 is a regular singular point of the given differential equation _ xy (x 8)y' 4y = 0 Show that the indicial roots of the singularity differ by integer: (List the indicial roots below as a comma-separated list. ) Use the recurrence relation found by the method of Frobenius first wi...
##### Ramp Distance (m)Calculated velocity (mls)Predicted Range Average Actual (m) Range (m)Percent Error0.3520.31060.2520.25350.1480.1598]
Ramp Distance (m) Calculated velocity (mls) Predicted Range Average Actual (m) Range (m) Percent Error 0.352 0.3106 0.252 0.2535 0.148 0.1598]...
##### Chapter 4, Section 4.8, Question 09eUse the information in the table to:find the dimensions of the row space of A, column space of A, null space of A, and null space of AT determine whether or not the linear system Ax = b is consistent; (iii) find the number of parameters in the general solution of each system in (ii) that is consistentISize of AX 11Rank (A)RRank ([A | b])The dimension of the row space of A isThe dimension of the column space of A isThe dimension of the null space of A isThe dim
Chapter 4, Section 4.8, Question 09e Use the information in the table to: find the dimensions of the row space of A, column space of A, null space of A, and null space of AT determine whether or not the linear system Ax = b is consistent; (iii) find the number of parameters in the general solution o...
##### Explain in no less than 10 sentences how can an airline corporate be a monopolist.
Explain in no less than 10 sentences how can an airline corporate be a monopolist....
##### Exercise 15-5 (Part Level Submission) Ikerd Company applies manufacturing overhead to jobs on the basis of...
Exercise 15-5 (Part Level Submission) Ikerd Company applies manufacturing overhead to jobs on the basis of machine hours used. Overhead costs are expected to total $275,000 for the year, and machine usage is estimated at 125,000 hours. For the year,$296,000 of overhead costs are incurred and 130,00...
Combustion of hydrocarbons Such J5 undecane (C,H,4) produces carbon dloxide, atmosphere can trap the Sun"$heat, rising the average temperature the Earth_ discussion about whether - regulete thc production cardon dloxide grcenhousc q05 Grecnhouse Qus05 In the Earth 5 chis reason chere has Deen ... 1 answer ##### What is the “Hispanic paradox?” provide a thorough explanation, examples of this phenomenon, and discuss what makes it l... What is the “Hispanic paradox?” provide a thorough explanation, examples of this phenomenon, and discuss what makes it less of a paradox.... 5 answers ##### 25. Coordination. pair of identical speakers emit spherical coherent waves with wave - length of unils. These are placed at different positions along the Iy-plane. In which speaker placement will you have constructive interference at the origin? (0,1) and (5. 0) B. (2.0) and (-3.0) C: (1,0) and (1,-I) D. (~1.0) and (1.0) 26. Alin ang naiba? Which of the following situations will not lead t0 observable wave inter- ference?Young = Iwo slit experiment on gamma Tys B. Incandescent headlights of dist 25. Coordination. pair of identical speakers emit spherical coherent waves with wave - length of unils. These are placed at different positions along the Iy-plane. In which speaker placement will you have constructive interference at the origin? (0,1) and (5. 0) B. (2.0) and (-3.0) C: (1,0) and (1,-... 5 answers ##### Problem 2. [45 points] The high-speed train 1, departed at time to; travels for 81 240 miles at speed v1 (to be determined) before reaching the arrival station: second train, named train 2, departs at the same time to and travels for 82 160 miles at speed v2 (to be determined) before reaching the same station The railway system is such that v1 cannot exceed 120 miles/h and v2 cannot exceed 190 miles /h_ The two trains must arrive at the station at the same time. Considering the typology of the Problem 2. [45 points] The high-speed train 1, departed at time to; travels for 81 240 miles at speed v1 (to be determined) before reaching the arrival station: second train, named train 2, departs at the same time to and travels for 82 160 miles at speed v2 (to be determined) before reaching the sa... 1 answer ##### Consider a bicycle wheel of mass M and radius R that sits on a flat, level... Consider a bicycle wheel of mass M and radius R that sits on a flat, level surface, such that the surface is tangent to the wheel. One end of a spring (spring constant, k) is attached to bicycle wheel's hub, and the other end is fixed to a vertical wall. The spring is horizontal. There is suffic... 1 answer ##### Explain why the determinant of the matrix is equal to zero. $left[egin{array}{rrrr} 3 & 4 & -2 & 7 \ 1 & 3 & -1 & 2 \ 0 & 5 & 7 & 1 \ 1 & 3 & -1 & 2 end{array} ight]$ Explain why the determinant of the matrix is equal to zero. $left[egin{array}{rrrr} 3 & 4 & -2 & 7 \ 1 & 3 & -1 & 2 \ 0 & 5 & 7 & 1 \ 1 & 3 & -1 & 2 end{array} ight]$... 1 answer ##### 1 and determine the 8. [10 pts Find a power series representation for the function f(:1)... 1 and determine the 8. [10 pts Find a power series representation for the function f(:1) = interval of convergence,... 1 answer ##### How can I solve these two questions? Current Attempt in Progress Ivanhoe, Inc. decided to establish... how can I solve these two questions? Current Attempt in Progress Ivanhoe, Inc. decided to establish a petty cash fund to help ensure internal control over its small cash expenditures. The following information is available for the month of April. 1. On April 1, it established a petty cash fund in th... 1 answer ##### QuenanSonkanundetermined coefficient method for the Fnd tha paneml soltion byesing folbwing equation: am deng: Kaedah pekali tak tentu bagi persamaan Cen penyelesaian ben:2y' 15v = 3cos2x(15 markslmarkah)Find the Inverse Laplace Transform for Cari {Songsangan Tranformasi Laplace untukF(s) 1+65 - 2) 2 -2)46-1) Quenan Sonkan undetermined coefficient method for the Fnd tha paneml soltion byesing folbwing equation: am deng: Kaedah pekali tak tentu bagi persamaan Cen penyelesaian ben: 2y' 15v = 3cos2x (15 markslmarkah) Find the Inverse Laplace Transform for Cari {Songsangan Tranformasi Laplace untuk F(... 1 answer ##### Programming language: Java Design an application that has three classes. The first one, named Book describes... Programming language: Java Design an application that has three classes. The first one, named Book describes book object and has title and number of pages instance variables, constructor to initialize their values, getter methods to get their values, method to String to provide String representatio... 5 answers ##### (2 points) Determine if the following statements are TRUE or FALSE (a) Ifalb and a|(36 + c) then alcIfalb and ak(b + 7c) then alc.integers n , nn? is even (2 points) Determine if the following statements are TRUE or FALSE (a) Ifalb and a|(36 + c) then alc Ifalb and ak(b + 7c) then alc. integers n , n n? is even... 1 answer ##### A$ 49,437 simple interest bearing promissory note is issued on July 13, 2019 at 11.11...
A \$ 49,437 simple interest bearing promissory note is issued on July 13, 2019 at 11.11 % p.a. for 173 days. Determine the interest that will be earned on the promissory note....