結果
問題 | No.139 交差点 |
ユーザー |
![]() |
提出日時 | 2016-02-15 01:20:58 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 689 bytes |
コンパイル時間 | 608 ms |
コンパイル使用メモリ | 72,512 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 06:44:41 |
合計ジャッジ時間 | 1,518 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 7 |
ソースコード
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) ll n,l; ll ans = 0,now = 0; ll x,w,t; int main() { cin >> n >> l; for(int i = 0;i < n;i++){ cin >> x >> w >> t; ans += x - now; now += x - now; if((ans / t) % 2 == 0){ if(t - ans % t > w) { ans += w; now += w; }else{ ans += t - ans % t + t + w; now += w; } }else{ ans += t - ans % t + w; now += w; } } ans += l - now; cout << ans << endl; return 0; }