Submission #1125917
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; //ver1.5 namespace abc01 { class Program { static void Main(string[] args) { int[] ans = new int[(24 * 60 / 5)+1]; for (int i = 0; i < ans.Length; i++) { ans[i] = 0; } List<string> input = new List<string>(); int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { input.Add(Console.ReadLine()); } input.Sort(); for (int i = 0; i < n; i++) { var inp = Array.ConvertAll(input[i].Split('-'), int.Parse); int s = FiveRoundingS(inp[0]); int e = FiveRoundingE(inp[1]); int sM =TimeToM(s)/5; int eM = TimeToM(e)/5; //for (int j = sM; j < eM; j++) { // ans[j] = 1; //} ans[sM] += 1; ans[eM] -= 1; } for(int i = 1; i < ans.Length; i++) { ans[i] += ans[i - 1]; } for(int i = 0; i < ans.Length; i++) { if (ans[i] >= 1) { Console.Write(mToTime(i*5).ToString("D4")); while (ans[i] >= 1) { i++; } Console.WriteLine("-"+mToTime(i*5).ToString("D4")); } } } static int TimeToM(int time) { int ans= (time / 100) * 60 + (time % 100); return ans; } static int mToTime(int minutes) { int h = minutes / 60; int m = minutes % 60; return h * 100 + m; ; } static int FiveRoundingS(int n) { int tmp1 = (n / 100) * 100; int tmp2 = n % 100; if (tmp2 % 10 == 0) { } else if (tmp2 % 10 > 5) { tmp2 = (tmp2 / 10) * 10 + 5; } else if (tmp2 % 10 < 5) { tmp2 = (tmp2 / 10) * 10; } return tmp1 + tmp2; } static int FiveRoundingE(int n) { int tmp1 = (n / 100) * 100; int tmp2 = n % 100; if (tmp2 % 10 == 0) { } else if (tmp2 % 10 > 5) { tmp2 = (tmp2 / 10) * 10 + 10; } else if (tmp2 % 10 < 5) { tmp2 = (tmp2 / 10) * 10 + 5; } return tmp1 + tmp2; } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | rui0422 |
Language | C# (Mono 4.6.2.0) |
Score | 100 |
Code Size | 2574 Byte |
Status | AC |
Exec Time | 553 ms |
Memory | 21216 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 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 | 25 ms | 11360 KB |
00_sample_02.txt | AC | 21 ms | 11092 KB |
00_sample_03.txt | AC | 25 ms | 11360 KB |
cho_cho_chokudai.txt | AC | 339 ms | 19168 KB |
chokudai_ga_cho.txt | AC | 449 ms | 15072 KB |
test_01.txt | AC | 26 ms | 11360 KB |
test_02.txt | AC | 27 ms | 13408 KB |
test_03.txt | AC | 27 ms | 13408 KB |
test_04.txt | AC | 26 ms | 11360 KB |
test_05.txt | AC | 26 ms | 9312 KB |
test_06.txt | AC | 27 ms | 11360 KB |
test_07.txt | AC | 26 ms | 11360 KB |
test_08.txt | AC | 25 ms | 11360 KB |
test_09.txt | AC | 29 ms | 11360 KB |
test_10.txt | AC | 30 ms | 11456 KB |
test_11.txt | AC | 27 ms | 11360 KB |
test_12.txt | AC | 28 ms | 11360 KB |
test_13.txt | AC | 26 ms | 9312 KB |
test_14.txt | AC | 31 ms | 11360 KB |
test_15.txt | AC | 32 ms | 13408 KB |
test_16.txt | AC | 26 ms | 11360 KB |
test_17.txt | AC | 30 ms | 11360 KB |
test_18.txt | AC | 27 ms | 11476 KB |
test_19.txt | AC | 29 ms | 11360 KB |
test_20.txt | AC | 29 ms | 11476 KB |
test_21.txt | AC | 521 ms | 17120 KB |
test_22.txt | AC | 547 ms | 17120 KB |
test_23.txt | AC | 516 ms | 17120 KB |
test_24.txt | AC | 534 ms | 19168 KB |
test_25.txt | AC | 526 ms | 21216 KB |
test_26.txt | AC | 422 ms | 17120 KB |
test_27.txt | AC | 300 ms | 17120 KB |
test_28.txt | AC | 462 ms | 15072 KB |
test_29.txt | AC | 22 ms | 9044 KB |
test_30.txt | AC | 26 ms | 11360 KB |
test_31.txt | AC | 80 ms | 9440 KB |
test_32.txt | AC | 25 ms | 11360 KB |
test_33.txt | AC | 288 ms | 20828 KB |
test_34.txt | AC | 26 ms | 13408 KB |
test_35.txt | AC | 27 ms | 9312 KB |
test_36.txt | AC | 553 ms | 15072 KB |
test_37.txt | AC | 451 ms | 15072 KB |
test_38.txt | AC | 448 ms | 17120 KB |
test_39.txt | AC | 503 ms | 21216 KB |
test_40.txt | AC | 472 ms | 21216 KB |
test_41.txt | AC | 369 ms | 19168 KB |
test_42.txt | AC | 404 ms | 19168 KB |
test_43.txt | AC | 360 ms | 15072 KB |