結果
| 問題 |
No.3252 Constrained Moving
|
| コンテスト | |
| ユーザー |
pengin_2000
|
| 提出日時 | 2025-09-05 21:53:29 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 376 bytes |
| コンパイル時間 | 1,080 ms |
| コンパイル使用メモリ | 26,924 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-09-05 21:53:33 |
| 合計ジャッジ時間 | 3,785 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d %d %d %d", &n, &s, &t, &k);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d", &a[i]);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int a[200005];
int main()
{
int n, s, t, k;
scanf("%d %d %d %d", &n, &s, &t, &k);
int i, j;
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
if (a[--s] + a[--t] <= k)
{
printf("1\n");
return 0;
}
for (i = j = 0; i < n; i++)
if (a[j] > a[i])
j = i;
if (a[j] + a[s] <= k && a[j] + a[t] <= k)
printf("2\n");
else
printf("-1\n");
return 0;
}
pengin_2000