using namespace std; #include #include #define infile "../test/sample-1.in" #define int long long // #define INF 2147483647 #define INF 1000000000000000000LL #define MOD 1000000007LL // {{{ define basic macro // #define rep(i, x) for(int i = 0; i < (int)(x); i++) #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) #define reps(i,x) for(int i = 1; i <= (int)(x); i++) #define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--) #define rreps(i,x) for(int i=((int)(x));i>0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define RFOR(i, m, n) for(int i = m;i >= n;i--) #define foreach(x,a) for(auto& (x) : (a) ) #define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++) #define all(x) (x).begin(),(x).end() #define sum(v) accumulate(all(v), 0) #define sz(x) ((int)(x).size()) template inline void chmax(T &a, const T &b) { if(a < b) a = b; } template inline void chmin(T &a, const T &b) { if(a > b) a = b; } // n次元配列の初期化。第2引数の型のサイズごとに初期化していく。 template void Fill(A (&array)[N], const T &val){ std::fill( (T*)array, (T*)(array+N), val ); } #define fill(x,y) memset(x,y,sizeof(x)) #define pb(a) push_back(a) #define uni(x) sort(all(x));x.erase(unique(all(x)),x.end()) #define ten(n) ((int)1e##n) template T in() {T x; cin>>x; return (x);} struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast; // }}} //{{{ dump macro #ifdef PCM #include "dump.hpp" #else #define dump(...) 42 #define dump_1d(...) 42 #define dump_2d(...) 42 #endif //}}} //{{{ others typedef long long ll; typedef vector vi; typedef vector vvi; typedef vector vll; typedef vector vvll; typedef long double ld; typedef pair pii; typedef vector vii; typedef vector vvii; typedef tuple iii; typedef set si; typedef complex pnt; typedef vector vpnt; typedef priority_queue > spq; //pop, topで最小値 int dx[]={1, -1, 0, 0}; int dy[]={0, 0, 1, -1}; //}}} int solve(){ int n;cin>>n; int a[n]={}; rep(i, n){ cin>>a[i]; } int m = INF ; reps(i, n-1){ chmin(m, a[i]-a[i-1]); } cout << m << endl; cout << a[n-1]-a[0] << endl; return 0; } signed main() { //{{{ #ifdef INPUT_FROM_FILE std::ifstream in(infile); std::cin.rdbuf(in.rdbuf()); #endif solve(); return 0; } //}}}