結果
| 問題 | No.139 交差点 |
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-02-10 02:12:45 |
| 言語 | C++11(old_compat) (gcc 12.4.0 + boost 1.92.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 5,000 ms |
| + 884µs | |
| コード長 | 498 bytes |
| 記録 | |
| コンパイル時間 | 1,092 ms |
| コンパイル使用メモリ | 167,956 KB |
| 実行使用メモリ | 9,796 KB |
| 最終ジャッジ日時 | 2026-10-14 09:44:46 |
| 合計ジャッジ時間 | 3,151 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n, l;
while (cin>>n>>l) {
vector<long long> x(n), w(n), t(n);
for(int i=0;i<n;++i) cin>>x[i]>>w[i]>>t[i];
auto wt=0LL;
for(int i=0;i<n;++i) {
auto ct=wt+x[i];
auto r=ct/t[i];
if (r%2==1)
wt+=(r+1)*t[i]-ct;
else if (ct+w[i]>(r+1)*t[i])
wt+=(r+2)*t[i]-ct;
}
cout<<l+wt<<endl;
}
}
hogeover30