Would the Haste Spell allow you to cast a second, singular weapon attack effecting cantrip (such as Greenflame Blade)?

So the Haste spell in 5e says that the targeted creature

gains an additional action on each of its turns. That action can be used only to take the Attack (one weapon attack only), Dash, Disengage, Hide, or Use an Object action.

This means I technically have a second action, so would that allow me to use the Greenflame Blade cantrip a second time in the same turn (once with the actual action, once with this action) as the cantrip applies to one weapon attack in a similar fashion as a Paladin with Haste could apply Divine Smite onto the Haste-given attack?

Are there such thing as header files in unity/C#?

I am new to unity, and I love organizing. This is my issue: say I have two different scripts, Sword and Spear. Two of which share common stuff, such as an enum Size {Small, Medium, Large}, they also share the same class DamageAttributes, which contains information regarding their damage as well as methods to calculate them. This is my attempt to abstract my actual problem, what I would like to do is to declare the enum and the classes in a fashion similar to .h in C++, so I have a place where I know they will be, and I can put other stuff that will be shared into it as well. Is there a good way to implement this?

Why is burying yourself not such a great plan?

One of my player is a clever guy. At night when the others are putting the camp together he digs a hole big enough for himself (between 3-4 feet deep) and asks someone to cover his body with dirt; he then uses a straw to breath. His idea is to avoid ambush at night.

