結果
問題 | No.139 交差点 |
ユーザー |
![]() |
提出日時 | 2016-08-26 16:00:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 314 bytes |
コンパイル時間 | 1,397 ms |
コンパイル使用メモリ | 158,072 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 04:11:12 |
合計ジャッジ時間 | 2,603 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int N,L; cin >> N >> L; int pos=0; int time=0; for(int i=0;i<N;i++){ int x,w,t; cin >> x >> w >> t; time+=x-pos; pos=x; int time2=(time/(2*t))*2*t; if(time2+t<time+w) time=time2+2*t; } time+=L-pos; cout << time << endl; return 0; }