結果
| 問題 | No.496 ワープクリスタル (給料日前編) |
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2017-03-24 22:39:30 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,794 bytes |
| 記録 | |
| コンパイル時間 | 1,014 ms |
| コンパイル使用メモリ | 107,648 KB |
| 実行使用メモリ | 18,176 KB |
| 最終ジャッジ日時 | 2024-07-06 03:14:16 |
| 合計ジャッジ時間 | 2,398 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 WA * 6 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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+2];
Y = new int[N+2];
C = new int[N+2];
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));}
}
kuuso1