From 750b1be78f68d30ca6887a3f6dfc0da3fb54ba16 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Tue, 16 Nov 2021 23:22:45 -0600 Subject: [PATCH] Update test.sh to ouput compilation status and update std namespace location --- codeforces/Caps Lock/index.cpp | 3 +-- codeforces/Next Round/index.cpp | 3 +-- codeforces/Soldier and Bananas/index.cpp | 3 +-- codeforces/Team/index.cpp | 3 +-- codeforces/Watermelon/index.cpp | 3 +-- codeforces/Way Too Long Words/index.cpp | 3 +-- test.sh | 2 ++ usaco/Breed Counting/index.cpp | 3 +-- usaco/Mixing Milk/index.cpp | 3 +-- usaco/Shell Game/index.cpp | 3 +-- usaco/Teleportation/index.cpp | 11 ++++++----- 11 files changed, 17 insertions(+), 23 deletions(-) diff --git a/codeforces/Caps Lock/index.cpp b/codeforces/Caps Lock/index.cpp index cd5c1bc..a11b343 100644 --- a/codeforces/Caps Lock/index.cpp +++ b/codeforces/Caps Lock/index.cpp @@ -1,7 +1,6 @@ -using namespace std; - #include #include +using namespace std; string parseString(string n) { string m = n; diff --git a/codeforces/Next Round/index.cpp b/codeforces/Next Round/index.cpp index 3a9e24e..8029238 100644 --- a/codeforces/Next Round/index.cpp +++ b/codeforces/Next Round/index.cpp @@ -1,6 +1,5 @@ -using namespace std; - #include +using namespace std; int main() { int n, k; diff --git a/codeforces/Soldier and Bananas/index.cpp b/codeforces/Soldier and Bananas/index.cpp index 71bb126..87f2101 100644 --- a/codeforces/Soldier and Bananas/index.cpp +++ b/codeforces/Soldier and Bananas/index.cpp @@ -1,6 +1,5 @@ -using namespace std; - #include +using namespace std; int main() { int k, n, total_cost; diff --git a/codeforces/Team/index.cpp b/codeforces/Team/index.cpp index 746b9e0..387c3b6 100644 --- a/codeforces/Team/index.cpp +++ b/codeforces/Team/index.cpp @@ -1,6 +1,5 @@ -using namespace std; - #include +using namespace std; int main() { int n; diff --git a/codeforces/Watermelon/index.cpp b/codeforces/Watermelon/index.cpp index fbc4c75..1799dae 100644 --- a/codeforces/Watermelon/index.cpp +++ b/codeforces/Watermelon/index.cpp @@ -1,6 +1,5 @@ -using namespace std; - #include +using namespace std; int main() { int n; diff --git a/codeforces/Way Too Long Words/index.cpp b/codeforces/Way Too Long Words/index.cpp index 767eb26..993613c 100644 --- a/codeforces/Way Too Long Words/index.cpp +++ b/codeforces/Way Too Long Words/index.cpp @@ -1,7 +1,6 @@ -using namespace std; - #include #include +using namespace std; int main() { int n; diff --git a/test.sh b/test.sh index 79cc92d..3329a5f 100755 --- a/test.sh +++ b/test.sh @@ -4,4 +4,6 @@ FILES=*/*/*.cpp for f in $FILES do gcc "$f" -lstdc++ -o /dev/null + status=$? + [ $status -eq 0 ] && echo "$f was compiled successfully" || echo "Compilation of $f failed" done diff --git a/usaco/Breed Counting/index.cpp b/usaco/Breed Counting/index.cpp index 9b81be3..03a787a 100644 --- a/usaco/Breed Counting/index.cpp +++ b/usaco/Breed Counting/index.cpp @@ -1,7 +1,6 @@ -using namespace std; - #include #include +using namespace std; int main() { freopen("bcount.in", "r", stdin); diff --git a/usaco/Mixing Milk/index.cpp b/usaco/Mixing Milk/index.cpp index c1b2c8b..56d21ff 100644 --- a/usaco/Mixing Milk/index.cpp +++ b/usaco/Mixing Milk/index.cpp @@ -1,6 +1,5 @@ -using namespace std; - #include +using namespace std; int main() { freopen("mixmilk.in", "r", stdin); diff --git a/usaco/Shell Game/index.cpp b/usaco/Shell Game/index.cpp index a4db919..ef1da8b 100644 --- a/usaco/Shell Game/index.cpp +++ b/usaco/Shell Game/index.cpp @@ -1,7 +1,6 @@ -using namespace std; - #include #include +using namespace std; int main() { freopen("shell.in", "r", stdin); diff --git a/usaco/Teleportation/index.cpp b/usaco/Teleportation/index.cpp index 001895e..842f4e0 100644 --- a/usaco/Teleportation/index.cpp +++ b/usaco/Teleportation/index.cpp @@ -1,15 +1,16 @@ #include +using namespace std; int a, b, x, y; int main() { - std::cin >> a >> b >> x >> y; + cin >> a >> b >> x >> y; int path1; int path2; int path3; int ans; - path1 = std::abs(a - b); - path2 = std::abs(a - x) + std::abs(y - b); - path3 = std::abs(a - y) + std::abs(x - b); + path1 = abs(a - b); + path2 = abs(a - x) + abs(y - b); + path3 = abs(a - y) + abs(x - b); ans = path1; if (path2 < ans) { ans = path2; @@ -17,5 +18,5 @@ int main() { if (path3 < ans) { ans = path3; } - std::cout << ans << std::endl; + cout << ans << endl; }