結果
問題 | No.139 交差点 |
ユーザー |
|
提出日時 | 2019-08-24 17:03:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 363 bytes |
コンパイル時間 | 2,044 ms |
コンパイル使用メモリ | 192,896 KB |
最終ジャッジ日時 | 2025-01-07 14:51:13 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;int main() {int n,l;cin>>n>>l;int c=0;int ct=0;while (n--) {int x,w,t;cin>>x>>w>>t;ct+=x-c;int a=ct%(2*t);if (a+w>t)ct+=2*t-a;ct+=w;c=x+w;}ct+=l-c;cout<<ct<<endl;return 0;}