Submission #518353


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 ) {
					if( 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 2173 Byte
Status RE
Exec Time 1127 ms
Memory 13488 KB

Judge Result

Set Name all
Score / Max Score 0 / 100
Status
AC × 10
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 165 ms 8728 KB
00_sample_02.txt AC 134 ms 8028 KB
00_sample_03.txt AC 160 ms 8704 KB
cho_cho_chokudai.txt RE 737 ms 13488 KB
chokudai_ga_cho.txt RE 846 ms 13440 KB
test_01.txt AC 167 ms 8736 KB
test_02.txt AC 169 ms 8760 KB
test_03.txt AC 172 ms 8816 KB
test_04.txt AC 171 ms 8776 KB
test_05.txt AC 170 ms 8740 KB
test_06.txt RE 174 ms 8792 KB
test_07.txt RE 168 ms 8740 KB
test_08.txt RE 168 ms 8796 KB
test_09.txt RE 174 ms 8792 KB
test_10.txt RE 177 ms 8848 KB
test_11.txt RE 170 ms 8900 KB
test_12.txt RE 173 ms 8792 KB
test_13.txt RE 173 ms 8792 KB
test_14.txt RE 182 ms 8888 KB
test_15.txt RE 181 ms 8760 KB
test_16.txt RE 170 ms 8732 KB
test_17.txt RE 182 ms 8788 KB
test_18.txt RE 170 ms 8760 KB
test_19.txt RE 182 ms 8760 KB
test_20.txt RE 179 ms 8796 KB
test_21.txt RE 1055 ms 13476 KB
test_22.txt RE 1088 ms 13456 KB
test_23.txt RE 1088 ms 13256 KB
test_24.txt RE 1093 ms 13464 KB
test_25.txt RE 1111 ms 13364 KB
test_26.txt RE 842 ms 13360 KB
test_27.txt RE 690 ms 13460 KB
test_28.txt RE 943 ms 13396 KB
test_29.txt AC 140 ms 7908 KB
test_30.txt RE 177 ms 8664 KB
test_31.txt RE 277 ms 9400 KB
test_32.txt RE 176 ms 8744 KB
test_33.txt RE 665 ms 12216 KB
test_34.txt AC 167 ms 8620 KB
test_35.txt RE 173 ms 8748 KB
test_36.txt RE 1127 ms 13368 KB
test_37.txt RE 935 ms 13364 KB
test_38.txt RE 905 ms 13344 KB
test_39.txt RE 1034 ms 13480 KB
test_40.txt RE 998 ms 13472 KB
test_41.txt RE 741 ms 13484 KB
test_42.txt RE 848 ms 13360 KB
test_43.txt RE 740 ms 13488 KB