結果
問題 | No.139 交差点 |
ユーザー |
|
提出日時 | 2020-04-22 10:59:12 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 469 bytes |
コンパイル時間 | 834 ms |
コンパイル使用メモリ | 66,240 KB |
最終ジャッジ日時 | 2025-01-09 22:27:23 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <iostream> using lint = long long; void solve() { int n; lint l; std::cin >> n >> l; lint wait = 0; while (n--) { lint x, w, t; std::cin >> x >> w >> t; lint ct = (x + wait) % (t * 2); if (ct > t - w) { wait += t * 2 - ct; } } std::cout << l + wait << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }