結果

問題 No.139 交差点
ユーザー naimonon77
提出日時 2015-09-18 22:34:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 57,468 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 07:01:37
合計ジャッジ時間 1,659 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
#include <cstdio>
#include <string.h>
#include <stdlib.h>
#include <math.h>

typedef long long ll;
typedef long double lb;

int l[3];


int main(void)
{
   int i,j,k;
   int memory[2];
   int n,l;
   int x;
   int w;
   int t;
   int now_time = 0;
   int now_location;

   cin >> n >> l;

   now_location = 0;

   for(i=0;i<n;i++) {
      cin >> x >> w >> t;
      now_time += x - now_location;

      if(now_time % (2*t) <= t && now_time+w % (2*t) <= t) {
         now_time += w;
      }
      else {
         now_time += 2*t - now_time % (2*t) + w;
      }
      now_location = x+w;
   }

   now_time += l - now_location;
   printf("%d\n",now_time);

   return 0;
}
0