It started with stars.
At the 2017 Association for Computing Machinery (ACM) Mid-Atlantic Regional Programming Contest, participants were asked to write code to reorganize the stars on the U.S. flag to make the pattern visually appealing if more states, like Puerto Rico, were added to the Union. That was the first of eight coding challenges competitors confronted on November 11 at Duke, as they competed for chance to attend the ACM International Programming Contest in Beijing, China in April 2018.
Duke was one of eight sites to host the mid-Atlantic regional competition, which includes southern New Jersey, eastern Pennsylvania, Delaware, Maryland, the District of Columbia, Virginia, and North Carolina. UPENN RED won the event, solving five of the eight problems. Virginia Tech’s Evil Sort took second and University of Maryland’s Black took third, both solving four problems. Duke’s team, Wing, came in fourth, solving three problems.
“People like to compete,” says CS professor Owen Astrachan, who has helped coached teams participating in the contest in the past and participated when he was a graduate student at Duke. “In this contest, students stretch their limits. They have fun developing algorithms and programs, just as our basketball players have fun out on the court.”
CS professor Susan Rodger, who helped to run the regional contest at Duke, says the competition teaches valuable skills, including perseverance and teamwork. Participants have to think about pacing as they solve the eight problems; they have to be persistent as they debug their programs. Not everything is about solving the problems as fast as possible. There’s a balance between solving the problems, testing the code and then debugging it before hitting submit, she says.
Wing learned just that as the team, comprised of freshmen Charles Lyu, Yunhao Qing and Yikai Wu, worked its way through the eighth problem called “Haiku Formatting”. The instructions, which described how to take a block of text and generate a poem, were very detailed and gave several rules to follow, such as defining what counts as a vowel and consonant in an English word, and how to count the number of syllables in the word.
“It was really a pain in the neck to code, but what’s more frustrating was seeing a red ‘Wrong Answer’ sign after our first submission,” Lyu says. “I was so impatient at that point of time that, after finding and fixing a small bug in my code, I almost went on to submit again, which, if I did, would give us a 20-minute penalty because the answer was still wrong.”
Lyu, however, didn’t hit submit right away. Instead, he went back again to check the code thoroughly, writing a few sample inputs and testing them. He discovered a few more minor errors, and successfully solved the problem upon second submission.
“I think the moral of this story is to always remain calm and patient throughout the contest, or anything in life,” he says.
Patience is critical, Rodger explains. The competition is an all-day event. Competitors come to Duke (or one of the other seven campuses where the mid-Atlantic regional competition is being held) early on a Saturday morning, eat breakfast and then do a practice problem. They take a break for lunch, and then start the actual competition. Each team, comprised of three competitors using one computer, has five hours to solve the eight problems designed for the competition.
“One important learning point from this competition is teamwork. Unlike competitions in the past, where I had to solve all problems on my own, we now work in a team of three,” Lyu says. The team atmosphere demands a lot of thought: How do you divide the problem set in order to conquer them effectively and efficiently? How do you allocate time for coding and thinking of algorithms among the team, since only one computer is available? How can you develop a tangible plan for team practices before the contest, and make sure everyone shows up?
“I am sure these experiences will help me a lot in many team-based courses and other activities in future,” he says.
It was a challenging day for the Duke team, according to Lyu, Qing and Wu. The three say they got really close to solving four other problems, along with the three they answered correctly. “If we were able to solve two of them, or even one of them in time, we would have gotten the second place and qualified for world finals,” Lyu says. “So immediately after the contest, all of us were really frustrated because we had a chance right in front of us and we couldn’t catch it.”
Wu says the experience was frustrating but still “truly memorable, as we constantly found that there was hope to solve the problems during the competition which propelled us to work hard and never give up until the end of the competition.”
The contest, Qing adds, taught her a valuable lesson: how to deal with failure. The three plan to participate in the regional competition again next year. It will be held at Duke in the fall of 2018.