結果

問題 No.3252 Constrained Moving
ユーザー よには
提出日時 2025-09-06 01:17:15
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 942 bytes
コンパイル時間 5,951 ms
コンパイル使用メモリ 333,696 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-06 01:17:25
合計ジャッジ時間 10,179 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#if __has_include(<yoniha/all.h>)
#include <yoniha/all.h>
using namespace atcoder;
#else
#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#endif
using namespace std;

#define int long long
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)((n) - 1); i >= 0; i--)
template <typename T> bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template <typename T> bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

// using mint = modint;

signed main(){
  int n, s, t, k; cin >> n >> s >> t >> k; s--; t--;
  vector<int> a(n); for(auto&& ai : a) cin >> ai;
  if(a.at(s) + a.at(t) <= k){
  	cout << 1 << '\n';
  	return 0;
  }
  int min = *min_element(all(a));
  if(a.at(s) + min <= k && a.at(t) + min <= k){
  	cout << 2 << '\n';
  	return 0;
  }
  cout << -1 << '\n';
}
0