結果

問題 No.139 交差点
ユーザー やまぞう
提出日時 2015-04-17 00:12:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 707 bytes
コンパイル時間 610 ms
コンパイル使用メモリ 60,376 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-04 15:16:33
合計ジャッジ時間 1,490 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int N, L;

	cin >> N >> L;
	
	vector<int> X(N);
	vector<int> W(N);
	vector<int> T(N);
	for (int i = 0; i < N; i++) {
		cin >> X[i] >> W[i] >> T[i];
	}

	int x = 0;
	int t = 0;
	for (int i = 0; i < N; i++) {
		t += X[i] - x;
		x = X[i];

		cout << t % T[i] << endl;
		cout << (t % T[i]) % 2 << endl;
		cout << (t + W[i] - 1) << endl;
		cout << (t + W[i] - 1) % T[i] << endl;
		cout << ((t + W[i] - 1) % T[i]) % 2 << endl;

		if ((t % (2 * T[i])) >= T[i] || ((t + W[i] - 1) % (2 * T[i]) >= T[i])) {
			t = (t + 2 * T[i] - 1) / (2 * T[i]) * (2 * T[i]);
		}
		t += W[i];
		x += W[i];
	}
	t += (L - x);

	cout << t << endl;
	return 0;
}
0