結果
| 問題 |
No.139 交差点
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-21 21:28:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 430 bytes |
| コンパイル時間 | 482 ms |
| コンパイル使用メモリ | 63,860 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-18 08:47:48 |
| 合計ジャッジ時間 | 1,364 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include<iostream>
using namespace std;
int main(){
int n, l, x, w, t;
cin >> n >> l;
int ans = 0, befpos = 0;
for(int i = 0; i < n; i++){
cin >> x >> w >> t;
ans += x-befpos;
int residual = t - ans%(2*t);
if(residual < w) ans = ( (ans + 2*t - 1) / (2*t) ) * (2*t); // floor
ans += w;
befpos = x+w;
}
cout << ans + (l-befpos) << endl;
return 0;
}