The nation’s second-best coach was mad at the refs, mad at his team, mad that his first ACC tournament championship wouldn’t come this year in the city of his birth. “We thought we had the better basketball team,” Rick Pitino said. “They showed us they were the better basketball team.”

The nation’s best coach was giddy. “I’m 70 years old, and I felt like a kid today,” Mike Krzyzewski said. Then, nodding toward Grayson Allen: “I was hugging him, punching him. He didn’t punch back, which was a good decision on his part.”

We’ll return to the issue of Allen, who many entertain visions of punching, in a moment. But here’s let note that Duke’s 81-77 victory against Louisville might have been the greatest quarterfinals game in the history of conference tournaments. Put it this way: The Cardinals and Blue Devils figure to be higher seeds in the NCAA bracket announced Sunday than the Nos. 4 and 5 they were here.

Said Krzyzewski: “Holy mackerel. That was a big-time game. We beat a really good team. That team could win it all. That was a really good game, in case you (media folks) didn’t know that.”

His team had surged from 12 points behind to beat the school that had, in Dallas in 1986, denied Coach K a national championship in his first trip to the Final Four. As had happened in Philadelphia in 1992, Krzyzewski’s team had one-upped Pitino’s. (The latter was then coaching Kentucky and neglecting to guard the inbounding Grant Hill.) Between them, these programs and these coaches have made a library’s worth of history. This was another rich slice.

Krzyzewski: “Today was just joy.”

Pitino: “We really played well today. … We could have won by 10 or 15 points.”

That his Cards didn’t could be traced to Allen. He didn’t score in Duke’s tournament opener against Clemson. He mustered 18 points against Louisville and, as only this serial tripper can do, left the audience howling in utter polarization.

With 9:05 remaining and Louisville leading by six points, Donovan Mitchell was whistled for fouling Jayson Tatum in the corner. Mitchell is the Cardinals’ best player. The foul was his fourth. Within seven seconds, his replacement — the smallish walk-on David Levitch — was called for two fouls against Allen.

The first brought the flailing of arms and legs that we’ve come to associate with this histrionic hoopster. From the bench, Pitino gestured to the officials that Allen had used his free arm to shove Levitch. On the resulting inbounds pass, Allen hoisted a 3-pointer from the corner and was brushed by Levitch after releasing. His three free throws brought the Devils within 64-61. Forty-two seconds later, they were ahead.

After those three free throws, Krzyzewski removed Allen. When he came to the bench, his coach greeted him with hand-slaps and a hug. This drew a roar from the Duke throng. It drew a different sort of roar from Louisville fans and the neutrals in the Barclays Center.

Pitino: “I felt early on in the play, he fended off with his arm, but I’m OK with that call. I’m not OK with Donovan Mitchell’s blocked shot and the fact that he got his other foul — and he didn’t foul him on either play. So that play I’ll live with, but you take your best player and put him to the bench on plays that I believe weren’t fouls.”

Then: “Referees play a huge factor in games. They really do. It’s not often talked about — sometimes it goes in your favor. A couple times this year it went in our favor, and of late it hasn’t. They can play a huge factor by putting your best players on the bench.”

Inside the final 25 seconds, Duke’s Tatum fumbled away an inbounds pass and re-opened the door for Louisville. The Cardinals’ final possession saw them try to run what Pitino called “a play we practice every day.”

To counter, Krzyzewski had his men — who’d switched to a zone defense because they couldn’t handle Louisville’s speed — revert to man-and-man and switch every screen. The upshot was a horrible shot by Quentin Snider, a 3-pointer that barely reached the rim.

“That was us not getting in the right spot,” Pitino said. “They give us a lot of effort and play with great heart, but mentally they’re just not where they need to be.”

Said Krzyzewski, speaking of Allen: “For me, energy produces energy. Grayson has played for three years — all-out. All-out. All-out. And we responded. And the people who didn’t want us to win, they responded. God bless everyone.

Then: “I love Grayson. I got his back all the time. Everyone in our program has his back.”

For its reward, his team gets to play a team based eight miles from its campus, a team to which it lost just Saturday. After this frantic quarterfinal, here’s Friday night’s first semi — Duke versus North Carolina. To borrow from the best in the business: Holy mackerel.