The Return of the Legendary Programmer – Chapter 6: Five Problems

Prev6 / 65Next

Chapter 6: Five Problems

The contest hall smelled like fear and vending machine coffee.

Eighty-eight terminals arranged in long rows, each separated by thin dividers that provided the illusion of privacy without actually offering any. The room was the SNU Engineering Building’s largest computer lab, commandeered for the day and outfitted with contest-standard setups: identical machines, identical monitors, identical keyboards. No internet access. No personal devices. Just you, the code, and three hours of clock.

Dojun arrived at 8:30 AM, half an hour before the start. He had eaten breakfast—real breakfast, as promised: rice, fried egg, and the last of his mother’s kimchi. He had slept poorly, not from anxiety about the problems but from the decision that had kept him turning all night.

Four problems or five.

The hall was already half-full. Students milled around their assigned terminals, stretching, cracking knuckles, performing the pre-competition rituals that competitive programmers developed like athletes. One kid was doing push-ups between the terminal rows. Another was solving a Rubik’s cube with mechanical speed, eyes unfocused.

Dojun found his assigned seat: Terminal 34, middle row. He was adjusting the chair when a familiar voice ambushed him from behind.

“DOJUN!” Minjae materialized out of the crowd, grinning like a man who had bet on the right horse. “I can’t believe you’re actually here. I told the guys from our study group and they thought I was lying.”

“You have a study group?”

“Had. They all quit after the midterm. But the point is, I talked you up. ‘My project partner is competing,’ I said. ‘The guy who made Kim Taesik sit down.’ Now I need you to not embarrass me.”

“No pressure, then.”

“Zero pressure. Just the weight of my entire social reputation.” He glanced at the scoreboard screen. “Hey, is that—Jang Seokho? From KAIST? The actual Jang Seokho?”

“You know him?”

“Every CS student in Korea knows him. He’s won this thing twice. There’s a thread on the programming forum calling him the ‘Final Boss of Korean CompSci.'” Minjae lowered his voice. “They say he once solved an ACM regional problem while eating a convenience store kimbap. Didn’t even put the kimbap down.”

“That’s… either impressive or disgusting.”

“Both. Definitely both.” Minjae clapped him on the shoulder. “Okay, I’m going to the audience section. Hana’s coming too—she texted me that she wants to ‘observe the enemy.'”

“The enemy?”

“Her words, not mine. She takes project partnerships very seriously. If you’re her CS partner, your victories are her victories.” He started backing away. “Go destroy them! Or at least solve more problems than the average person! Either way, I’m proud!”

He disappeared into the crowd. Dojun sat down and tested the keyboard. The keys were stiff but responsive. The monitor was a 17-inch CRT, humming faintly. The development environment was a standard setup—GCC compiler, Java JDK, a plain text editor. No IDE. No autocomplete. Just raw code and a blinking cursor.

He felt at home.

Three rows ahead and two columns over, Jang Seokho was settling into Terminal 12. He was wearing the same KAIST hoodie from yesterday, and he moved with the calm efficiency of someone who had done this many times before.

Their eyes met briefly. Seokho gave a short nod—neither friendly nor unfriendly. An acknowledgment between competitors.

Dojun nodded back.

A student in the next seat—a nervous-looking junior with dark circles under his eyes—leaned over. “Hey. Is it true you’re the guy who stumped Kim Taesik?”

“I didn’t stump him. I just answered a question.”

“My friend says you described architecture that hasn’t been published yet.”

“Your friend exaggerates.”

“My friend is in Kim Taesik’s research lab. Jinwoo? He says you’re scary smart.”

“Jinwoo says everyone is either smart or expendable. I wouldn’t take it as a compliment.”

The junior laughed nervously. “Well, good luck. I’m hoping to solve two problems. Maybe three if there’s a miracle.”

“You’ll do fine,” Dojun said. “Read each problem twice before you start coding. Most mistakes happen because people rush.”

“Thanks. That’s… actually really good advice.”

“My professor told me that.” He hadn’t. Dojun had told himself that, after forty years of watching junior developers make the same mistake.

At 8:50, the contest organizer—a graduate student with a clipboard and the haggard look of someone who had been setting up since 5 AM—stood at the front of the hall.

