Hello, World! (Harder)
View as PDF found the problem Hello, World! to be very nice. He also found the problem Hello, World! (Hard) to be even nicer. So nice, he asks you to output Hello, World! followed by a newline character \n in Python 3 while satisfying all of the following constraints:
- Your code must consist only of whitespace and the following characters:
()._abcdefghijklmnopqrstuvwxyz - All builtin functions are deleted. Notably, this includes
printand__import__. - All initialized variables in the global scope, such as
__file__,__name__, etc. are deleted. - For full marks, you must minimize the length of your program. Refer to the Scoring section below for more information.
The code which deletes all builtin functions and global variables is provided in the Sandbox section below (Credits to ).
After you've gotten the hang of submitting, try out an easier problem like Loop Town.
Input Specification
There is no input.
Output Specification
Output Hello, World!, followed by a newline character \n. The checker is byte identical, so your output must match exactly.
Scoring
If your code contains any characters which are not whitespace and are not in the set ()._abcdefghijklmnopqrstuvwxyz, you will receive marks and a Wrong Answer verdict.
If your code does not output Hello, World!, followed by a newline character \n, you will receive marks and a Wrong Answer verdict.
Otherwise, you will receive an Accepted Verdict and your score will be based on the length of your program.
Let be the length of your program in bytes. Let
be the current known optimum. Your score will be calculated as
In particular, you will receive at least marks for any solution which correctly outputs
Hello, World! followed by a newline character \n under the given constraints. Your program must have a length less than or equal to bytes for a full
marks.
Currently, , found by in collaboration with .
History of known optimum
The following graph shows the known optimum over time. The name of a user appears the first time they improve the known optimum.
Sandbox
Credits:
class Sandbox(object):
def __init__(self):
import sys
for attr in ["__file__","__loader__","__name__","__doc__","__package__","__annotations__","__spec__","__cached__"]:
if hasattr(sys.modules["__main__"],attr):
delattr(sys.modules["__main__"],attr)
if hasattr(sys.modules["__main__"].__dict__["__builtins__"],"__dict__"):
original_builtins = sys.modules["__main__"].__dict__["__builtins__"].__dict__.copy()
for builtin in original_builtins:
del sys.modules["__main__"].__dict__["__builtins__"].__dict__[builtin]
else:
original_builtins = sys.modules["__main__"].__dict__["__builtins__"]
for builtin in list(original_builtins):
del sys.modules["__main__"].__dict__["__builtins__"][builtin]
del sys.modules["__main__"].__dict__["__builtins__"]
del sys
Sandbox()
del Sandbox
# your code goes here
Note
Some relevant Python features for this problem are platform dependent. Code working locally does not necessarily mean it will work on DMOJ.
Comments
Yay! Its published now! My one week of pain is finally over!
Every hour wasted = 10 pushups
I am allowed to take breaks from the problem to do other problems if I am bored or bcuz I gotta sleep
However during break time, I am not allowed to make progress or perform research regarding the problem in any way shape or form
Counter: 9 h
Edit: I am taking a break for my physical and mental health
upvote the comment to support poor danplus6
Edit: Typo fixed. Gl
;-;