Submission #518550


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().PadLeft( 4, '0' ) + "-" + corrEndTime.ToString().PadLeft( 4, '0' );
					}
					continue;
				}

				margedTimeList.Add( beforeTime );

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


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

Submission Info

Submission Time
Task A - 積雪深差
User kitaita
Language C# (Mono 2.10.8.1)
Score 0
Code Size 2209 Byte
Status RE
Exec Time 142 ms
Memory 8128 KB

Judge Result

Set Name all
Score / Max Score 0 / 100
Status
WA × 3
RE × 17
Set Name Test Cases
all 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.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
Case Name Status Exec Time Memory
00_sample_01.txt RE 129 ms 7868 KB
00_sample_02.txt WA 109 ms 7476 KB
00_sample_03.txt RE 123 ms 7868 KB
test_01.txt WA 111 ms 7464 KB
test_02.txt RE 132 ms 8124 KB
test_03.txt WA 112 ms 7476 KB
test_04.txt RE 134 ms 8124 KB
test_05.txt RE 142 ms 8124 KB
test_06.txt RE 132 ms 7996 KB
test_07.txt RE 133 ms 7992 KB
test_08.txt RE 130 ms 7992 KB
test_09.txt RE 129 ms 7992 KB
test_10.txt RE 124 ms 7736 KB
test_11.txt RE 128 ms 7996 KB
test_12.txt RE 126 ms 7964 KB
test_13.txt RE 129 ms 7976 KB
test_14.txt RE 131 ms 8000 KB
test_15.txt RE 129 ms 7992 KB
test_16.txt RE 131 ms 8128 KB
test_17.txt RE 125 ms 7872 KB