“Welcome to the 2006 Spring SNU Coding Contest. You have three hours to solve five problems. Solutions are submitted through the contest system and auto-graded. Scoring is based on number of problems solved, with ties broken by total time. You may use C, C++, or Java. No internet, no external resources, no communication with other participants.” He glanced at his clipboard. “Questions?”

Silence.

“Good. Problems will appear on your screens at 9:00 AM sharp. Good luck.”

Dojun stared at the blank screen. Nine minutes.

Around him, the hall settled into a tense quiet. The only sounds were the hum of monitors, the occasional nervous cough, and the soft tapping of someone testing their keyboard.

He thought about his mother’s words: Win or lose, call me after.

He thought about Hana’s text: Destroy them.

He thought about Seokho’s challenge: Don’t hold back.

He thought about Professor Kim’s warning: Talent without context raises questions.

Four voices. Three saying go. One saying stop.

9:00 AM. The screens flickered. Five problems appeared.


Problem A: Array Rotation

Given an array of N integers, rotate it K positions to the right. Output the resulting array. Constraints: N up to 100,000, K up to 1,000,000.

Trivial. Dojun read it once and began typing. The naive approach—shifting elements one by one—would be too slow for the upper constraints. The optimal solution used a three-step reversal: reverse the entire array, reverse the first K elements, reverse the remaining elements. O(N) time, O(1) space.

His fingers moved across the keyboard with a rhythm that felt like breathing. The code emerged clean and complete—variable names clear, logic tight, no wasted lines. He submitted at 9:07.

Accepted. 7 minutes.

He glanced at the scoreboard displayed on the wall monitor. Two names already had Problem A solved: Seokho at 4 minutes, and a POSTECH student at 6 minutes. Dojun was third.

Third was fine. He had deliberately not rushed. Seven minutes for Problem A was fast for a sophomore, slow for a prodigy.

Problem B: Shortest Path in a Weighted Graph

Given a directed graph with N nodes and M edges, find the shortest path from node 1 to node N. If no path exists, output -1. Constraints: N up to 10,000, M up to 50,000.

Dijkstra’s algorithm. The same algorithm he had discussed with Hana three days ago, the same one Dr. Yoon had lectured about last week. A strange symmetry.

He implemented it with a min-heap priority queue, handling edge cases for disconnected graphs and self-loops. The code was twenty-three lines of C++, compact and efficient. He added a deliberate inefficiency—using an adjacency matrix instead of an adjacency list—that would cost him a few milliseconds in runtime but was a choice a sophomore would plausibly make.

Submitted at 9:26. Accepted. 26 minutes.

Scoreboard: Seokho had solved B at 15 minutes. The gap was widening.

He’s fast, Dojun thought. Not just fast—efficient. Seokho coded the way a surgeon operated: no wasted motion, every keystroke purposeful. At twenty-one, he was already one of the best competitive programmers in the country. At fifty, he would be one of the best system architects in the world.

Problem C: Longest Increasing Subsequence with Constraints

Given a sequence of N integers, find the longest strictly increasing subsequence such that the difference between consecutive elements is at most K. Constraints: N up to 100,000, K up to 1,000,000.

Dynamic programming. The classic LIS problem with an added constraint that changed the optimal approach. A naive O(N²) solution would time out. The optimal approach used a segment tree or binary indexed tree to achieve O(N log N).

Dojun paused. This was where the performance needed to look genuine. A sophomore would struggle with the segment tree approach. Most would try the O(N²) solution first, get a Time Limit Exceeded, and then optimize.

So that’s what he did. He wrote the O(N²) solution first—clean, correct, but deliberately slow. Submitted it. TLE on the larger test cases, as expected.

Then he “thought” about it. Stared at the screen for three minutes, chin on his hand, performing the body language of problem-solving. In reality, he was thinking about whether to add garlic or ginger to the kimchi fried rice he was planning to make for dinner.

After his theatrical pause, he rewrote the solution using a binary indexed tree. Submitted at 9:58. Accepted. 58 minutes.

Scoreboard: Seokho had solved C at 38 minutes. Twenty minutes ahead.

Three problems down. Two to go. Two hours remaining.

The hall was quieter now. The initial burst of keyboard activity had settled into a more sporadic rhythm—concentrated typing followed by long silences as contestants struggled with harder problems. Several people had already given up on Problems D and E and were re-checking their earlier solutions.

Problem D: Minimum Cost Maximum Flow

