結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー kuuso1kuuso1
提出日時 2017-03-24 22:42:34
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,790 bytes
コンパイル時間 2,373 ms
コンパイル使用メモリ 106,088 KB
実行使用メモリ 22,908 KB
最終ジャッジ日時 2023-09-20 01:47:48
合計ジャッジ時間 5,151 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
20,784 KB
testcase_01 AC 56 ms
22,896 KB
testcase_02 AC 55 ms
20,820 KB
testcase_03 AC 57 ms
22,880 KB
testcase_04 WA -
testcase_05 AC 56 ms
22,908 KB
testcase_06 AC 55 ms
20,732 KB
testcase_07 AC 54 ms
18,788 KB
testcase_08 AC 61 ms
18,820 KB
testcase_09 AC 62 ms
20,836 KB
testcase_10 AC 62 ms
22,764 KB
testcase_11 AC 63 ms
20,752 KB
testcase_12 AC 61 ms
20,920 KB
testcase_13 AC 60 ms
22,744 KB
testcase_14 AC 58 ms
20,748 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 57 ms
20,832 KB
testcase_19 WA -
testcase_20 AC 57 ms
20,744 KB
testcase_21 AC 57 ms
20,876 KB
testcase_22 WA -
testcase_23 AC 63 ms
22,736 KB
testcase_24 AC 61 ms
20,668 KB
testcase_25 AC 61 ms
20,732 KB
testcase_26 AC 60 ms
20,712 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;
using System.Linq;
using System.Text;

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

class Sol{
	public void Solve(){
		
		int H = 101;
		int W = 101;
		int[][] dp = new int[H][];
		int Inf = (int)1e9;
		for(int i=0;i<H;i++){
			dp[i] = new int[H];
			for(int j=0;j<W;j++){
				dp[i][j] = Inf;
			}
		}
		
		dp[0][0] = 0;
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if(dp[i][j] == Inf) continue;
				for(int k=0;k<N;k++){
					int ny = i + Y[k];
					int nx = j + X[k];
					int nc = dp[i][j] + C[k];
					if(InRange(ny,0,H) && InRange(nx,0,W)){
						dp[ny][nx] = Math.Min(dp[ny][nx],nc);
					}
				}
			}
		}
		Console.WriteLine(dp[Gy][Gx]);
		
	}
	
	bool InRange(int t, int l, int r){
		return l <= t && t < r;
	}
	
	int Gx,Gy,N,F;
	int[] X,Y,C;
	public Sol(){
		var d = ria();
		Gx = d[0]; Gy = d[1]; N = d[2] + 2; F = d[3];
		X = new int[N];
		Y = new int[N];
		C = new int[N];
		for(int i=0;i<N-2;i++){
			d = ria();
			X[i] = d[0]; Y[i] = d[1]; C[i] = d[2];
		}
		X[N-2] = 0; Y[N-2] = 1; C[N-2] = F;
		X[N-1] = 1; Y[N-1] = 0; C[N-1] = F;
	}

	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(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0