結果
問題 | No.139 交差点 |
ユーザー |
|
提出日時 | 2015-01-30 00:16:02 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 448 bytes |
コンパイル時間 | 1,312 ms |
コンパイル使用メモリ | 159,368 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 04:19:29 |
合計ジャッジ時間 | 2,135 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;const ll MOD = 1e9 + 7;int main(){int N, L;cin >> N >> L;int tm = 0;int x = 0;for(int i=0;i<N;i++){int X, W, T;cin >> X >> W >> T;tm += X - x;if((tm / T) % 2 == 1){tm += T - tm % T;} else {int rem = T - tm % T;if(W > rem){tm += rem;tm += T;}}tm += W;x = X + W;}tm += L - x;cout << tm << endl;return 0;}