結果

問題 No.716 距離
ユーザー トミー
提出日時 2024-11-24 17:33:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 2,409 ms
コンパイル使用メモリ 194,744 KB
最終ジャッジ日時 2025-02-25 06:06:59
ジャッジサーバーID
(参考情報)
judge1 / judge2
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:22:28: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 | int main() { solve();system("pause"); }
      |                      ~~~~~~^~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;


void solve() {
  ll n;
  cin>>n;
  vector<ll> a(n);
  for(ll i=0;i<n;i++){
    cin>>a.at(i);
  }
  ll u=-1e6,l=1e6;
  u=abs(a.at(0)-a.at(n-1));
  for(ll i=0;i<n-1;i++){
    l=min(l,a.at(i+1)-a.at(i));
  }
  cout<<l<<endl;
  cout<<u<<endl;
} 

int main() { solve();system("pause"); }
0