Chapter 126: It's on Me
My IQ Grows Every Year by Quiet Art (介安艺)
The smell of 84 disinfectant hung in the corridor and never quite went away, so that breathing always felt a little off.
The door of Room 215 stood ajar, opened a crack to let some air through.
Wang Dayong was crouched by the outlet next to the balcony door, eyes locked on the stainless-steel electric cup on the floor.
Its rim was already scorched black in places. The water inside had just come to the boil and was churning away, bouncing the flimsy lid so it rattled and clinked.
He held two seasoning packets from Lao Tan pickled cabbage noodles[1], still unopened. Dayong turned his head and glanced at Chen Zhuo, who sat at the desk.
Chen Zhuo was at his desk with his back to the balcony.
Open on the desk lay a heavy, large-format Russian book whose pages had gone slightly yellow.
The room was quiet. There was only the sound of water boiling in the electric cup and the faint rustle whenever Chen Zhuo turned a page.
He wasn't reading fast. He had read books in Russian before, but he still ran into vocabulary that was hard to make sense of.
When he hit a long sentence or an obscure technical term, his eyes would rest on it and his fingers would tap the desk twice out of habit.
Then he would open the dictionary beside him, follow the Russian alphabet, patiently track down the root, and run its exact meaning in a physics context through his head.
This Soviet-era edition of Landau's 《Course of Theoretical Physics》 was notorious in the physics world as a brutal read.
That wasn't only because the theory had a high barrier to entry. The author also had a habit that drove every beginner up the wall.
When this giant of physics wrote out a derivation, he often left out huge chunks of it.
One line would be a complicated partial differential equation, there would be a blank line, and the next line would simply say Очевидно in Russian ("obviously"), followed by a clean, tidy result.
Whenever Chen Zhuo saw that word, he felt a little helpless.
The great man wasn't just brilliant. He was also very good at saving on typesetting costs.
Other people might find "obviously" painful, or just skip past it. Chen Zhuo didn't.
If the author had skipped steps, then filling them back in was, for Chen Zhuo, an excellent way to amuse his mind.
He pulled a sheet of printer paper out of the clutter at the corner of the desk.
It was a sheet Chu Ge had wasted a couple of days ago while testing his printer. One side was crammed with C functions, and the other side was completely blank.
He picked up the black fountain pen beside him, pulled off the cap, and started deriving on the blank side.
He didn't pause once, and he didn't need scratch work.
He peeled the complicated manifold boundary conditions back layer by layer, and the algebraic matrices spread out across the page and locked together with a strongly symmetric kind of beauty.
It was like doing a rather enjoyable jigsaw puzzle.
After about half a page, he worked through the last mapping, and the algebraic expression he got matched the book's result exactly.
Chen Zhuo put down the pen, looked at the working on the page, and felt a surge of satisfaction.
He capped the fountain pen, set it aside, reached for his water cup, and took a sip.
The water had gone a little cold, but he didn't mind.
Just then, the door of Room 216 across the hall was yanked open.
Right after that came the rapid slap of slippers on the corridor floor, heading straight for 215.
The door of 215 was shoved most of the way open.
Chu Ge walked in with his hair clawed into a bird's nest.
He had dark rings under his eyes, his face was ashen, and his T-shirt was crumpled. He looked jittery and burned out, like someone who had just staggered out of an internet café after three days and nights.
With the door pushed open, the noise from Room 216 carried in clearly.
Two old self-built desktop towers were running at full load, and their case fans roared like a tractor going uphill.
Through the roar, you could also hear Lu Jia sighing over there.
"Brother Zhuo."
Chu Ge dropped into the empty chair next to Chen Zhuo, leaned back, tipped his head up at the ceiling, and let out a long sigh.
Chen Zhuo set down his water cup and turned to look at him.
"Stuck?"
Chen Zhuo asked it as if it went without saying. Nine times out of ten, that was why Chu Ge came to find him.
Wang Dayong, crouched by the balcony, turned too, holding up the seasoning packets he still hadn't opened.
"Boss Chu, this water's about to boil dry. Are we putting the noodles in or not? I went over to your room just now and Lu Jia wouldn't even talk to me, so I didn't dare ask how many packs he wants tonight."
Chu Ge rubbed his face hard, and his voice came out limp.
"Dayong, unplug it first. Stop boiling it." Chu Ge gave a bitter laugh. "Whether we even get to eat these noodles tonight is still up in the air."
Wang Dayong froze for a second, then hurried to pull the plug out of the wall.
Cut off from its heat source, the churning water slowly settled, leaving only a thin wisp of white steam rising.
"What happened this time?"
Chen Zhuo turned to face Chu Ge. While he was at it, he closed the Landau on his desk and pushed it aside to clear a little space to talk.
Chu Ge pointed toward 216 across the hall, his brows knotted tight.
"Infinite loop. It's completely locked up."
Chu Ge sighed.
"That pharmaceutical wholesaler in the city has been making a killing lately, right? Every big hospital, every township clinic and every pharmacy chain is after him every day for 84 disinfectant, masks and isatis root granules[2]. His old standalone Access inventory database just collapsed, so he got us to rewrite the whole thing on SQL Server."
The more Chu Ge talked, the more agitated he got. He fished a cigarette out of his pocket and was about to light it, then glanced at Chen Zhuo and shoved it back irritably.
"It was supposed to be simple stock in, stock out. Write a front end, hook it to the database, done. But the boss insisted on adding this insane allocation logic."
Chu Ge gestured as he talked.
"Supplies are short, so orders from city hospitals get absolute priority, then the big pharmacy chains, and only then the little clinics down in the counties. And he can't cut the small clinics off completely. There has to be a ten percent reserve set aside for them, split proportionally."
Chen Zhuo listened quietly to the end without interrupting.
"When Lu Jia wrote the allocation algorithm, he used nested loops."
Chu Ge rubbed his temples. His head was starting to hurt.
"If it's a hospital order, take path A: check stock, deduct. If it's a pharmacy, take path B: check stock, deduct proportionally. Logically there's nothing wrong with it."
Chu Ge paused, and his face turned grim.
"But it's due tonight, so Lu Jia and I dumped thirty thousand rows of mock data in for a stress test. Thirty thousand orders with different priority tags all crammed in at once, with Ifs and Elses nested five or six levels deep. The server has to loop through tens of thousands of orders in the background over and over, comparing and sorting."
"And then?" Chen Zhuo asked.
"Then CPU usage shoots straight to a hundred percent, memory fills up, the case fans spin so hard they're about to start smoking, and the system freezes."
Chu Ge leaned back in his chair.
"The algorithm's time complexity is way too high. Lu Jia and I spent the whole afternoon over there tweaking parameters, and no matter what we change it ends up in an infinite loop. The boss says he has to see it run tonight. If it can't handle thirty thousand concurrent orders, we lose the final payment, and that's ten-thousand-odd yuan."
When he finished, Chu Ge looked at Chen Zhuo hopefully.
"Brother Zhuo, you've got the brains and the math. Help me sort this out. Where's the bug in the underlying logic?"
Chen Zhuo sat in his chair with his eyes on the 《Landau》 on his desk and thought quietly for a few seconds.
He understood.
The trouble Chu Ge and Lu Jia had run into was that they were trying to walk the maze with the most direct, clumsiest method there was: brute-force trial and error.
With a small amount of data, checking each order's identity, lining it up and allocating it one by one was something a computer could keep up with.
But once the data grew exponentially, the nested loops turned into a black hole of computation.
In pure logical terms, it was isomorphic to the dead end he had hit earlier while reading the Princeton team's paper.
Demian's team had tried to cross the singularity with continuous spacetime calculus and ended up with divergence. Chu Ge and his partner had tried to handle a huge mass of overlapping orders with linear conditional checks and ended up with a memory overflow.
Chen Zhuo nodded.
"Your approach was off from the start."
Chen Zhuo's tone was even.
Chu Ge froze with his mouth half open.
"Off? Allocating by conditional checks, isn't that the safest way to do it, straight out of the programming books?"
Chen Zhuo didn't hurry to explain.
He reached over and picked up the scratch sheet covered in his physics derivation.
He glanced at the dense working on it, the piece of Landau he had just filled in, then flipped the sheet over as if it were nothing, showing the side printed with discarded C code.
The lines of code were widely spaced, with plenty of blank room between them.
In a blank spot, he touched the fountain pen down lightly and left a black dot of ink.
"You're treating these orders like people lining up to buy tickets."
Chen Zhuo talked as he drew.
"The line got too long, so you set up three different lanes at the ticket gate. Every time someone comes up, you have to ask them: where are you from? Only then do you decide which lane they go in. With enough people, the gate gets completely jammed."
Chu Ge leaned in a bit, staring at the black dot under Chen Zhuo's pen tip.
"So how do you allocate without a line?" Chu Ge asked.
Next to that black dot, Chen Zhuo drew several more, spaced far apart, and connected them with straight lines.
"Treat each one as an independent state node."
Chen Zhuo turned his wrist slightly and drew a bipartite graph on the paper, not the tree of branches Chu Ge had described.
"Drop the linear-traversal mindset. Abstract the hospitals, pharmacies and clinics directly into algebraic points with different weights, and abstract the supplies currently in stock into a set too."
In the blank space on the paper, Chen Zhuo quickly wrote down a few basic variables from discrete mathematics and plugged them into a minimal matrix-mapping formula.
"In this discrete matrix you don't need to ask 'if.' An order comes in carrying its own weight: hospitals are 3, pharmacies are 2, clinics are 1. Multiply the order matrix against the inventory matrix as a mapping, and the higher weights get matched to inventory nodes first, automatically."
Chen Zhuo added one more stroke at the end of the formula.
"When an inventory node hits zero, it drops out of the matrix, and every mapping after that skips it automatically. All the checks happen in a single matrix operation instead of tens of thousands of passes through nested loops."
After writing the last line, Chen Zhuo pushed the scratch sheet in front of Chu Ge.
Chu Ge stared down at the clean matrix structure on the paper while his brain rapidly translated the math symbols into the database language he knew.
Chu Ge's math wasn't as strong as Chen Zhuo's and the others', but he had made it into a place like the USTC Gifted Youth Class after all, and his grasp of logic was still more or less first-rate.
He studied it for about half a minute.
"Holy shit…"
Chu Ge's head snapped up. The worn-out look in his eyes was gone, replaced by the light of sudden understanding.
"A hash-table mapping with weighted sorting…" Chu Ge looked at Chen Zhuo.
"Turn every conditional check into a key-value weight up front, then do a straight set mapping. That way the server doesn't have to compare orders one by one at all. It just does one algebraic operation over the whole thing!"
"Mm."
Chen Zhuo put down the fountain pen.
"That cuts the computation by at least a few orders of magnitude. Throw as much mock data at it as you like, and all that happens is the matrix gets a bit bigger. The CPU won't max out."
Chu Ge snatched the scratch sheet off the desk like a lifesaving check.
He didn't even glance at what was on the back. He just stood up.
"Dayong, keep the water hot, don't dump it!" Chu Ge yelled at the corner, his voice cracking. "We're saved tonight!"
With that, Chu Ge took the double-sided sheet and charged out of Room 215 without looking back.
He tore across the hall, and the next sound was the door of 216 being kicked open.
"Lu Jia! Quit banging your head against those nested loops! Come look at this discrete matrix Brother Zhuo drew! We're restructuring the logic!"
Chu Ge's booming voice echoed around the room across the hall.
Room 215 went quiet again.
Wang Dayong briskly plugged the electric cup back into the wall socket. The water hadn't cooled all the way, and before long fine bubbles were rising again and the lid had started clinking once more.
Chen Zhuo sat in his chair and reached up to rub the back of his neck.
He had been reading with his head down for a long time, and his shoulders really were a bit sore.
"Brother Zhuo."
Dayong, still crouched on the floor, looked up at him with a simple, honest grin.
"You're really something. When Boss Chu came in his face was gray, and when he left it was red."
Chen Zhuo smiled and didn't answer.
He turned back around, opened the heavy Russian 《Landau》 again, and let his eyes settle back on the page he had bookmarked.
From Room 216 across the hall came Lu Jia's voice, somewhat held back but very fast.
After that came a burst of typing, harder and denser than before.
Clackety-clack, like a driving rain pelting the keyboard. The pauses and irritation from earlier were gone, and it was just smooth, steady execution all the way through.
Chen Zhuo paid no attention to the noise across the hall. He didn't even turn his head.
He knew that once the knot in the underlying logic was undone, the coding left for Chu Ge was pure grunt work, and nothing he needed to worry about.
He lowered his head and went on reading a long theoretical passage on thermodynamics in the Russian book.
When he came across a slightly awkward sentence, he opened the 《Russian-Chinese Dictionary》 beside him again and looked it up quickly in alphabetical order, absorbed in Landau's world of thought.
Outside the window, the sky was slowly getting dark.
It was an April evening in Huizhou, and the fresh new leaves on the old trees swayed gently in the evening breeze.
Right on time, the campus loudspeakers came on, carrying a news announcer's crisp, standard voice as it read out the day's numbers of new suspected and confirmed cases across the country and reminded students to open their windows for ventilation and wash their hands often.
Every day of the campus lockdown followed the same monotonous, slightly oppressive routine.
The gates were locked, the canteen dishes rotated through the same few options, and everyone was stuck on a campus a few square kilometers in size.
Still, this bit of homey cooking smell and the sound of typing in the dorm took a good deal of the edge off the gloom.
The water in the electric cup was at a full boil now. Dayong tore open the two packs of Lao Tan pickled cabbage noodles, snapped the hard noodle cakes in half, and tossed them into the bubbling water.
Chen Zhuo sniffed.
His brain had been running hard all afternoon on theoretical physics, and at the smell of instant noodles his stomach gave an honest, protesting growl.
"Dayong."
Chen Zhuo kept his eyes on the page and asked offhandedly.
"So how many packs are we cooking tonight?"
Dayong took a clean pair of disposable chopsticks and stirred the noodles in the pot.
"No idea. Boss Chu hasn't said yet."
Dayong swallowed, his eyes fixed on the noodles.
"But the way he looked just now, I think the job's gonna work out. If the final payment comes through, a pack or two won't matter, right? Worst case, I'll share some of mine."
Dayong had barely finished speaking.
Then a stifled roar burst out of Room 216 across the hall.
"It runs!"
It was Lu Jia. Normally he hardly said a word, and his voice cracked badly on the shout, full of the release of a huge weight coming off.
Right after that came Chu Ge's unrestrained laughter, a little unhinged.
"Hahaha! Thirty thousand rows concurrent, and the server didn't even throw a warning! Memory's holding steady at fifteen percent! This curve is as steady as an EKG!"
Chu Ge was hollering over there.
"Lu Jia, save the recording! Send it to the boss's email right now! The money's in the bag tonight!"
Listening to the celebration carrying over from across the hall, Chen Zhuo paused with the fountain pen in midair.
The corners of his mouth turned up slightly. He capped the pen and closed the Russian edition of 《Landau》.
Slippers came pounding down the corridor again.
Chu Ge burst into Room 215. The dark circles under his eyes seemed to have faded a good deal, and he was giving off the wired high of someone who had pulled an all-nighter on a big project and come out alive.
He was still clutching the scratch sheet Chen Zhuo had given him, covered in formulas on both sides.
"Brother Zhuo!"
Chu Ge planted both hands on Chen Zhuo's desk, panting hard.
"Brother Zhuo, you're a fucking legend! The second we added your discrete matrix, the system ran smoother than Dove chocolate[3]. The final payment's safe!"
"Good that it's safe."
Chen Zhuo nodded, sounding a little relaxed.
To him it was simply the natural outcome: get the math logic right, and the result comes out right on its own.
It was no different, in any essential way, from checking that great man's derivation on the other side of the sheet a little earlier.
Chu Ge turned to Dayong, crouched by the balcony, then looked at the noodles going soft in the bubbling electric cup.
"Dayong, how're the noodles coming?"
Chu Ge gave a grand wave of his hand, full of swagger.
"We've got tonight sorted. Once the boss signs off and sends the final payment, tomorrow I'm getting you guys something good from the campus supermarket. It's all on me! I'm paying!"
[1] Lao Tan pickled cabbage noodles (老坛酸菜面): a hugely popular instant-noodle flavor from Chinese brands such as Master Kong and Uni-President, and a dorm-room staple.
[2] Isatis root (板蓝根, banlangen): a traditional Chinese herbal remedy sold as instant granules. People bought it in a panic during the 2003 SARS outbreak, believing it warded off viral infection.
[3] Dove chocolate (德芙): Mars's chocolate brand in China. Its famous ad slogan, 纵享丝滑 ('indulge in silky smoothness'), made 'smoother than Dove' a popular catchphrase for anything that runs smoothly.