Submission #35546
Source Code Expand
Copy
<?phpfscanf(STDIN, "%d %d %s", $x, $y, $w);for($i = 0; $i < 9; $i++){for($j = 0; $j < 9; $j++){$table[$i][$j] = fgetc(STDIN);}fgetc(STDIN); // throw line feed code}$x--;$y--; // for optimizing code$auth_code = '';for($i = 0; $i < 4; $i++){$auth_code .= $table[$y][$x];switch($w){case 'R':if($x == 8)$w = 'L';break;case 'L':if($x == 0)$w = 'R';break;case 'U':if($y == 0)$w = 'D';
<?php fscanf(STDIN, "%d %d %s", $x, $y, $w); for($i = 0; $i < 9; $i++){ for($j = 0; $j < 9; $j++){ $table[$i][$j] = fgetc(STDIN); } fgetc(STDIN); // throw line feed code } $x--;$y--; // for optimizing code $auth_code = ''; for($i = 0; $i < 4; $i++){ $auth_code .= $table[$y][$x]; switch($w){ case 'R': if($x == 8)$w = 'L'; break; case 'L': if($x == 0)$w = 'R'; break; case 'U': if($y == 0)$w = 'D'; break; case 'D': if($y == 8)$w = 'U'; break; case 'RU': if($x == 8 && $y == 0){ $w = 'LD'; }elseif($x == 8){ $w = 'LU'; }elseif($y == 0){ $w = 'RD'; } break; case 'RD': if($x == 8 && $y == 8){ $w = 'LU'; }elseif($x == 8){ $w = 'LD'; }elseif($y == 8){ $w = 'RU'; } break; case 'LU': if($x == 0 && $y == 0){ $w = 'RD'; }elseif($x == 0){ $w = 'RU'; }elseif($y == 0){ $w = 'LD'; } break; case 'LD': if($x == 0 && $y == 8){ $w = 'RU'; }elseif($x == 0){ $w = 'RD'; }elseif($y == 8){ $w = 'LU'; } break; default: break; } go($x, $y, $w); } exit($auth_code.PHP_EOL); function go(&$x, &$y, $direction){ switch($direction){ case 'R': $x++; break; case 'L': $x--; break; case 'U': $y--; break; case 'D': $y++; break; case 'RU': $x++;$y--; break; case 'RD': $x++;$y++; break; case 'LU': $x--;$y--; break; case 'LD': $x--;$y++; break; default: break; } } ?>
Submission Info
Submission Time | |
---|---|
Task | B - P-CASカードと高橋君 |
User | wada811 |
Language | PHP (PHP 5.3.10) |
Score | 100 |
Code Size | 2273 Byte |
Status | AC |
Exec Time | 54 ms |
Memory | 3800 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rnd_00.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, 01_rnd_21.txt, 01_rnd_22.txt, 01_rnd_23.txt, 01_rnd_24.txt, 01_rnd_25.txt, 01_rnd_26.txt, 01_rnd_27.txt, 01_rnd_28.txt, 01_rnd_29.txt, 01_rnd_30.txt, 01_rnd_31.txt, 02_cornerrnd_00.txt, 02_cornerrnd_01.txt, 02_cornerrnd_02.txt, 02_cornerrnd_03.txt, 02_cornerrnd_04.txt, 02_cornerrnd_05.txt, 02_cornerrnd_06.txt, 02_cornerrnd_07.txt, 02_cornerrnd_08.txt, 02_cornerrnd_09.txt, 02_cornerrnd_10.txt, 02_cornerrnd_11.txt, 02_cornerrnd_12.txt, 02_cornerrnd_13.txt, 02_cornerrnd_14.txt, 02_cornerrnd_15.txt, 02_cornerrnd_16.txt, 02_cornerrnd_17.txt, 02_cornerrnd_18.txt, 02_cornerrnd_19.txt, 02_cornerrnd_20.txt, 02_cornerrnd_21.txt, 02_cornerrnd_22.txt, 02_cornerrnd_23.txt, 02_cornerrnd_24.txt, 02_cornerrnd_25.txt, 02_cornerrnd_26.txt, 02_cornerrnd_27.txt, 02_cornerrnd_28.txt, 02_cornerrnd_29.txt, 02_cornerrnd_30.txt, 02_cornerrnd_31.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 43 ms | 3700 KB |
00_sample_02.txt | AC | 43 ms | 3796 KB |
00_sample_03.txt | AC | 43 ms | 3788 KB |
00_sample_04.txt | AC | 42 ms | 3776 KB |
00_sample_05.txt | AC | 43 ms | 3788 KB |
01_rnd_00.txt | AC | 42 ms | 3780 KB |
01_rnd_01.txt | AC | 44 ms | 3792 KB |
01_rnd_02.txt | AC | 43 ms | 3780 KB |
01_rnd_03.txt | AC | 54 ms | 3784 KB |
01_rnd_04.txt | AC | 42 ms | 3784 KB |
01_rnd_05.txt | AC | 43 ms | 3776 KB |
01_rnd_06.txt | AC | 40 ms | 3784 KB |
01_rnd_07.txt | AC | 44 ms | 3780 KB |
01_rnd_08.txt | AC | 42 ms | 3784 KB |
01_rnd_09.txt | AC | 42 ms | 3776 KB |
01_rnd_10.txt | AC | 47 ms | 3800 KB |
01_rnd_11.txt | AC | 42 ms | 3788 KB |
01_rnd_12.txt | AC | 40 ms | 3776 KB |
01_rnd_13.txt | AC | 42 ms | 3788 KB |
01_rnd_14.txt | AC | 42 ms | 3788 KB |
01_rnd_15.txt | AC | 42 ms | 3788 KB |
01_rnd_16.txt | AC | 42 ms | 3780 KB |
01_rnd_17.txt | AC | 42 ms | 3784 KB |
01_rnd_18.txt | AC | 40 ms | 3780 KB |
01_rnd_19.txt | AC | 42 ms | 3784 KB |
01_rnd_20.txt | AC | 42 ms | 3780 KB |
01_rnd_21.txt | AC | 43 ms | 3784 KB |
01_rnd_22.txt | AC | 42 ms | 3788 KB |
01_rnd_23.txt | AC | 42 ms | 3776 KB |
01_rnd_24.txt | AC | 43 ms | 3788 KB |
01_rnd_25.txt | AC | 42 ms | 3760 KB |
01_rnd_26.txt | AC | 43 ms | 3784 KB |
01_rnd_27.txt | AC | 43 ms | 3780 KB |
01_rnd_28.txt | AC | 42 ms | 3780 KB |
01_rnd_29.txt | AC | 42 ms | 3780 KB |
01_rnd_30.txt | AC | 40 ms | 3780 KB |
01_rnd_31.txt | AC | 40 ms | 3776 KB |
02_cornerrnd_00.txt | AC | 42 ms | 3796 KB |
02_cornerrnd_01.txt | AC | 42 ms | 3788 KB |
02_cornerrnd_02.txt | AC | 45 ms | 3780 KB |
02_cornerrnd_03.txt | AC | 43 ms | 3744 KB |
02_cornerrnd_04.txt | AC | 42 ms | 3780 KB |
02_cornerrnd_05.txt | AC | 44 ms | 3780 KB |
02_cornerrnd_06.txt | AC | 42 ms | 3780 KB |
02_cornerrnd_07.txt | AC | 43 ms | 3784 KB |
02_cornerrnd_08.txt | AC | 43 ms | 3784 KB |
02_cornerrnd_09.txt | AC | 43 ms | 3796 KB |
02_cornerrnd_10.txt | AC | 44 ms | 3780 KB |
02_cornerrnd_11.txt | AC | 42 ms | 3788 KB |
02_cornerrnd_12.txt | AC | 41 ms | 3780 KB |
02_cornerrnd_13.txt | AC | 42 ms | 3780 KB |
02_cornerrnd_14.txt | AC | 43 ms | 3776 KB |
02_cornerrnd_15.txt | AC | 40 ms | 3788 KB |
02_cornerrnd_16.txt | AC | 42 ms | 3776 KB |
02_cornerrnd_17.txt | AC | 43 ms | 3776 KB |
02_cornerrnd_18.txt | AC | 43 ms | 3768 KB |
02_cornerrnd_19.txt | AC | 43 ms | 3792 KB |
02_cornerrnd_20.txt | AC | 44 ms | 3784 KB |
02_cornerrnd_21.txt | AC | 44 ms | 3776 KB |
02_cornerrnd_22.txt | AC | 40 ms | 3768 KB |
02_cornerrnd_23.txt | AC | 43 ms | 3784 KB |
02_cornerrnd_24.txt | AC | 44 ms | 3784 KB |
02_cornerrnd_25.txt | AC | 43 ms | 3776 KB |
02_cornerrnd_26.txt | AC | 42 ms | 3784 KB |
02_cornerrnd_27.txt | AC | 41 ms | 3784 KB |
02_cornerrnd_28.txt | AC | 41 ms | 3780 KB |
02_cornerrnd_29.txt | AC | 41 ms | 3776 KB |
02_cornerrnd_30.txt | AC | 43 ms | 3780 KB |
02_cornerrnd_31.txt | AC | 42 ms | 3792 KB |