結果
| 問題 | No.139 交差点 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-21 21:28:58 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 430 bytes |
| 記録 | |
| コンパイル時間 | 346 ms |
| コンパイル使用メモリ | 74,068 KB |
| 実行使用メモリ | 81,912 KB |
| 最終ジャッジ日時 | 2026-04-02 00:32:36 |
| 合計ジャッジ時間 | 1,509 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}