結果
問題 | No.716 距離 |
ユーザー |
|
提出日時 | 2018-07-27 22:25:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 2,628 bytes |
コンパイル時間 | 1,562 ms |
コンパイル使用メモリ | 167,496 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 01:20:12 |
合計ジャッジ時間 | 2,670 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 40 |
ソースコード
using namespace std;#include <iostream>#include <bits/stdc++.h>#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<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }// n次元配列の初期化。第2引数の型のサイズごとに初期化していく。template<typename A, size_t N, typename T>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 <class T = int>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//}}}//{{{ otherstypedef long long ll;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<long long> vll;typedef vector<vll> vvll;typedef long double ld;typedef pair<int,int> pii;typedef vector<pii> vii;typedef vector<vii> vvii;typedef tuple<int,int,int> iii;typedef set<int> si;typedef complex<double> pnt;typedef vector<pnt> vpnt;typedef priority_queue<pii, vii, greater<pii> > 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_FILEstd::ifstream in(infile);std::cin.rdbuf(in.rdbuf());#endifsolve();return 0;} //}}}