Wait. Dojun re-read the problem statement.

This wasn’t what he expected. Problem D was supposed to be the second-hardest problem—typically a difficult but solvable challenge for strong competitors. But the problem on his screen was a minimum cost maximum flow problem, which was usually reserved for Problem E-level difficulty.

He scrolled to Problem E.

Problem E: Compiler Optimization

Given a set of code blocks with dependencies, determine the optimal execution order that minimizes total register usage while satisfying all dependency constraints. This is equivalent to a modified topological sort with resource constraints.

Dojun stared at Problem E. His heart rate quickened—not from difficulty, but from recognition.

This problem was a simplified version of a register allocation challenge that he had worked on at Prometheus Labs in 2018. He had spent three months developing the algorithm that solved it optimally, and it had become one of the company’s most cited patents.

The contest organizers had put his own future work on the exam.

The universe, it seemed, had a sense of humor.

He looked back at Problem D. Minimum cost maximum flow. A standard algorithm—Bellman-Ford combined with augmenting paths—but implementation-heavy and error-prone. Even experienced competitors often spent an hour on it and got it wrong.

Two hard problems. Two hours left.

He glanced at the scoreboard. Seokho had not yet submitted D or E. Nobody had. The entire contest hall was stuck on the final two problems.

Four or five, the question echoed again.

Dojun took a deep breath, flexed his fingers, and began typing Problem D.

The minimum cost maximum flow implementation required careful attention to detail. He built it methodically—the graph structure first, then the Bellman-Ford shortest path subroutine, then the augmenting path logic, then the cost tracking. Each component tested mentally before integration.

He could have written it in fifteen minutes. He took forty.

Submitted at 10:42. Accepted. 102 minutes.

He checked the scoreboard. Seokho had submitted D at 10:35—seven minutes before him. Also accepted.

Four problems each. Seokho ahead on time. One problem remaining.

Problem E. The compiler optimization problem. The problem that was, in a very real sense, his own.

One hour and eighteen minutes left.


Dojun stared at Problem E on his screen, and the problem stared back.

The register allocation challenge was deceptively simple in its statement but fiendish in its solution. The key insight—the one that had taken his Prometheus Labs team three months to find—was that the dependency graph could be decomposed into interference intervals, and the optimal allocation was equivalent to a graph coloring problem on the interval graph.

He knew the solution. He had invented the solution. It was elegant, efficient, and completely beyond anything a twenty-year-old sophomore should know.

Around him, the hall was silent except for the frantic typing of the few remaining competitors still working. Most had submitted their final solutions and were sitting back, done. A few were staring at Problem E with the glazed expression of people who had accepted defeat.

Dojun looked at Seokho’s terminal, three rows ahead. Seokho was typing. Steady, focused, fast. He was attempting Problem E.

Of course he is, Dojun thought. He doesn’t know the word quit.

If Seokho solved E, he would win with five problems. If Dojun stopped at four, he would finish second. Safe. Credible. A sophomore’s remarkable but believable performance.

But if Dojun also solved E…

Two contestants solving all five problems. The tie broken by time. Seokho had been faster on every problem so far. Even if Dojun solved E, Seokho would likely still win on time.

Unless Dojun solved it fast.

He closed his eyes. In the darkness behind his eyelids, he saw the solution laid out like a blueprint—the interval decomposition, the greedy coloring algorithm, the optimization pass. He could write it in twelve minutes. Fifteen, if he was careful.

Solving Problem E in fifteen minutes would be extraordinary. Not for a Prometheus Labs engineer, but for a sophomore at SNU? It would be the single most impressive competitive programming performance in the history of this contest.

And it would be inexplicable.

Talent without context raises questions.

Don’t edit yourself.

Don’t hold back.

Win or lose, call me after.

Dojun opened his eyes. He placed his fingers on the keyboard.

And then he did something that surprised even himself.

He didn’t write the optimal solution. The Prometheus Labs solution, the one that would have been clean and fast and utterly suspicious.

Instead, he wrote a different solution. A brute-force approach with intelligent pruning—conceptually simpler, easier to explain, and something a brilliant sophomore might plausibly derive under contest pressure. It wasn’t as elegant. It wasn’t as efficient. But it would pass within the time limits, and it would tell a story that made sense.

A story of a talented kid who didn’t know the elegant answer but was clever enough to find an ugly one that worked.

