結果

問題 No.139 交差点
ユーザー kuuso1kuuso1
提出日時 2015-01-29 23:54:38
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 1,307 bytes
コンパイル時間 3,348 ms
コンパイル使用メモリ 109,092 KB
実行使用メモリ 22,900 KB
最終ジャッジ日時 2023-09-05 08:11:08
合計ジャッジ時間 6,511 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
20,780 KB
testcase_01 AC 58 ms
20,772 KB
testcase_02 AC 58 ms
20,824 KB
testcase_03 AC 58 ms
22,716 KB
testcase_04 AC 57 ms
20,792 KB
testcase_05 AC 57 ms
20,876 KB
testcase_06 AC 57 ms
22,808 KB
testcase_07 AC 58 ms
22,900 KB
testcase_08 AC 58 ms
20,784 KB
testcase_09 AC 57 ms
20,788 KB
testcase_10 AC 58 ms
22,828 KB
testcase_11 AC 57 ms
22,828 KB
testcase_12 AC 58 ms
22,836 KB
testcase_13 AC 58 ms
20,744 KB
testcase_14 AC 58 ms
20,868 KB
testcase_15 AC 57 ms
20,776 KB
testcase_16 AC 57 ms
22,760 KB
testcase_17 AC 58 ms
20,808 KB
testcase_18 AC 58 ms
20,784 KB
testcase_19 AC 60 ms
20,672 KB
testcase_20 AC 58 ms
20,804 KB
testcase_21 AC 57 ms
20,732 KB
testcase_22 AC 57 ms
22,768 KB
testcase_23 AC 59 ms
22,780 KB
testcase_24 AC 57 ms
22,724 KB
testcase_25 AC 57 ms
20,788 KB
testcase_26 AC 59 ms
20,716 KB
testcase_27 AC 58 ms
22,844 KB
testcase_28 AC 57 ms
20,828 KB
testcase_29 AC 57 ms
20,792 KB
testcase_30 AC 57 ms
18,776 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long t=0;
		long adv=0;
		for(int i=0;i<N;i++){
			long nxt=X[i]-adv;
			t+=nxt;
			adv+=nxt;
			if((t/T[i])%2==0 && T[i]-t%T[i]<W[i]){
				t+=(T[i]-t%T[i]);
			}
			if((t/T[i])%2==1){
				t+=(T[i]-t%T[i]);
			}
			t+=W[i];
			adv+=W[i];
		}
		
		adv+=(L-(X[N-1]+W[N-1]));
		t+=(L-(X[N-1]+W[N-1]));
		
		Console.WriteLine(t);
		
		
		
	}
	int N,L;
	int[] X,W,T;
	public Sol(){
		var d=ria();
		N=d[0];L=d[1];
		X=new int[N];
		W=new int[N];
		T=new int[N];
		for(int i=0;i<N;i++){
			d=ria();
			X[i]=d[0];W[i]=d[1];T[i]=d[2];
		}
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0