diff options
Diffstat (limited to 'codechef/RacingHorses')
| -rwxr-xr-x | codechef/RacingHorses/main | bin | 0 -> 44616 bytes | |||
| -rw-r--r-- | codechef/RacingHorses/main.cpp | 22 | ||||
| -rw-r--r-- | codechef/RacingHorses/main_input0.txt | 3 | ||||
| -rw-r--r-- | codechef/RacingHorses/main_output0.txt | 1 |
4 files changed, 26 insertions, 0 deletions
diff --git a/codechef/RacingHorses/main b/codechef/RacingHorses/main Binary files differnew file mode 100755 index 0000000..a071dd7 --- /dev/null +++ b/codechef/RacingHorses/main diff --git a/codechef/RacingHorses/main.cpp b/codechef/RacingHorses/main.cpp new file mode 100644 index 0000000..1da09f4 --- /dev/null +++ b/codechef/RacingHorses/main.cpp @@ -0,0 +1,22 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + int n; + cin >> n; + vector<int> v(n); + for(int &x : v) cin >> x; + sort(v.begin(), v.end()); + int mn = 1e9; + for(int i = 0; i < n - 1; i++) { + mn = min(mn, abs(v[i] - v[i + 1])); + } + cout << mn << endl; + } +} diff --git a/codechef/RacingHorses/main_input0.txt b/codechef/RacingHorses/main_input0.txt new file mode 100644 index 0000000..3142f24 --- /dev/null +++ b/codechef/RacingHorses/main_input0.txt @@ -0,0 +1,3 @@ +1 +5 +4 9 1 32 13
\ No newline at end of file diff --git a/codechef/RacingHorses/main_output0.txt b/codechef/RacingHorses/main_output0.txt new file mode 100644 index 0000000..e440e5c --- /dev/null +++ b/codechef/RacingHorses/main_output0.txt @@ -0,0 +1 @@ +3
\ No newline at end of file |
