Submission #716392
Source Code Expand
import java.util.Scanner; /** * Created by yon on 2016/05/03. */ public class Main { public static void main(String args[]){ int inputNumber; boolean time[][]; time = new boolean[25][60]; Scanner scan = new Scanner(System.in); inputNumber = scan.nextInt(); //time初期化 for(int hour = 0; hour < 25; hour++){ for(int min = 0; min < 60; min++) time[hour][min] = false; } for(int i=0; i<inputNumber; i++){ String row = scan.next(); String[] rowsplited = row.split("-"); int start[] = new int[2]; int stop[] = new int[2]; start[0] = Integer.valueOf(rowsplited[0].substring(0,2)); start[1] = Integer.valueOf(rowsplited[0].substring(2,4)); stop[0] = Integer.valueOf(rowsplited[1].substring(0,2)); stop[1] = Integer.valueOf(rowsplited[1].substring(2,4)); //start繰り下げ start[1] = start[1] - start[1]%5; //stop繰り上げ if(stop[1]%5 != 0) { stop[1] = stop[1] + (5 - stop[1] % 5); } if(stop[1] == 60){ stop[0]++; stop[1] = 0; } int hour = start[0]; int min = start[1]; //timeに反映 for(;;){ time[hour][min] = true; if(hour == stop[0] && min == stop[1]) break; min++; if(min == 60){ hour++; min = 0; } } } //出力 //直前が雨かどうか boolean before = false; int[] tmpBuf = new int[2]; int[] startBuf = new int[2]; int[] stopBuf = new int[2]; //出力 loop: for(int hour = 0; hour < 25; hour++){ for(int min = 0; min < 60; min++){ if(!before && time[hour][min]){ startBuf = new int[]{hour,min}; } if(before && !time[hour][min]){ stopBuf = new int[]{hour,min-1}; //stopが決まったら出力してBufferリセット; System.out.print(String.format("%1$02d",startBuf[0])); System.out.print(String.format("%1$02d",startBuf[1])); System.out.print("-"); System.out.print(String.format("%1$02d",stopBuf[0])); System.out.print(String.format("%1$02d",stopBuf[1])); System.out.println(); } before = time[hour][min]; tmpBuf[0] = hour; tmpBuf[1] = min; } } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | osamw |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 2886 Byte |
Status | AC |
Exec Time | 957 ms |
Memory | 38912 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 | 353 ms | 22956 KB |
00_sample_02.txt | AC | 345 ms | 22920 KB |
00_sample_03.txt | AC | 347 ms | 23024 KB |
cho_cho_chokudai.txt | AC | 844 ms | 37004 KB |
chokudai_ga_cho.txt | AC | 809 ms | 36240 KB |
test_01.txt | AC | 440 ms | 23928 KB |
test_02.txt | AC | 449 ms | 24032 KB |
test_03.txt | AC | 442 ms | 23928 KB |
test_04.txt | AC | 439 ms | 23884 KB |
test_05.txt | AC | 438 ms | 23952 KB |
test_06.txt | AC | 396 ms | 25264 KB |
test_07.txt | AC | 388 ms | 25276 KB |
test_08.txt | AC | 385 ms | 24572 KB |
test_09.txt | AC | 437 ms | 25752 KB |
test_10.txt | AC | 446 ms | 26552 KB |
test_11.txt | AC | 433 ms | 26448 KB |
test_12.txt | AC | 414 ms | 25424 KB |
test_13.txt | AC | 399 ms | 25188 KB |
test_14.txt | AC | 458 ms | 26680 KB |
test_15.txt | AC | 454 ms | 25828 KB |
test_16.txt | AC | 397 ms | 25132 KB |
test_17.txt | AC | 444 ms | 26512 KB |
test_18.txt | AC | 425 ms | 25288 KB |
test_19.txt | AC | 433 ms | 26208 KB |
test_20.txt | AC | 431 ms | 25620 KB |
test_21.txt | AC | 827 ms | 35620 KB |
test_22.txt | AC | 792 ms | 35484 KB |
test_23.txt | AC | 805 ms | 36412 KB |
test_24.txt | AC | 813 ms | 36104 KB |
test_25.txt | AC | 831 ms | 36416 KB |
test_26.txt | AC | 851 ms | 38372 KB |
test_27.txt | AC | 867 ms | 37964 KB |
test_28.txt | AC | 827 ms | 36732 KB |
test_29.txt | AC | 361 ms | 22980 KB |
test_30.txt | AC | 373 ms | 23096 KB |
test_31.txt | AC | 647 ms | 32524 KB |
test_32.txt | AC | 369 ms | 22972 KB |
test_33.txt | AC | 850 ms | 38836 KB |
test_34.txt | AC | 364 ms | 23060 KB |
test_35.txt | AC | 393 ms | 23652 KB |
test_36.txt | AC | 832 ms | 36552 KB |
test_37.txt | AC | 934 ms | 38912 KB |
test_38.txt | AC | 862 ms | 37260 KB |
test_39.txt | AC | 865 ms | 38288 KB |
test_40.txt | AC | 849 ms | 38136 KB |
test_41.txt | AC | 829 ms | 35480 KB |
test_42.txt | AC | 933 ms | 36632 KB |
test_43.txt | AC | 957 ms | 36244 KB |