Submission #322140
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtCoderBeginner { class Program { static int ReadInt() { return int.Parse(Console.ReadLine()); } static int toMinute(int time) { return (time/100) * 60+time % 100; } static int toHour(int time) { return (time / 60 * 100) + (time % 60); } static void Main(string[] args) { int n = ReadInt(); //一日の五分区切り 24時間×60分/5分 int[] time = new int[24 * 60 / 5]; Range[] ranges = new Range[n]; for(int i=0;i<n;i++) { String[] s = Console.ReadLine().Split('-'); int start = toMinute(int.Parse(s[0])); int end = toMinute(int.Parse(s[1])); start = start - start % 5; if (end % 5 != 0) end = end + (5 - end % 5); ranges[i] = new Range(start,end); } //並び替え Array.Sort(ranges); int p = 1; int st = ranges[0].getStart(); int en = ranges[0].getEnd(); while(p <= n) { if(p == n) { Console.WriteLine("{0:D4}" + "-" + "{1:D4}", toHour(ranges[p - 1].getStart()), toHour(ranges[p - 1].getEnd())); break; } if(en < ranges[p].getStart()) { Console.WriteLine("{0:D4}" + "-" + "{1:D4}",toHour(st), toHour(en)); st = ranges[p].getStart(); en = ranges[p].getEnd(); } if (st <= ranges[p].getStart() && en >= ranges[p].getStart()) { if (en < ranges[p].getEnd()) { en = ranges[p].getEnd(); } } p++; } } } class Range :IComparable { int start; int end; public Range(int start,int end) { this.start = start; this.end = end; } public int getStart() { return start; } public int getEnd() { return end; } public int CompareTo(object o) { if (o == null) return 1; Range otherRange = o as Range; if(otherRange != null) { return this.start.CompareTo(otherRange.start); } else { throw new ArgumentException("Object is not a RangeClass"); } } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | tookunn |
Language | C# (Mono 2.10.8.1) |
Score | 0 |
Code Size | 3001 Byte |
Status | WA |
Exec Time | 189 ms |
Memory | 9404 KB |
Judge Result
Set Name | all | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||
Status |
|
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 | 113 ms | 7984 KB |
00_sample_02.txt | AC | 109 ms | 7900 KB |
00_sample_03.txt | AC | 114 ms | 7852 KB |
cho_cho_chokudai.txt | AC | 177 ms | 9316 KB |
chokudai_ga_cho.txt | WA | 171 ms | 9392 KB |
test_01.txt | AC | 114 ms | 7984 KB |
test_02.txt | AC | 116 ms | 8004 KB |
test_03.txt | AC | 113 ms | 7968 KB |
test_04.txt | AC | 113 ms | 7984 KB |
test_05.txt | AC | 114 ms | 7968 KB |
test_06.txt | WA | 113 ms | 7868 KB |
test_07.txt | WA | 114 ms | 7984 KB |
test_08.txt | WA | 116 ms | 7856 KB |
test_09.txt | WA | 119 ms | 7988 KB |
test_10.txt | WA | 121 ms | 7980 KB |
test_11.txt | AC | 116 ms | 7992 KB |
test_12.txt | WA | 118 ms | 7992 KB |
test_13.txt | WA | 116 ms | 7872 KB |
test_14.txt | WA | 114 ms | 7984 KB |
test_15.txt | WA | 113 ms | 7996 KB |
test_16.txt | WA | 113 ms | 7856 KB |
test_17.txt | WA | 113 ms | 7988 KB |
test_18.txt | WA | 117 ms | 7996 KB |
test_19.txt | WA | 115 ms | 7984 KB |
test_20.txt | WA | 116 ms | 7984 KB |
test_21.txt | WA | 189 ms | 9404 KB |
test_22.txt | WA | 181 ms | 9300 KB |
test_23.txt | WA | 181 ms | 9396 KB |
test_24.txt | WA | 183 ms | 9396 KB |
test_25.txt | WA | 181 ms | 9392 KB |
test_26.txt | WA | 181 ms | 9396 KB |
test_27.txt | WA | 184 ms | 9400 KB |
test_28.txt | WA | 184 ms | 9404 KB |
test_29.txt | AC | 112 ms | 7872 KB |
test_30.txt | WA | 115 ms | 7904 KB |
test_31.txt | WA | 131 ms | 8136 KB |
test_32.txt | WA | 116 ms | 7848 KB |
test_33.txt | WA | 156 ms | 8760 KB |
test_34.txt | AC | 114 ms | 7856 KB |
test_35.txt | WA | 113 ms | 7996 KB |
test_36.txt | WA | 179 ms | 9308 KB |
test_37.txt | WA | 179 ms | 9400 KB |
test_38.txt | WA | 180 ms | 9400 KB |
test_39.txt | WA | 179 ms | 9312 KB |
test_40.txt | WA | 179 ms | 9392 KB |
test_41.txt | WA | 168 ms | 9392 KB |
test_42.txt | WA | 182 ms | 9396 KB |
test_43.txt | WA | 171 ms | 9404 KB |