diff --git a/Testing/bruteForce.cpp b/Testing/bruteForce.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Testing/generator.cpp b/Testing/generator.cpp new file mode 100644 index 0000000..df13d08 --- /dev/null +++ b/Testing/generator.cpp @@ -0,0 +1,49 @@ +#include + +using namespace std; + +int main(int argc, char* argv[]){ + + int n = atoi(argv[1]); + // cin>>n; + + int arr[n]; + for(int i = 1 ; i <= n ; i++ ) + arr[i-1] = i; + + int idx = 0; + int cnt = 1; + + int elemLeft = n; + + cout << "Operation:\n"; + + while( true ){ + // cout << "Size : " << elemLeft << '\n'; + if( elemLeft <= 0 ) + break; + + if( cnt%2 == 0 ){ + while( arr[idx] == -1 ) + idx = (idx+1)%n; + + cout << arr[idx] << ' '; + arr[idx] = -1; + + elemLeft--; + if( elemLeft <= 0 )break; + + while( arr[idx] == -1 ) + idx = (idx+1)%n; + cnt = 1; + + // idx = (idx+1)%n; + continue; + } + + idx = (idx+1)%n; + cnt++; + } + cout << '\n'; + return 0; +} \ No newline at end of file diff --git a/Testing/mediator1.sh b/Testing/mediator1.sh new file mode 100644 index 0000000..101f6a2 --- /dev/null +++ b/Testing/mediator1.sh @@ -0,0 +1,19 @@ +#set -e +#g++ code.cpp -o code +#g++ gen.cpp -o gen +#g++ brute.cpp -o brute +for((i = 1;i <= 60 ; ++i)); do + ./generator.exe $i > input_file.txt + #./solution < input_file.txt > myAnswer.txt + #./brute_force < input_file.txt > correctAnswer.txt + #diff -Z myAnswer.txt correctAnswer.txt > /dev/null || break + echo "test case: " $i + cat input_file.txt + #cat myAnswer.txt +done +#echo "WA on the following test:" +#cat input_file.txt +#echo "Your answer is:" +#cat myAnswer.txt +#echo "Correct answer is:" +#cat correctAnswer.txt diff --git a/Testing/mediator2.sh b/Testing/mediator2.sh new file mode 100644 index 0000000..295c0f5 --- /dev/null +++ b/Testing/mediator2.sh @@ -0,0 +1,27 @@ +#set -e +#g++ code.cpp -o code +#g++ gen.cpp -o gen +#g++ brute.cpp -o brute +#g++ checker.cpp -o checker +for((i = 1; ; ++i)); do + ./generator $i > input_file.txt + ./solution < input_file.txt > myAnswer.txt + ./brute_force < input_file.txt > correctAnswer.txt + ./checker > checker_log.txt + ret=$? + cat checker_log.txt + + if [ $ret -eq 2 ]; + then + break + fi + echo "Passed test: " $i +done +echo "WA on following test case:" +cat input_file.txt +echo "Your answer is:" +cat myAnswer.txt +echo "Correct answer is:" +cat correctAnswer.txt +echo "Error Message:" +cat checker_log.txt diff --git a/Testing/solution.cpp b/Testing/solution.cpp new file mode 100644 index 0000000..cf451eb --- /dev/null +++ b/Testing/solution.cpp @@ -0,0 +1,9 @@ +#include + +using namespace std; + +int main(int argc, char* argv[] ){ + + + return 0; +} \ No newline at end of file