Submission #140795
Source Code Expand
import java.util.Scanner; /** * Created by kyuuban on 14/03/08. */ public class Main { static boolean[] array = new boolean[289]; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = Integer.parseInt(scanner.nextLine()); for(int i = 0 ; i < n ; i++) { String[] times = scanner.nextLine().split("-"); int start = Integer.parseInt(times[0]); int end = Integer.parseInt(times[1]); fill(getIndex(start), getIndex(end + 4)); } StringBuilder builder = new StringBuilder(); boolean last = false; for(int i = 0 ; i < array.length ; i++) { if(!last && array[i]) { builder.append(getTime(i)); builder.append("-"); } if(last && !array[i]) { builder.append(getTime(i)); builder.append("\n"); } last = array[i]; } if(last) { builder.append(getTime(array.length - 1)); builder.append("\n"); } System.out.print(builder.toString()); } static String getTime(int index) { int h = index / 12; int m = index % 12 * 5; return String.format("%02d%02d", h, m); } static int getIndex(int num) { int h = num / 100; int m = num % 100; return h * 12 + m / 5; } static void fill(int start, int end) { for(int i = start ; i < end ; i++) array[i] = true; } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | orekyuu |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 1621 Byte |
Status | AC |
Exec Time | 882 ms |
Memory | 34952 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 | 456 ms | 21156 KB |
00_sample_02.txt | AC | 385 ms | 21164 KB |
00_sample_03.txt | AC | 393 ms | 21256 KB |
cho_cho_chokudai.txt | AC | 867 ms | 34952 KB |
chokudai_ga_cho.txt | AC | 825 ms | 33888 KB |
test_01.txt | AC | 428 ms | 22292 KB |
test_02.txt | AC | 424 ms | 22280 KB |
test_03.txt | AC | 443 ms | 22312 KB |
test_04.txt | AC | 434 ms | 22296 KB |
test_05.txt | AC | 433 ms | 22296 KB |
test_06.txt | AC | 400 ms | 22176 KB |
test_07.txt | AC | 401 ms | 21672 KB |
test_08.txt | AC | 389 ms | 21420 KB |
test_09.txt | AC | 423 ms | 23296 KB |
test_10.txt | AC | 431 ms | 23304 KB |
test_11.txt | AC | 422 ms | 22948 KB |
test_12.txt | AC | 411 ms | 22564 KB |
test_13.txt | AC | 399 ms | 21924 KB |
test_14.txt | AC | 428 ms | 23080 KB |
test_15.txt | AC | 439 ms | 23460 KB |
test_16.txt | AC | 425 ms | 21784 KB |
test_17.txt | AC | 452 ms | 23328 KB |
test_18.txt | AC | 415 ms | 22172 KB |
test_19.txt | AC | 430 ms | 22700 KB |
test_20.txt | AC | 425 ms | 22928 KB |
test_21.txt | AC | 847 ms | 34568 KB |
test_22.txt | AC | 850 ms | 34676 KB |
test_23.txt | AC | 860 ms | 34720 KB |
test_24.txt | AC | 842 ms | 34344 KB |
test_25.txt | AC | 846 ms | 34304 KB |
test_26.txt | AC | 865 ms | 34548 KB |
test_27.txt | AC | 837 ms | 34440 KB |
test_28.txt | AC | 827 ms | 34856 KB |
test_29.txt | AC | 384 ms | 21288 KB |
test_30.txt | AC | 393 ms | 21416 KB |
test_31.txt | AC | 578 ms | 30360 KB |
test_32.txt | AC | 385 ms | 21416 KB |
test_33.txt | AC | 802 ms | 34764 KB |
test_34.txt | AC | 385 ms | 21120 KB |
test_35.txt | AC | 558 ms | 22048 KB |
test_36.txt | AC | 827 ms | 34624 KB |
test_37.txt | AC | 845 ms | 34772 KB |
test_38.txt | AC | 842 ms | 34276 KB |
test_39.txt | AC | 841 ms | 33692 KB |
test_40.txt | AC | 858 ms | 34332 KB |
test_41.txt | AC | 882 ms | 34348 KB |
test_42.txt | AC | 848 ms | 33924 KB |
test_43.txt | AC | 859 ms | 34752 KB |