Submission #327014


Source Code Expand

import java.util.Scanner;
public class Main {
 
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		boolean[] isTrue = new boolean[1442];
		int N = stdIn.nextInt();
		for(int i = 0; i < N; i++) {
			String ss = stdIn.next();
			String[] ps = ss.split("-");
			int s = Integer.parseInt(ps[0]);
			int e = Integer.parseInt(ps[1]);
			s = SR(s);
			e = ER(e);
			s = (s/100)*60 + s % 100;
			e = (e/100)*60 + e % 100;
			
			for(int j = s; j <= e; j++) {
				isTrue[j] = true;
			}
		}
		boolean nowRain = false;
		int stRain = 0;
		for(int i = 0; i < 1442; i++) {
			if(nowRain && !isTrue[i]) {
				String hs = String.valueOf(stRain/60);
				if(hs.length() == 1) hs = "0" + hs;
				String ms = String.valueOf(stRain%60);
				if(ms.length() == 1) ms = "0" + ms;
				String he = String.valueOf((i-1)/60);
				if(he.length() == 1) he = "0" + he;
				String me = String.valueOf((i-1)%60);
				if(me.length() == 1) me = "0" + me;
				
				System.out.println(hs + ms + "-" + he + me);
				nowRain = false;
			}
			else if(!nowRain && isTrue[i]) {
				nowRain = true;
				stRain = i;
			}
			
		}
	}
	
	public static int SR(int a) {
		if(a % 10 <= 4 && a % 10 >= 1) {
			a -= a%10;
		}
		else if(a % 10 <= 9 && a % 10 >= 6) {
			a -= a%10-5;
		}
		return a;
	}
	public static int ER(int a) {
		if(a % 10 <= 4 && a % 10 >= 1) {
			a += 5-a%10;
		}
		else if(a % 10 <= 9 && a % 10 >= 6) {
			a += 10-a%10;
			if(a % 100 >= 60) {
				a += 100;
				a -= 60;
			}
		}
		return a;
	}
}

Submission Info

Submission Time
Task D - 感雨時刻の整理
User XzA_2123
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 1571 Byte
Status AC
Exec Time 1282 ms
Memory 38208 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 48
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 526 ms 23028 KB
00_sample_02.txt AC 515 ms 22860 KB
00_sample_03.txt AC 512 ms 22976 KB
cho_cho_chokudai.txt AC 956 ms 37132 KB
chokudai_ga_cho.txt AC 908 ms 38208 KB
test_01.txt AC 523 ms 23160 KB
test_02.txt AC 528 ms 23108 KB
test_03.txt AC 529 ms 23144 KB
test_04.txt AC 519 ms 23148 KB
test_05.txt AC 511 ms 23164 KB
test_06.txt AC 517 ms 24216 KB
test_07.txt AC 507 ms 24068 KB
test_08.txt AC 505 ms 23848 KB
test_09.txt AC 552 ms 24324 KB
test_10.txt AC 594 ms 24656 KB
test_11.txt AC 572 ms 24556 KB
test_12.txt AC 573 ms 24196 KB
test_13.txt AC 558 ms 24408 KB
test_14.txt AC 605 ms 24524 KB
test_15.txt AC 579 ms 24632 KB
test_16.txt AC 555 ms 24324 KB
test_17.txt AC 564 ms 24584 KB
test_18.txt AC 521 ms 24228 KB
test_19.txt AC 536 ms 24612 KB
test_20.txt AC 538 ms 24788 KB
test_21.txt AC 889 ms 35952 KB
test_22.txt AC 1282 ms 37480 KB
test_23.txt AC 883 ms 36744 KB
test_24.txt AC 876 ms 35932 KB
test_25.txt AC 897 ms 37236 KB
test_26.txt AC 868 ms 37032 KB
test_27.txt AC 923 ms 38056 KB
test_28.txt AC 897 ms 37712 KB
test_29.txt AC 483 ms 22828 KB
test_30.txt AC 483 ms 22928 KB
test_31.txt AC 690 ms 28528 KB
test_32.txt AC 493 ms 22940 KB
test_33.txt AC 858 ms 36472 KB
test_34.txt AC 481 ms 22924 KB
test_35.txt AC 509 ms 23476 KB
test_36.txt AC 892 ms 36856 KB
test_37.txt AC 873 ms 36012 KB
test_38.txt AC 869 ms 35692 KB
test_39.txt AC 902 ms 35448 KB
test_40.txt AC 904 ms 36316 KB
test_41.txt AC 959 ms 37656 KB
test_42.txt AC 946 ms 36764 KB
test_43.txt AC 940 ms 36800 KB