結果
| 問題 |
No.139 交差点
|
| コンテスト | |
| ユーザー |
tkzw_21
|
| 提出日時 | 2015-01-29 23:45:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 841 bytes |
| コンパイル時間 | 1,632 ms |
| コンパイル使用メモリ | 159,832 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 04:15:19 |
| 合計ジャッジ時間 | 22,838 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 WA * 19 RE * 6 |
ソースコード
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef pair<int,int> P;
typedef pair<int,pair<int,int>> PP;
typedef long long LL;
const double EPS = 1e-8;
const int INF = 1e9;
int dy[] = {0,1,0,-1};
int dx[] = {1,0,-1,0};
int main(void) {
int N,L;
cin >> N >> L;
vector<int> x(N),w(N),t(N);
for(int i=0;i<N;i++){
cin >> x[i] >> w[i] >> t[i];
}
int dist = 0,tm = 0,i = 0;
while(dist != L){
if(dist == x[i]){
int cnt = tm/t[i];
//blue
if(cnt%2 == 0){
//残り時間足りる
if((t[i]-tm%t[i]) > w[i]){
dist += w[i]+1;
tm += w[i] + 1;
}else{
dist += w[i]+1;
tm += w[i] + 1 + (t[i]-tm%t[i]) + t[i];
}
}else{
dist += w[i] + 1;
tm += w[i] + 1 + (t[i]-tm%t[i]) + t[i];
}
i++;
continue;
}
dist++;
tm++;
}
cout << tm << endl;
return 0;
}
tkzw_21