Submission #518347


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RainTime {
	class Program {
		static void Main( string[] args ) {
			int count = int.Parse( Console.ReadLine() );

			List<String> timeList = new List<string>();
			for( int i = 0; i < count; i++ ) {
				timeList.Add( Console.ReadLine() );
			}
			timeList.Sort();

			List<String> roundedTimeList = new List<string>();
			foreach( String time in timeList ) {
				int startHour = int.Parse( time.Substring( 0, 2 ) );
				int startMin = int.Parse( time.Substring( 2, 2 ) );

				int endHour = int.Parse( time.Substring( 5, 2 ) );
				int endMin = int.Parse( time.Substring( 7, 2 ) );

				int roundedStartMin = startMin;
				if( startMin % 5 != 0 ) {
					roundedStartMin = ( startMin / 5 ) * 5;
				}

				int roundedEndMin = endMin;
				if( endMin % 5 != 0 ) {
					roundedEndMin = ( endMin / 5 + 1 ) * 5;
				}
				if( roundedEndMin == 60 ) {
					roundedEndMin = 0;
					endHour++;
				}

				roundedTimeList.Add( 
					startHour.ToString().PadLeft(2,'0') +
					roundedStartMin.ToString().PadLeft( 2, '0' ) + "-" +
					endHour.ToString().PadLeft( 2, '0' ) +
					roundedEndMin.ToString().PadLeft( 2, '0' )
					);
			}

			List<string> margedTimeList = new List<string>();
			string beforeTime = string.Empty;
			foreach( String rTime in roundedTimeList ) {
				if( beforeTime == string.Empty ) {
					beforeTime = rTime;
					continue;
				}

				int beforeStartTime = int.Parse( beforeTime.Substring( 0, 4 ) );
				int beforeEndTime = int.Parse( beforeTime.Substring( 5, 4 ) );
				int corrStartTime = int.Parse( rTime.Substring( 0, 4 ) );
				int corrEndTime = int.Parse( rTime.Substring( 5, 4 ) );

				if( corrStartTime <= beforeEndTime && beforeEndTime <= corrEndTime ) {
					beforeTime = beforeStartTime.ToString() + "-" + corrEndTime.ToString();
					continue;
				}

				margedTimeList.Add( beforeTime );

				beforeTime = rTime;
			}
			margedTimeList.Add( beforeTime );


			foreach(string mTime in margedTimeList){
				Console.WriteLine( mTime );
			}
		}
	}
}

Submission Info

Submission Time
Task D - 感雨時刻の整理
User kitaita
Language C# (Mono 2.10.8.1)
Score 0
Code Size 2153 Byte
Status RE
Exec Time 1135 ms
Memory 13356 KB

Judge Result

Set Name all
Score / Max Score 0 / 100
Status
AC × 9
WA × 1
RE × 38
Set Name Test Cases
all 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, cho_cho_chokudai.txt, chokudai_ga_cho.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 160 ms 8520 KB
00_sample_02.txt AC 130 ms 7904 KB
00_sample_03.txt WA 158 ms 8504 KB
cho_cho_chokudai.txt RE 734 ms 13232 KB
chokudai_ga_cho.txt RE 839 ms 13320 KB
test_01.txt AC 169 ms 8548 KB
test_02.txt AC 167 ms 8508 KB
test_03.txt AC 164 ms 8496 KB
test_04.txt AC 166 ms 8528 KB
test_05.txt AC 169 ms 8504 KB
test_06.txt RE 168 ms 8560 KB
test_07.txt RE 166 ms 8532 KB
test_08.txt RE 162 ms 8504 KB
test_09.txt RE 177 ms 8584 KB
test_10.txt RE 177 ms 8548 KB
test_11.txt RE 170 ms 8528 KB
test_12.txt RE 171 ms 8548 KB
test_13.txt RE 169 ms 8552 KB
test_14.txt RE 178 ms 8544 KB
test_15.txt RE 179 ms 8624 KB
test_16.txt RE 168 ms 8504 KB
test_17.txt RE 172 ms 8552 KB
test_18.txt RE 168 ms 8520 KB
test_19.txt RE 171 ms 8544 KB
test_20.txt RE 171 ms 8552 KB
test_21.txt RE 1062 ms 13164 KB
test_22.txt RE 1090 ms 13356 KB
test_23.txt RE 1070 ms 13208 KB
test_24.txt RE 1090 ms 13216 KB
test_25.txt RE 1108 ms 13248 KB
test_26.txt RE 853 ms 13160 KB
test_27.txt RE 671 ms 13236 KB
test_28.txt RE 940 ms 13220 KB
test_29.txt AC 131 ms 7776 KB
test_30.txt RE 160 ms 8504 KB
test_31.txt RE 264 ms 9156 KB
test_32.txt RE 160 ms 8504 KB
test_33.txt RE 645 ms 12048 KB
test_34.txt AC 157 ms 8512 KB
test_35.txt RE 164 ms 8624 KB
test_36.txt RE 1135 ms 13248 KB
test_37.txt RE 919 ms 13232 KB
test_38.txt RE 889 ms 13120 KB
test_39.txt RE 1016 ms 13356 KB
test_40.txt RE 983 ms 13216 KB
test_41.txt RE 738 ms 13248 KB
test_42.txt RE 857 ms 13120 KB
test_43.txt RE 730 ms 13332 KB