結果

問題 No.1205 Eye Drops
ユーザー hiramari
提出日時 2020-11-30 23:04:33
言語 PHP
(843.2)
結果
WA  
実行時間 -
コード長 596 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 32,212 KB
実行使用メモリ 32,916 KB
最終ジャッジ日時 2024-09-13 02:39:47
合計ジャッジ時間 26,816 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 26 OLE * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
    list($M,$P,$T) = explode(" ", trim(fgets(STDIN)));
    $position = 0;
    $ans = true;
    $arr_P = array($P);
    $arr_T = array($T);
    
    for($i=0;$i<$M;$i++){
        //時刻Tに区画Pの+-Tの範囲にいる場合
        if ($arr_P[$i] - $arr_T[$i] <= $position or  $position <= $arr_P[$i] + $arr_T[$i]){
            //成功時、$Pへ移動する
            $position = $arr_P[$i];
        }else{
            //失敗
            $ans = false;
            break;
        }
    }
    
    if ($ans == true){
        printf("Yes");
    } else {
        printf("No");
    }
0