結果
問題 | No.139 交差点 |
ユーザー |
![]() |
提出日時 | 2015-09-21 00:52:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 395 bytes |
コンパイル時間 | 448 ms |
コンパイル使用メモリ | 56,688 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 08:25:04 |
合計ジャッジ時間 | 1,329 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <iostream> #include <sstream> using namespace std; int main(int argc, char *argv[]) { int N, L; cin >> N >> L; int prev = 0; int ans = 0; for (int i = 0; i < N; ++i) { int x, w, t; cin >> x >> w >> t; ans += (x - prev); prev = x + w; int r = t - (ans % (t * 2)); if (r < w) { ans += r + t; } ans += w; } ans += (L - prev); cout << ans << endl; return 0; }