結果
問題 |
No.3252 Constrained Moving
|
ユーザー |
|
提出日時 | 2025-09-05 21:21:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 1,883 ms |
コンパイル使用メモリ | 195,900 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-05 21:22:02 |
合計ジャッジ時間 | 4,376 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,S,T,K; cin >> N >> S >> T >> K; S--,T--; vector<int> A(N); for(auto &a : A) cin >> a; int mina = min_element(A.begin(),A.end())-A.begin(); if(A.at(S)+A.at(T) <= K) cout << 1 << endl; else if(A.at(S)+A.at(mina) <= K){ if(A.at(mina)+A.at(T) <= K) cout << 2 << endl; else cout << -1 << endl; } else cout << -1 << endl; }