Submission #19292


Source Code Expand

Copy
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

 class Solver
{
     public void Solve()
     {
         var ss = Console.ReadLine().Split(' ');
         _N = int.Parse(ss[0]);
         _M = int.Parse(ss[1]);
            
         _map=new string[_N];

         for(var y=0;y<_N;y++)
         {
            _map[y] = Console.ReadLine();
         }

         // s
         int sx=0;
         int sy=0;
         {
             for (var y = 0; y < _N; y++)
             {
                 for (var x = 0; x < _N; x++)
                 {
                     if (_map[y][x] == 's')
                     {
                         sx = x;
                         sy = y;
                         goto 抜ける;
                     }
                 }
             }
         抜ける:
             ;
         }

         _m = new double?[_M, _N];


         _res = 0.0;
         _rec(sx, sy, double.MaxValue, 0);
         Console.WriteLine(_res);
     }

     //
     

     void _rec(int x,int y,double score,int t)
     {
         if( t>0)
         {
             if( x<0||x>=_M||y<0||y>=_N)
                 return;
             char c = _map[y][x];
             if (c == 's' || c == '#')
                 return;

             if (c == 'g')
             {
                 _res = Math.Max(_res,score);
                 return;
             }

             var h = _map[y][x] - '0';
             var br = Math.Pow(0.99, t) * h;

             score = Math.Min(score, br);

             //Debug.WriteLine(x + " " + y + " " + score);

             if (_m[y, x] >= score)
             {
                 //Debug.WriteLine("stop");
                 return;
             }
             _m[y, x] = score;

             //Debug.WriteLine(x+" "+y+" "+ score);
         }

         t++;

         _rec(x - 1, y, score, t);
         _rec(x + 1, y, score, t);
         _rec(x, y - 1, score, t);
         _rec(x, y + 1, score, t);
     }

     double?[,] _m;

     double _res;

     string[] _map;
     int _M;
     int _N;


#if !DEBUG
    static void Main(string[] args)
    {
        new Solver().Solve();
    }
#endif
}

Submission Info

Submission Time
Task C - 暗闇帰り道
User fujiyama
Language C# (Mono 2.10.8.1)
Score 0
Code Size 2274 Byte
Status WA
Exec Time 5034 ms
Memory 21556 KB

Judge Result

