Back

Meta Hacker Cup 2024

· 7 min · C++, MacOS

I got to know about it when I started cp.

Participated in the practice round 2024 for the first time.

Usage :

Directory/
├── Sol.cpp
├── input.txt
├── output.txt
└── run.sh
#!/bin/bash

echo "Compiling Sol.cpp ..."
g++ -Wall -Wl,-stack_size,20000000 -O2 -o Sol Sol.cpp

if [ $? -eq 0 ]; then
    echo "Compilation done!"
else
    echo "Compilation failed!"
    exit 1
fi

echo "Running Sol ..."
./Sol < input.txt > output.txt

if [ $? -eq 0 ]; then
    echo "Run done!"
    echo "Output:"
    bat output.txt
else
    echo "Execution failed!"
    exit 1
fi

paste the input into input.txt from the site.

in the proper directory, run :

chmod +x run.sh

and then :

./run.sh

save your time.

I wont be accounting the practice round.

Round 1

Problem A

Problem B

Problem C