Does Ocular spell make every eligible damage spells have a critical chance since it becomes a ranged touch attack (ray)?

Ocular spell states:

(…)When you release an ocular spell, its effect changes to a ray with a range of up to 60 feet. If the spell previously would have affected multiple creatures, it now affects only the creature struck by the ray. You must succeed on a ranged touch attack to strike your target with an ocular spell, and the target is still permitted any saving throw allowed by the spell.(…)

Every spell that has a touch attack (melee/range) Do have a critical hit chance (20X2)

So If I was to release an Ocular Fireball (only affects 1 creature now and it still gets the Reflex Half saving throw though). It could indeed be a critical hit.

Correct?

Sidenote:

I know fireball might not be the best spell for this combination, it was just for the sake of the question.

For every imperative function, is there a functional counterpart with identical performance or even instructions?

Currently, I haven’t learned about a functional language that can achieve the same performance as C/C++. And I have learned that some languages that favor functional programming to imperative programming, such as Scala and Rust, use imperative ways to implement their library functions for better efficiency.

So here comes my question, on today’s comptuters that execute imperative instructions, is this a limitation of the compiler or functional programming itself? For every imperative function with no side effects, either in a language without GC such as C/C++/Rust/assembly or one with GC such as Java, is there a pure functional counterpart in Haskell, Scala, etc. that can be compiled to run with identical performance in time and space (not just asymptotic but exactly the same) or even to the same instructions, with an optimal functional compiler that utilizes all modern and even undiscovered optimization techniques such as tail recursion, laziness, static analysis, formal verification, and so on which I don’t know about?

I am aware of the equivalence between λ-computable and Turing computable, but but I couldn’t find an answer to this question online. If there is, please share a compiler example or a proof. If not, please explain why and show a counter-example. Or is this a non-trivial open question?

Assume $P \neq NP$ Proof that $L$ = {$a | a \in SAT$ and every clause consists of $log_2(|a|)$ literals} in P [closed]

I really stuck on the following question (Assuming $ P\neq NP$ ):

$ $ L = \{a \mid a \in SAT \text{ and every clause consists of } \log_2|a| \text{ literals}\}$ $

I don’t understand how could $ L$ be in $ P$ while we know that the $ SAT \not\in P$ , how can one verify if $ a$ is satisfiable without using the Turing machine that verifies that $ a \in SAT$ .

Can a single casting of Dispel Magic dispel every creature conjured by a Conjure Animals spell?

Yesterday in a game, my character cast Conjure Animals and summoned 8 wolves†. On the baddies’ turn, one cleric was about to cast Dispel Magic, but the DM changed his mind, deciding that the 8 wolves could not be considered a single magical effect. Personally, I agree with this, but I’m wondering if that stands up to the rules:

Can a single casting of Dispel Magic dispel every conjured creature from one spell at once?


† I’m aware of the debate over who picks the animals; my DM ruled that I could pick.

Minimum number of nodes to select such that every node is at most k nodes away

I received this problem on an exam a few months ago, and have kept thinking about how to solve it with no luck.

Given a binary tree where each node in the tree can either be selected or unselected, implement a function k_away() which returns the minimum number of nodes that need to be selected so that every node in the tree is at most k nodes away from a selected node.

So, the nodes simply contain a pointer to the left child, a pointer to the right child, and a boolean marking it as selected or not:

struct Node {     Node *left;     Node *right;     bool selected = false; // starts out false }; 

The problem specifies a constraint of having a time complexity of O(n) and an auxiliary space complexity of O(n).

What I’ve thought of so far:

  • It seems like there are 2^n potential solutions (if I can choose to either select or not select every node and there are 2 of them), so brute force is a bad idea
  • I’ve searched around for similar problems and the closest thing I can find is the Dominating Set problem which seems… impossible to solve at this moment in polynomial time. I doubt this problem was given as an impossible problem.
  • Running DFS to get to the leaf nodes, then counting height as recursion unrolls. Every k away, marking the node as selected. This seems to work on small test cases, but does not return the minimum number away.
  • Running BFS on the root node to find all nodes k away while using another data structure to mark all visited nodes as ‘covered’, and then recursively running the BFS on each k-away node. This also seems to work on small test cases, but again doesn’t return the minimum number away.