Set Name all
Score / Max Score 0 / 100
Status
AC × 6
WA × 9
TLE × 7
RE × 42
Set Name Test Cases
all 00_mini_01.txt, 00_mini_02.txt, 00_mini_03.txt, 00_mini_04.txt, 00_mini_05.txt, 00_sample_01.txt, 00_sample_02.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 01_rnd_20.txt, 02_maxrnd_01.txt, 02_maxrnd_02.txt, 02_maxrnd_03.txt, 02_maxrnd_04.txt, 02_maxrnd_05.txt, 02_maxrnd_06.txt, 02_maxrnd_07.txt, 02_maxrnd_08.txt, 02_maxrnd_09.txt, 02_maxrnd_10.txt, 02_maxrnd_11.txt, 02_maxrnd_12.txt, 02_maxrnd_13.txt, 02_maxrnd_14.txt, 02_maxrnd_15.txt, 02_maxrnd_16.txt, 02_maxrnd_17.txt, 02_maxrnd_18.txt, 02_maxrnd_19.txt, 03_hard_01.txt, 03_hard_02.txt, 03_hard_03.txt, 03_hard_04.txt, 03_hard_05.txt, 03_hard_06.txt, 03_hard_07.txt, 03_hard_08.txt, 04_open_01.txt, 04_open_02.txt, 05_minihard_01.txt, 05_minihard_02.txt, 05_minihard_03.txt, 05_minihard_04.txt, 05_minihard_05.txt, 05_minihard_06.txt, 05_minihard_07.txt, 05_minihard_08.txt
Case Name Status Exec Time Memory
00_mini_01.txt AC 153 ms 7512 KB
00_mini_02.txt AC 134 ms 7528 KB
00_mini_03.txt RE 138 ms 7472 KB
00_mini_04.txt RE 130 ms 7464 KB
00_mini_05.txt WA 133 ms 7576 KB
00_sample_01.txt AC 133 ms 7528 KB
00_sample_02.txt RE 138 ms 7592 KB
01_rnd_01.txt RE 150 ms 12316 KB
01_rnd_02.txt RE 134 ms 7840 KB
01_rnd_03.txt RE 139 ms 8664 KB
01_rnd_04.txt RE 152 ms 9576 KB
01_rnd_05.txt RE 140 ms 8292 KB
01_rnd_06.txt RE 141 ms 8004 KB
01_rnd_07.txt RE 136 ms 7588 KB
01_rnd_08.txt RE 142 ms 7840 KB
01_rnd_09.txt RE 139 ms 7972 KB
01_rnd_10.txt RE 138 ms 7844 KB
01_rnd_11.txt RE 160 ms 11504 KB
01_rnd_12.txt RE 155 ms 10536 KB
01_rnd_13.txt RE 135 ms 7940 KB
01_rnd_14.txt RE 171 ms 12520 KB
01_rnd_15.txt RE 226 ms 10920 KB
01_rnd_16.txt RE 152 ms 9896 KB
01_rnd_17.txt RE 1805 ms 10528 KB
01_rnd_18.txt WA 133 ms 7788 KB
01_rnd_19.txt RE 133 ms 7592 KB
01_rnd_20.txt RE 134 ms 7592 KB
02_maxrnd_01.txt RE 196 ms 21420 KB
02_maxrnd_02.txt RE 313 ms 21428 KB
02_maxrnd_03.txt RE 290 ms 21428 KB
02_maxrnd_04.txt RE 259 ms 21428 KB
02_maxrnd_05.txt RE 289 ms 21328 KB
02_maxrnd_06.txt RE 333 ms 21428 KB
02_maxrnd_07.txt RE 309 ms 21476 KB
02_maxrnd_08.txt RE 359 ms 21556 KB
02_maxrnd_09.txt RE 316 ms 21428 KB
02_maxrnd_10.txt RE 358 ms 21424 KB
02_maxrnd_11.txt TLE 5033 ms 21428 KB
02_maxrnd_12.txt TLE 5033 ms 19788 KB
02_maxrnd_13.txt TLE 5034 ms 18612 KB
02_maxrnd_14.txt TLE 5033 ms 17684 KB
02_maxrnd_15.txt TLE 5032 ms 15696 KB
02_maxrnd_16.txt TLE 5032 ms 12980 KB
02_maxrnd_17.txt TLE 5032 ms 12468 KB
02_maxrnd_18.txt WA 211 ms 12268 KB
02_maxrnd_19.txt WA 156 ms 12208 KB
03_hard_01.txt RE 195 ms 21428 KB
03_hard_02.txt RE 191 ms 21428 KB
03_hard_03.txt RE 195 ms 21420 KB
03_hard_04.txt RE 197 ms 21428 KB
03_hard_05.txt RE 189 ms 21428 KB
03_hard_06.txt RE 191 ms 21424 KB
03_hard_07.txt RE 194 ms 21428 KB
03_hard_08.txt RE 196 ms 21424 KB
04_open_01.txt RE 190 ms 21428 KB
04_open_02.txt RE 192 ms 21432 KB
05_minihard_01.txt WA 259 ms 7628 KB
05_minihard_02.txt WA 249 ms 7660 KB
05_minihard_03.txt AC 132 ms 7532 KB
05_minihard_04.txt AC 133 ms 7532 KB
05_minihard_05.txt AC 256 ms 7632 KB
05_minihard_06.txt WA 241 ms 7660 KB
05_minihard_07.txt WA 132 ms 7596 KB
05_minihard_08.txt WA 139 ms 7532 KB