bhupixb

Creating zip of test cases

Oct 1st, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. # Removing residue input and output files
  2. rm -rf input
  3. rm -rf output
  4.  
  5. # Creating Directory and temporary files for input and output files
  6. mkdir input
  7. mkdir output
  8. touch temp.txt
  9.  
  10. # Read number of test case
  11. read -p"How many Test Cases to Generate : " mx
  12.  
  13. # sol.cpp : Solution Generator
  14. g++ -std=c++11 -O2 1.cpp -o sol
  15.  
  16. # gen.cpp : Test Case Generator
  17. g++ -std=c++11 -O2 gen.cpp -o gen
  18.  
  19. i=0
  20. while [ $i -lt $mx ]
  21. do
  22. # Generating name of input and output file
  23. if [ $i -le 9 ]
  24. then
  25. in="input0$i.txt"
  26. out="output0$i.txt"
  27. else
  28. in="input$i.txt"
  29. out="output$i.txt"
  30. fi
  31.  
  32. echo $i > temp.txt
  33. echo "#$i"
  34.  
  35. # Generating Test Case
  36. ./gen < temp.txt > "input/$in"
  37.  
  38. # Generating solutions
  39. ./sol < "input/$in" > "output/$out"
  40.  
  41. i=$((i+1))
  42. done
  43.  
  44. # Removing residue files
  45. rm sol
  46. rm gen
  47. rm temp.txt
Add Comment
Please, Sign In to add comment