結果
| 問題 | No.3252 Constrained Moving |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-09-06 12:17:34 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 2,000 ms |
| + 68µs | |
| コード長 | 604 bytes |
| 記録 | |
| コンパイル時間 | 159 ms |
| コンパイル使用メモリ | 52,684 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-14 17:57:26 |
| 合計ジャッジ時間 | 3,459 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3252.cc: No.3252 Constrained Moving - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_N = 200000;
/* typedef */
/* global variables */
int as[MAX_N];
/* subroutines */
/* main */
int main() {
int n, s, t, k;
scanf("%d%d%d%d", &n, &s, &t, &k);
s--, t--;
for (int i = 0; i < n; i++) scanf("%d", as + i);
if (as[s] + as[t] <= k) puts("1");
else {
int mina = *min_element(as, as + n);
if (as[s] + mina <= k && mina + as[t] <= k)
puts("2");
else
puts("-1");
}
return 0;
}
tnakao0123