fork download
  1. #!/bin/bash
  2.  
  3. g++ Gen.cpp -o Gen # Random testcase generator
  4. g++ Checker.cpp -o Checker # Answer checker
  5. g++ Correct.cpp -o Solution # Bruteforce correct solution
  6.  
  7. if [ $1 -eq 1 ]; then # C++
  8. g++ -static -DONLINE_JUDGE -lm Hack.cpp -o Bad # Compiling the code to be tested
  9. ver="Accepted"
  10. for((i = 0; i < 300; i++)); do # Test 300 cases
  11. ./Gen > int
  12. echo "Running on test $i"
  13. ./Solution < int > out1
  14. timeout 20 ./Bad < int > out2
  15. ./Checker int out2 out1 ver # Checker receives input, jury answer and participant output. Veredict goes to file "ver"
  16. ver=$(cat ver) # Have just "Accepted" if the code is correct, other message means that the code was wrong
  17. if [ "$ver" != "Accepted" ]; then
  18. break
  19. fi
  20. done
  21. elif [ $1 -eq 2 ]; then # Java
  22. javac JavaHack.java
  23. for((i = 0; i < 300; i++)); do
  24. "./Gen$1" > int
  25. echo "Running on test $i"
  26. ./Solution < int > out1
  27. timeout 20 java JavaHack < int > out2
  28. ./Checker int out2 out1 ver
  29. ver=$(cat ver)
  30. if [ "$ver" != "Accepted" ]; then
  31. break
  32. fi
  33. done
  34. elif [ $1 -eq 3 ]; then # Python (needs a third argument with the Python version)
  35. for((i = 0; i < 300; i++)); do
  36. "./Gen$1" > int
  37. echo "Running on test $i"
  38. ./Solution < int > out1
  39. timeout 2 "python$2" pythonHack.py < int > out2
  40. ./Checker int out2 out1 ver
  41. ver=$(cat ver)
  42. if [ "$ver" != "Accepted" ]; then
  43. break
  44. fi
  45. done
  46. else # Kotlin
  47. kotlinc kotlinHack.kt -include-runtime -d kotlinHack.jar
  48. for((i = 0; i < 300; i++)); do
  49. "./Gen$1" > int
  50. echo "Running on test $i"
  51. ./Solution < int > out1
  52. timeout 20 java -jar kotlinHack.jar < int > out2
  53. ./Checker int out2 out1 ver
  54. ver=$(cat ver)
  55. if [ "$ver" != "Accepted" ]; then
  56. break
  57. fi
  58. done
  59. fi
  60.  
  61. if [ "$ver" == "Accepted" ]; then
  62. echo $ver
  63. else
  64. echo "$ver on test $tc"
  65. cat int
  66. fi
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:2: error: invalid preprocessing directive #!
 #!/bin/bash
  ^
prog.cpp:3:20: error: stray ‘#’ in program
 g++ Gen.cpp -o Gen # Random testcase generator
                    ^
prog.cpp:4:28: error: stray ‘#’ in program
 g++ Checker.cpp -o Checker # Answer checker
                            ^
prog.cpp:5:29: error: stray ‘#’ in program
 g++ Correct.cpp -o Solution # Bruteforce correct solution
                             ^
prog.cpp:7:23: error: stray ‘#’ in program
 if [ $1 -eq 1 ]; then # C++
                       ^
prog.cpp:8:49: error: stray ‘#’ in program
  g++ -static -DONLINE_JUDGE -lm Hack.cpp -o Bad # Compiling the code to be tested
                                                 ^
prog.cpp:10:33: error: stray ‘#’ in program
  for((i = 0; i < 300; i++)); do # Test 300 cases
                                 ^
prog.cpp:15:31: error: stray ‘#’ in program
   ./Checker int out2 out1 ver # Checker receives input, jury answer and participant output. Veredict goes to file "ver"
                               ^
prog.cpp:16:18: error: stray ‘#’ in program
   ver=$(cat ver) # Have just "Accepted" if the code is correct, other message means that the code was wrong
                  ^
prog.cpp:21:25: error: stray ‘#’ in program
 elif [ $1 -eq 2 ]; then # Java
                         ^
prog.cpp:34:25: error: stray ‘#’ in program
 elif [ $1 -eq 3 ]; then # Python (needs a third argument with the Python version)
                         ^
prog.cpp:46:6: error: stray ‘#’ in program
 else # Kotlin
      ^
prog.cpp:3:1: error: ‘g’ does not name a type
 g++ Gen.cpp -o Gen # Random testcase generator
 ^
prog.cpp:7:18: error: ‘then’ does not name a type
 if [ $1 -eq 1 ]; then # C++
                  ^~~~
prog.cpp:10:14: error: ‘i’ does not name a type
  for((i = 0; i < 300; i++)); do # Test 300 cases
              ^
prog.cpp:10:23: error: ‘i’ does not name a type
  for((i = 0; i < 300; i++)); do # Test 300 cases
                       ^
prog.cpp:10:30: error: expected unqualified-id before ‘do’
  for((i = 0; i < 300; i++)); do # Test 300 cases
                              ^~
prog.cpp:17:32: error: ‘then’ does not name a type
   if [ "$ver" != "Accepted" ]; then
                                ^~~~
prog.cpp:21:20: error: ‘then’ does not name a type
 elif [ $1 -eq 2 ]; then # Java
                    ^~~~
prog.cpp:23:14: error: ‘i’ does not name a type
  for((i = 0; i < 300; i++)); do
              ^
prog.cpp:23:23: error: ‘i’ does not name a type
  for((i = 0; i < 300; i++)); do
                       ^
prog.cpp:23:30: error: expected unqualified-id before ‘do’
  for((i = 0; i < 300; i++)); do
                              ^~
prog.cpp:30:32: error: ‘then’ does not name a type
   if [ "$ver" != "Accepted" ]; then
                                ^~~~
prog.cpp:34:20: error: ‘then’ does not name a type
 elif [ $1 -eq 3 ]; then # Python (needs a third argument with the Python version)
                    ^~~~
prog.cpp:35:14: error: ‘i’ does not name a type
  for((i = 0; i < 300; i++)); do
              ^
prog.cpp:35:23: error: ‘i’ does not name a type
  for((i = 0; i < 300; i++)); do
                       ^
prog.cpp:35:30: error: expected unqualified-id before ‘do’
  for((i = 0; i < 300; i++)); do
                              ^~
prog.cpp:42:32: error: ‘then’ does not name a type
   if [ "$ver" != "Accepted" ]; then
                                ^~~~
prog.cpp:48:14: error: ‘i’ does not name a type
  for((i = 0; i < 300; i++)); do
              ^
prog.cpp:48:23: error: ‘i’ does not name a type
  for((i = 0; i < 300; i++)); do
                       ^
prog.cpp:48:30: error: expected unqualified-id before ‘do’
  for((i = 0; i < 300; i++)); do
                              ^~
prog.cpp:55:32: error: ‘then’ does not name a type
   if [ "$ver" != "Accepted" ]; then
                                ^~~~
prog.cpp:61:30: error: ‘then’ does not name a type
 if [ "$ver" == "Accepted" ]; then
                              ^~~~
stdout
Standard output is empty