Submission #322142
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(string.Format("{0:0000}-{1:0000}", toHour(ranges[p - 1].getStart()), toHour(ranges[p - 1].getEnd()))); //Console.WriteLine("{0:D4}" + "-" + "{1:D4}", // toHour(ranges[p - 1].getStart()), toHour(ranges[p - 1].getEnd())); break; } if(en < ranges[p].getStart()) { Console.WriteLine(string.Format("{0:0000}-{1:0000}", toHour(st), toHour(en))); //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 | 3249 Byte |
Status | WA |
Exec Time | 245 ms |
Memory | 9652 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 | 167 ms | 8160 KB |
00_sample_02.txt | AC | 166 ms | 8052 KB |
00_sample_03.txt | AC | 165 ms | 8120 KB |
cho_cho_chokudai.txt | AC | 232 ms | 9640 KB |
chokudai_ga_cho.txt | WA | 228 ms | 9604 KB |
test_01.txt | AC | 172 ms | 8196 KB |
test_02.txt | AC | 170 ms | 8272 KB |
test_03.txt | AC | 173 ms | 8336 KB |
test_04.txt | AC | 172 ms | 8236 KB |
test_05.txt | AC | 170 ms | 8196 KB |
test_06.txt | WA | 166 ms | 8144 KB |
test_07.txt | WA | 168 ms | 8148 KB |
test_08.txt | WA | 168 ms | 8152 KB |
test_09.txt | WA | 170 ms | 8248 KB |
test_10.txt | WA | 170 ms | 8256 KB |
test_11.txt | AC | 172 ms | 8256 KB |
test_12.txt | WA | 170 ms | 8180 KB |
test_13.txt | WA | 167 ms | 8140 KB |
test_14.txt | WA | 171 ms | 8252 KB |
test_15.txt | WA | 170 ms | 8244 KB |
test_16.txt | WA | 172 ms | 8156 KB |
test_17.txt | WA | 170 ms | 8264 KB |
test_18.txt | WA | 169 ms | 8176 KB |
test_19.txt | WA | 172 ms | 8280 KB |
test_20.txt | WA | 169 ms | 8284 KB |
test_21.txt | WA | 234 ms | 9556 KB |
test_22.txt | WA | 231 ms | 9548 KB |
test_23.txt | WA | 234 ms | 9536 KB |
test_24.txt | WA | 230 ms | 9556 KB |
test_25.txt | WA | 233 ms | 9652 KB |
test_26.txt | WA | 238 ms | 9604 KB |
test_27.txt | WA | 234 ms | 9560 KB |
test_28.txt | WA | 237 ms | 9560 KB |
test_29.txt | AC | 166 ms | 8240 KB |
test_30.txt | WA | 177 ms | 8252 KB |
test_31.txt | WA | 180 ms | 8504 KB |
test_32.txt | WA | 169 ms | 8112 KB |
test_33.txt | WA | 208 ms | 9136 KB |
test_34.txt | AC | 166 ms | 8224 KB |
test_35.txt | WA | 171 ms | 8256 KB |
test_36.txt | WA | 233 ms | 9552 KB |
test_37.txt | WA | 245 ms | 9560 KB |
test_38.txt | WA | 234 ms | 9548 KB |
test_39.txt | WA | 232 ms | 9564 KB |
test_40.txt | WA | 233 ms | 9564 KB |
test_41.txt | WA | 225 ms | 9604 KB |
test_42.txt | WA | 232 ms | 9560 KB |
test_43.txt | WA | 223 ms | 9532 KB |