結果

問題 No.139 交差点
ユーザー tkzw_21tkzw_21
提出日時 2015-01-29 23:45:05
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 841 bytes
コンパイル時間 1,778 ms
コンパイル使用メモリ 145,204 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-05 08:08:33
合計ジャッジ時間 18,980 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 WA -
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0