The code poured out of him—not the fluid, practiced flow of his optimal solution, but something rougher, more desperate, more real. He built the brute-force search tree, added pruning conditions, optimized the memory usage with a trick that looked improvised rather than planned. He added comments that a stressed student would write: “// this might be too slow” and “// hack: reuse the buffer to save memory.”

He tested it mentally. It would work. Not fast enough for production, but fast enough for contest constraints.

His finger hovered over the submit button. The clock read 11:24 AM. He had been working on Problem E for forty-two minutes.

Before he could submit, a murmur rippled through the hall. He glanced at the wall scoreboard.

Jang Seokho — Problem E — Accepted. Time: 11:18 AM.

Seokho had solved it. Six minutes ago. Five problems, all accepted.

Dojun looked across the rows. Seokho was leaning back in his chair, arms crossed, staring at the ceiling with the quiet satisfaction of a job completed. Then, as if sensing the attention, he turned and looked directly at Dojun.

Their eyes locked. Seokho’s gaze dropped to Dojun’s screen—he couldn’t read the code at this distance, but he could see that Dojun was still working on E. Still fighting.

Seokho’s expression shifted. A slight raise of the eyebrows. Not mockery. Interest. You’re still going?

Dojun pressed submit.

The screen loaded. The auto-grader ran the test cases. Each passed status appeared like a heartbeat: Test 1: Accepted. Test 2: Accepted. Test 3: Accepted…

Fifteen test cases. All accepted.

Problem E — Accepted. Time: 11:24 AM.

Five problems. All five. Solved.

The scoreboard updated. Two names at the top, both with five problems solved:

1st: Jang Seokho, KAIST — 5 problems, 138 minutes total
2nd: Park Dojun, SNU — 5 problems, 144 minutes total

Six minutes apart.

The hall erupted in whispers. Dojun could hear fragments: “Who’s Park Dojun?” “A sophomore?” “He solved all five?” “Nobody solves all five except Seokho.”

Dojun sat back in his chair and let out a breath he felt like he’d been holding for forty years.


The awards ceremony was brief and anticlimactic, as university ceremonies always were. The contest organizer handed out certificates and envelopes. Seokho received first place and five hundred thousand won. Dojun received second place and three hundred thousand won.

They shook hands on stage—a quick, firm handshake in front of a small audience of contestants, a few professors, and a photographer from the university newspaper.

“Six minutes,” Seokho said quietly, so only Dojun could hear. “That’s the closest anyone’s come in three years.”

“You were faster on every problem.”

“But you solved E. Nobody solves E.” His eyes were sharp with that analytical intensity. “Your approach on E was interesting. Brute force with pruning. It’s not how I would have done it.”

“How did you do it?”

“Graph coloring on the interference intervals. It’s a known technique in compiler theory.” Seokho paused. “But your approach was more interesting, honestly. Brute force with pruning shouldn’t have worked within the time limit. You must have found some very specific cuts.”

“I got lucky with the pruning conditions.”

“Luck.” Seokho smiled—a thin, skeptical smile. “You keep saying that word. I don’t think you know what it means.” He released Dojun’s hand but didn’t move away. “Let me buy you a coffee. I want to talk about your Problem D implementation. Your Bellman-Ford was different from standard. You used a SPFA variant that I’ve only seen in Chinese competitive programming circles.”

“I… read a lot of international resources.”

“There it is again. ‘I read a lot.’ The Park Dojun catchphrase.” Seokho crossed his arms. “I’ve competed against programmers from thirty countries, Park. I’ve met prodigies who were solving IMO problems at twelve. None of them had your particular combination of breadth and… restraint. You code like someone who’s choosing not to show everything he knows.”

The observation was so precise that Dojun felt his stomach drop.

“That’s a strange thing to say to someone you just beat by six minutes.”

“I beat you on time. I’m not sure I beat you on ability. And that distinction keeps me up at night.” Seokho uncrossed his arms. “Coffee?”

“Rain check. I need to call my mother.”

“Your mother?”

“She made me promise.”

Something shifted in Seokho’s expression—a flicker of surprise, followed by something softer. “My mother doesn’t know what I do. She thinks ‘coding contest’ is a video game tournament.”

“Mine thinks it’s ‘playing with computers.’ Same difference.”

