結果

問題 No.139 交差点
ユーザー cureskol
提出日時 2020-04-06 16:56:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 289 bytes
コンパイル時間 1,513 ms
コンパイル使用メモリ 167,040 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 13:13:45
合計ジャッジ時間 2,528 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

signed main(){
  int n,l;cin>>n>>l;
  int nowt=0,nowp=0;
  while(n--){
    int x,w,t;cin>>x>>w>>t;
    nowt+=x-nowp;
    int A=nowt%(2*t);
    if(t-A>=w)nowt+=w;
    else nowt+=2*t-A+w;
    nowp=x+w;
  }
  nowt+=l-nowp;
  cout<<nowt<<endl;
}
0