結果

問題 No.3252 Constrained Moving
ユーザー dvasgdjhas
提出日時 2025-09-13 10:59:53
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 528 bytes
コンパイル時間 2,929 ms
コンパイル使用メモリ 278,324 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-13 11:00:02
合計ジャッジ時間 7,849 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n" 
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,s,t,k;cin>>n>>s>>t>>k;
    vector<int> a(n+1);
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    if(a[s]+a[t] <= k){
        cout<<1;
        return 0;
    }
    int mn = INT_MAX;
    for(int i=1;i<=n;i++){
        mn = min(mn,a[i]);
    }
    if(a[s]+mn <= k and a[t]+mn <= k){
        cout<<2;
        return 0;
    }
    cout<<-1;
    return 0;
}
0