The first time I was baffled by this idea and had no response. After a couple of nights I started challenging his strategy. I identified a couple of potential complications but he was able to answer everything I offered.

  • Sleeping under 3 feet of dirt at night would be terribly cold (But I have a bedroll which is warm enough
  • You wouldn’t sleep comfortably and be sore in the morning (No specific rules for sleeping in armor I can use as a reference)
  • Breathing through a straw requires keeping your mouth closed and doing so while you’re sleeping is impossible (I’m an elf and when I’m in trance I’m not asleep so I can keep my mouth shut)

    He has no intention of quickly being able to help the rest of the party if they get attacked, so escaping his hole is not something I can use against him (I tried).

    So far the problem has not transpired out-of-game. I’m annoyed because he’s obviously trolling but the other members of the group don’t mind his selfishness (he doesn’t get XP or loot from attacks at night).

Am I wrong to think that this is not such a great plan? I can’t think of any reason or mechanics to point out the flaws of his plan.

I don’t mind him doing it. I just think I’m not emulating the consequences properly because it’s an obviously stupid decision.

Randomly assign n elements to n agents such that each agent only knows its own element


Problem

I’m working on an app that involves shuffling and distributing playing cards to players. As a challenge, I tried to solve this problem in a way that doesn’t require a trusted intermediary.

In other terms, the task is to find a distributed algorithm that

  • uniquely assigns $ n$ agents numbers $ 1..n$
  • allows each agent to know nothing about the assignment but its own
  • when revealing the assignment, allows other players to verify the assignment

We also assume that knowing other’s assignment is an advantage for each agent, and revealing its own prematurely a disadvantage. Agents are also assumed to be able to talk with each other in a way hidden from all other agents.

Partial solution

The solution I came up with works only under the assumption that adversaries do not collaborate.

The idea is to create a set of $ n$ nonces, and assign each agent exactly one nonce. The set is then passed from agent to agent in an agreed upon order, hidden from all others, until each agent received the set exactly once. Each time an agent receives the set, it swaps its nonce with a new one, memorizes the new nonce, and confirms receival of the set to the others. This entire procedure is done twice, at which point, all agents have received the set at least once after all other agents swapped their nonces, making it impossible to recognize and hence map the nonces to the other agents.

When the last agent receives the set the second time, it shares it with everyone, and all agents confirm to the others that their nonce is contained in the set. The agents then assign a number to each nonce in the set based on an agreed upon random seed, giving us the required unique assignment.

To allow ownership verification, instead of the nonces, agents put the hash value of their nonce on the set, revealing the actual nonce only when verification is required.


The problem with this solution is that if adversaries are allowed to collaborate, each time an adversary receives the set, they can compare their versions, identify changes and potentially derive which nonce belongs to other agents, allowing them to know what number got assigned to them.

All ideas are appreciated!

$L_2$ = {a,k | is a 3DNF (disjunctive normal form) and exist z such that safifies exactly k clauses in a} Validity of reduction $VC \leq_p L_2$

I have the following question :

$ L_2$ = {$ a,k$ | $ a$ is a 3DNF (disjunctive normal form) and exist $ z$ such that satisfies exactly $ k$ clauses in $ a$ }

I know that $ L_2 \in NPC$ .

Show that $ L_2 \in NP$ is relatively easy, I’ll skip that part.

I try to show that $ L_2 \in NPC$ using a reduction from $ VC \leq_p L_2$ (VC is vertex cover which we know in its $ NPC$ )

I defined the following function $ f$ :

$ $ f(G,k)=(a,k)$ $

I thought of something like that for each node $ i$ in $ G$ will define a literal $ x_i$ , and make it in $ 3DNF$ format, $ a=\bigvee(x_i \wedge x_i \wedge x_i)$ where $ 1 \leq i \leq n$ where $ n$ is the number of nodes in $ G$ . We can define that following $ z$ such that $ z$ safifies exactly $ k$ clauses, just give $ ‘1’$ literal $ x_i$ such that the node $ i$ is in the VC, and $ ‘0’$ otherwise, so such $ z$ exists.

So easy to see that $ (G,k) \in VC \implies (a,k) \in L_2$ since we showed explicitly such $ z$ that safifies exactly $ k$ clauses.

But I’m not sure the other side holds $ (G,k) \not\in VC \implies (a,k)\not\in L_2$ we given a graph that doesn’t have VC in size $ k$ but I think due to my building of a ($ a=\bigvee(x_i \wedge x_i \wedge x_i)$ ) we can find $ z$ that safifies exactly $ k$ clauses (actually we can find $ z$ that safifies $ x$ clauses where $ 1 \leq x \leq n$ where $ n$ is number of nodes in G.

So my reduction doesn’t hold?

Thanks.

Divide first n square numbers 1^2, 2^2, ……. n^2 into two groups such that absolute difference of the sum of the two groups is minimum [closed]

lets say Given input is n = 6 (n is as large as 100000) My task is to divide {1, 4, 9, 16, 25, 36} into two groups and PRINT these two groups

Possible Solution 1: dividing groups as {1, 9, 36} and {4, 16, 25} which gives abs diff as abs(46 – 45) = 1. So the minimum difference is 1 and the two groups are {1, 9, 36} and {4, 16, 25}

Possible Solution 2: Another Possible Solution is dividing groups as {9, 36} and {1, 4, 16, 25} which gives abs diff as abs(45 – 46) = 1. So the minimum difference is 1 and the two groups are {9, 36} and {1, 4, 16, 25}.

If there are multiple solutions we can print any one. Iam trying to solve it using https://www.geeksforgeeks.org/divide-1-n-two-groups-minimum-sum-difference/ but its not working.

I know that min difference is always 0 or 1 for n >= 6 but how to divide them into two groups.

And can we extend this problem to cubes, fourth powers, so on. if so what is the strategy used

Does a function $f$ exists such that: $f(n-k) \ne \Theta(f(n))$ for some constant $k\geq1$?

I have encountered the following question in my homework assignment in Data Structures course:

"Does a function $ f$ exists such that: $ f(n-k) \ne \Theta(f(n))$ for some constant $ k\geq1$ ?"

I think no such function $ f$ exists, but I do not know how to prove it (or give a counter-example if one exists).

Complexity of finding a Eulerian path such that the image under a bijection is also a Eulerian path

Problem input: undirected graphs $ G$ , $ H$ and a bijection $ f: E(G) \to E(H)$
Question: Is there a Eulerian path $ p: \{1,\dots,|E(G)|\} \to E(G)$ in $ G$ such that $ f \circ p$ is a Eulerian path in $ H$ ?

Is this problem in $ P$ , $ NP$ -complete or maybe equivalent to some other well-known problem that isn’t known to be either yet?

The problem turned up as a special case of a more general problem first in the Bachelors thesis of another student last year and now in mine as well (I was improving some of the results of the other thesis). All other cases of the problem are now known to be either NP-hard or solvable in polynomial time, but neither one of us managed to make any progress on that case. On the other hand it feels like a much more "natural" problem than the other cases, so I think we may have missed a simple proof.

If undirected graphs are replaced by directed graphs in the problem statement there is a simple polynomial time algorithm (find a Eulerian path in the graph with vertex set $ V(G)\times V(H)$ and edge set $ $ \{((v_1, w_1), (v_2, w_2)) | (v_1, v_2)=e \in E(G), f(e) = (w_1, w_2)\}$ $ ignoring isolated vertices). The analogous graph for the undirected case contains 2 edges for each edge in $ G$ , so just finding a Eulerian path is no longer enough.