Seokho laughed. It was the first genuine, unguarded sound Dojun had heard from him—brief but real. “Rain check, then. But I’m holding you to it.” He pulled out a flip phone and typed something. “My number. Next time there’s a contest, I want to prepare with someone who actually makes me work.”

Dojun’s phone buzzed with the contact.

“Park Dojun,” Seokho said, walking away. “The sophomore who doesn’t make sense. I’ll figure you out eventually.”

“Good luck with that.”

“I don’t need luck. I need data.” He waved without turning around. “And you just gave me a lot of it.”

They stepped off the stage. The photographer snapped a few more pictures. The audience dispersed. Contest over.

Outside the engineering building, the March afternoon was bright and cold. Cherry blossoms were beginning to bloom—pale pink against blue sky, impossibly delicate. Students crossed the campus in scarves and jackets, breath making small clouds in the air.

Dojun stood on the steps, holding his certificate and his envelope of three hundred thousand won, feeling simultaneously triumphant and terrified.

He had solved all five problems. He had come within six minutes of beating the two-time national champion. He had done it with a deliberately suboptimal approach, and still placed second.

By tomorrow, every CS student at SNU would know his name. By next week, competitive programming circles nationwide would be talking about the unknown sophomore who had pushed Jang Seokho to the wire.

His phone buzzed. A text from Hana:

Minjae says you placed SECOND out of 88 people?? And solved all 5 problems?? Park Dojun!! Who ARE you??

He typed back: Lucky, mostly.

Lucky people don’t solve 5 out of 5. That’s not luck, that’s terrifying. Congratulations!! 🎉

His phone buzzed again. A text from Minjae:

Bro. BRO. You beat everyone except the KAIST legend. I’m telling everyone I know. My group project partner is a genius.

And another buzz. Professor Kim Taesik, via email—a rarity, since Kim preferred face-to-face communication and considered email “the coward’s medium”:

Park — I saw the contest results. Come to my office tomorrow at 10 AM. We need to talk. — Kim T.

That last message didn’t feel like a congratulation. It felt like a summons.

Talent without context raises questions.

Dojun pocketed his phone and looked at the cherry blossoms. A petal drifted down and landed on his certificate, perfectly centered, like punctuation.

He pulled out his flip phone and dialed his mother’s number.

“Dojun-ah? How was it?”

“I came in second, Mom. Out of eighty-eight people.”

“Second? Who was first?”

“A senior from KAIST. He’s been winning this contest for three years.”

“And you almost beat him? As a sophomore?”

“Six minutes behind.”

A silence. Then, very softly: “Your grandmother would have been so proud.”

Dojun closed his eyes. The cherry petals fell around him like quiet applause.

“I won three hundred thousand won,” he said.

“THREE HUNDRED THOUSAND?” Her volume tripled. Several passing students turned to look at him. “Won? Real money? Not computer money?”

“Real money, Mom. Cash in an envelope.”

“For playing with computers!”

“For playing with computers.”

“Save it. Don’t spend it on nonsense. And come visit Saturday—I’ll make your favorite. Galbitang. To celebrate.” She paused. “Dojun-ah?”

“Yeah?”

“I don’t understand what you do with those computers. I probably never will. But I’m proud of you. Very proud.”

He stood on the steps of the engineering building, three hundred thousand won in his pocket, cherry blossoms in his hair, his mother’s pride in his ear, and thought: This. This is what I missed the first time. Not the money. Not the ranking. This.

“Thanks, Mom. I’ll see you Saturday.”

“Bring the money. I want to see it.”

“I’m not giving you the money, Mom.”

“I don’t want the money! I want to see it. There’s a difference.”

He laughed, said goodbye, and hung up.

The campus stretched before him—old buildings and new, bare trees and blooming ones, paths worn smooth by a million student footsteps. Somewhere in Daejeon, Seokho was probably already analyzing his contest performance, identifying the six minutes of weakness, planning how to be faster next time.

And tomorrow morning, Professor Kim Taesik would be waiting in his office with sharp eyes and sharper questions.

Dojun pocketed the prize money, brushed the cherry blossom petal off his certificate, and started walking.

The first act was over. He had shown his hand—not all of it, but enough. From this point forward, the quiet anonymity he had been hiding behind would be harder to maintain. People knew his name now. People were paying attention.

The real game was just beginning.

6 / 65

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top