Author Archive: Paul Epps

Competitive Programming: POJ 2084 – Game of Connections

 

Description This is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, . . . , 2n – 1, 2n consecutively in clockwise order on the ground to form a circle, and then, to draw some straight line segments to connect them into number pairs. Every number must be connected to exactly one another. And, no two segments are allowed to intersect. It’s still a simple game, isn’t it? But after you’ve written down the 2n numbers, can you tell me in how many different ways can you connect the numbers into pairs? Life is harder, right? Input Each line of the input file will be a single positive number n, except the last line, which is a number -1. You may assume that 1 Read more →

Competitive Programming: USACO Big Barn

 

Farmer John wants to place a big square barn on his square farm. He hates to cut down trees on his farm and wants to find a location for his barn that enables him to build it only on land that is already clear of trees. For our purposes, his land is divided into N x N parcels. The input contains a list of parcels that contain trees. Your job is to determine and report the largest possible square barn that can be placed on his land without having to clear away trees. The barn sides must be parallel to the horizontal or vertical axis. EXAMPLE Consider the following grid of Farmer John’s land where ‘.’ represents a parcel with no trees and ‘#’ represents a parcel with trees: 1 2 3 4 5 6 7 8 1 . . . . . . . . 2 . # .… Read more →

Competitive Programming: POJ 1654 – Area

 

Description Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, …. In a subtree whose root node is X, we can get the minimum number in this subtree by repeating going down the left node until the last level, and we can also find the maximum number by going down the right node. Now you are given some queries as “What are the minimum and maximum numbers in the subtree whose root node is X?” Please try to find answers for the queries. Input In the input, the first line contains an integer N, which represents the number of queries. In the next N lines, each contains a number representing a subtree with root number X (1 Read more →

You Will Know Whether it Has All Been True

 

How does a life flash before one’s eyes At the end? How is there time for so much time? You pick up the book and hold it, knowing Long since the failed romance, the strained Marriage, the messenger, the mistake, Knowing it all at once, as if looking through A lighted dormer on the dark crest of a barn. You know who is inside, and who has always been At the other edge of the wood. She is waiting For no one in particular. It could be you. If you can discover which tree she has become, You will know whether it has all been true. — J.D. McClatchy, “Wolf’s Trees” Read more →

If liberty means anything at all it means the right to tell people what they do not want to hear. — George Orwell, Animal Farm

Competitive Programming: POJ 2242 – The Circumference of the Circle

 

Description To calculate the circumference of a circle seems to be an easy task – provided you know its diameter. But what if you don’t? You are given the cartesian coordinates of three non-collinear points in the plane. Your job is to calculate the circumference of the unique circle that intersects all three points. Input The input will contain one or more test cases. Each test case consists of one line containing six real numbers x1,y1,x2,y2,x3,y3, representing the coordinates of the three points. The diameter of the circle determined by the three points will never exceed a million. Input is terminated by end of file. Output For each test case, print one line containing one real number telling the circumference of the circle determined by the three points. The circumference is to be printed accurately rounded to two decimals. The value of pi is approximately 3.141592653589793. Sample Input 0.0 -0.5… Read more →

The More We Rely on Technology . . .

 

We had a brief network outage at the office, during which Mr. Frick walked over to Mr. Frack’s desk and said, “The network’s down. We can’t do the screen share,” i.e., they can’t see each other’s computer screen over the network because it’s down. I was waiting for one of them — Frick or Frack — to say “Let’s just sit together in front of the one computer here like they used to in olden days” but neither of them ever did . . . Read more →

Foot of Pride

 

Yeah, from the stage they’ll be tryin’ to get water outta rocks A whore will pass the hat, collect a hundred grand and say thanks They like to take all this money from sin, build big universities to study in Sing “Amazing Grace” all the way to the Swiss banks Well, there ain’t no goin’ back when your foot of pride come down Ain’t no goin’ back — Bob Dylan, “Foot of Pride” Read more →

Essay on the One Hand and the Other

 

Consider the palms. They are faces, eyes closed, their five spread fingers soft exclamations, sadness or surprise. They have smile lines, sorrow lines, like faces. Like faces, they are hard to read. Somehow the palms, though they have held my life piece by piece, seem young and pale. So much has touched them, nothing has remained. They are innocent, maybe, though they guess they have a darker side that they cannot grasp. The backs of my hands, indeed, are so different that sometimes I think they are not mine, shadowy from the sun, all bones and strain, but time on my hands, blood on my hands— for such things I have never blamed my hands. One hand writes. Sometimes it writes a reminder on the other hand, which knows it will never write, though it has learned, in secret, how to type. That is sad, perhaps, but the dominant hand… Read more →

Say One More Stupid Thing to Me

 

Sing me one more song, about you love me to the moon and the stranger And your fall by the sword love affair with Errol Flynn In these times of compassion when conformity’s in fashion Say one more stupid thing to me before the final nail is driven in. — Bob Dylan, “Foot of Pride” Read more →

Thomas Jefferson on Hillary Clinton

 

My fellow Americans — Hillary Clinton is still rattling off all the “reasons” she lost the 2016 presidential election: misogyny, the FBI, sexism, the NRA, Russia . . . To my knowledge, she has never correctly identified the actual culprits: the patriotic men and women of this country. Read more →

How You Should Think Of Me

 

A disciple came to Maruf Kharki and said: “I have been talking to people about you. Jews claim that you are a Jew; Christians revere you as one of their own saints; Muslims insist that you are the greatest of all Muslims.” Maruf answered: “This is what humanity says in Baghdad. When I was in Jerusalem, Jews said that I was a Christian, Muslims that I was a Jew, and Christians that I was a Muslim.” “What must we think of you, then?” the man said. “Some do not understand me and they revere me. Others do not either, so they revile me. That is what I have come to say. You should think of me as one who has said this.” — The Way of the Sufi Read more →

How to Tell if a . . .

 

I typed that into Google and here’s what autocomplete came back with: Guys want to know how to tell if a girl likes them. Girls also want to know if someone likes them, but not as much as they want to know if that egg is bad. Read more →

A Joke About Inequality

 

Igor and Boris are dirt-poor peasants in the Soviet Union (it’s an old joke), barely scratching enough crops from their small plots of land to feed their families. The only difference between them is that Boris owns a scrawny goat. One day a genie appears to Igor and grants him a wish. Igor says, “I wish that Boris’s goat should die.” Read more →

A Nest, a Haven and Calm Place

 

The low trolley on its cushiony rubber tyres luxuriously bore the corpse away down the middle of the ward. There was speed and secretiveness and deftness in its movement. Over the dead man’s face was a blanket, so that age, torture, ugliness and fear, all were hidden. Instead of looking on this covering, this careful manipulation as an hypocrisy and cheat, I saw it for what it really was, a desperate effort to make life bearable and sane. I admired the doctors and the nurses. I admired every human being in the world who, on top of a million, million horrors, yet built a nest, a haven and calm place. — Denton Welch, A Voice Through a Cloud Read more →

Overheard

 

“I thought that went out with zithers and tarot cards.” “I still use tarot cards.” “OK, I thought it went out with bread baking and Russian civilization . . . do you bake bread?” “I could bake bread.” Read more →

« Previous PageNext Page »