Submission #5189
Source Code Expand
using System; namespace AtCoder2 { class MainClass { public static void Main (string[] args) { int read = Convert.ToInt32(Console.ReadLine()); string r = Console.ReadLine(); int st = Convert.ToInt32(CutString(" ",r)[0]); int go = Convert.ToInt32(CutString(" ",r)[1]); int[][] cs = new int[read][]; for(int i = 0;i < read - 1;i++) { cs[i] = new int[2]; string r2 = Console.ReadLine(); cs[i][0] = Convert.ToInt32(CutString(" ",r2)[0]); cs[i][1] = Convert.ToInt32(CutString(" ",r2)[1]); } int now = st; string ro = st.ToString(); for(int j = 0;j < read - 1;j++) { if(cs[j][0] > now) { ro = ro + "," + cs[j][0]; now = cs[j][0]; } else if(cs[j][1] < now) { ro = ro + "," + cs[j][1]; now = cs[j][1]; } else { ro = ro + "," + now; } } ro += "," + go; string[] hoge = CutString(",",ro); int[] co = new int[hoge.Length]; for(int k = 0;k < hoge.Length;k++) { co[k] = Convert.ToInt32(hoge[k]); } int stackingH = 1; double length = 0; for(int m = 0;m < hoge.Length;m++) { if(m == 0) { } else { if(co[m] - co[m - 1] == 0) { stackingH++; if(m == hoge.Length - 1) { length = length + stackingH - 1; } } else { length = length + GetLongest(stackingH,GetZettaiti(co[m] - co[m - 1])); stackingH = 1; } } } Console.WriteLine(length); } static double GetLongest(int h,int w) { double l = Math.Pow(h,2) + Math.Pow(w,2); return Math.Sqrt(l); } static int GetZettaiti(int input) { int ret = 0; if (input > 0) { ret = input; } else if (input < 0) { ret = -input; } else { ret = 0; } return ret; } public static string[] CutString(string kugiri, string str) { str = str.Replace("\n", "").Replace("\r", ""); string[] dem = { kugiri }; string[] a = str.Split(dem, StringSplitOptions.RemoveEmptyEntries); return a; } } }
Submission Info
Submission Time | |
---|---|
Task | D - レースゲーム |
User | Canno |
Language | C# (Mono 2.10.8.1) |
Score | 0 |
Code Size | 2349 Byte |
Status | TLE |
Exec Time | 2033 ms |
Memory | 23408 KB |
Judge Result
Set Name | all | ||||||
---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||||
Status |
|
Set Name | Test Cases |
---|---|
all | 00_sample1.txt, 00_sample2.txt, 01_rnd_large_00.txt, 01_rnd_large_01.txt, 01_rnd_large_02.txt, 01_rnd_small_00.txt, 01_rnd_small_01.txt, 01_rnd_small_02.txt, 02_narrowrnd_large_00.txt, 02_narrowrnd_large_01.txt, 02_narrowrnd_small_00.txt, 02_narrowrnd_small_01.txt, 03_zigzag_large_00.txt, 03_zigzag_small_00.txt, 04_middle_large_00.txt, 04_middle_large_01.txt, 04_middle_large_02.txt, 04_middle_small_00.txt, 04_middle_small_01.txt, 04_middle_small_02.txt, 05_turnleft_large_00.txt, 05_turnleft_small_00.txt, 06_turnright_large_00.txt, 06_turnright_small_00.txt, 07_free_large_00.txt, 07_free_small_00.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample1.txt | AC | 90 ms | 2896 KB |
00_sample2.txt | AC | 84 ms | 736 KB |
01_rnd_large_00.txt | TLE | 2032 ms | 21072 KB |
01_rnd_large_01.txt | TLE | 2032 ms | 20908 KB |
01_rnd_large_02.txt | TLE | 2032 ms | 21072 KB |
01_rnd_small_00.txt | AC | 99 ms | 1304 KB |
01_rnd_small_01.txt | AC | 103 ms | 748 KB |
01_rnd_small_02.txt | AC | 101 ms | 760 KB |
02_narrowrnd_large_00.txt | TLE | 2032 ms | 20520 KB |
02_narrowrnd_large_01.txt | TLE | 2032 ms | 20820 KB |
02_narrowrnd_small_00.txt | WA | 102 ms | 1448 KB |
02_narrowrnd_small_01.txt | WA | 102 ms | 1012 KB |
03_zigzag_large_00.txt | TLE | 2030 ms | 20840 KB |
03_zigzag_small_00.txt | WA | 99 ms | 1220 KB |
04_middle_large_00.txt | TLE | 2032 ms | 23408 KB |
04_middle_large_01.txt | TLE | 2031 ms | 20516 KB |
04_middle_large_02.txt | TLE | 2033 ms | 23256 KB |
04_middle_small_00.txt | WA | 103 ms | 1344 KB |
04_middle_small_01.txt | AC | 99 ms | 1304 KB |
04_middle_small_02.txt | WA | 103 ms | 848 KB |
05_turnleft_large_00.txt | TLE | 2032 ms | 21068 KB |
05_turnleft_small_00.txt | WA | 99 ms | 1280 KB |
06_turnright_large_00.txt | TLE | 2032 ms | 20560 KB |
06_turnright_small_00.txt | AC | 103 ms | 920 KB |
07_free_large_00.txt | TLE | 2033 ms | 23276 KB |
07_free_small_00.txt | AC | 97 ms | 692 KB |