Submission #199788


Source Code Expand

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);

	void run() {
		int N = sc.nextInt();
		String[][] info = new String[N][2];
		for (int i = 0; i < N; i++) {
			String[] input = sc.next().split("-");
			info[i][0] = input[0];
			info[i][1] = input[1];
		}
		boolean[] rain = new boolean[2401];
		for (int i = 0; i < N; i++) {
			int s = Integer.valueOf(info[i][0]);
			int t = Integer.valueOf(info[i][1]);
			if (s % 5 != 0) {
				s -= (s % 5);
			}
			if (t % 5 != 0) {
				t += (5 - (t % 5));
			}
			if (t >= 10) {
				if ((t + "")
						.substring((t + "").length() - 2, (t + "").length())
						.equals("60")) {
					t += 40;
				}
			}
			for (int j = s; j <= t; j++) {
				rain[j] = true;
			}
		}
		for (int i = 0; i <= 2400; i++) {
			if (rain[i]) {
				String start = i + "";
				while (i <= 2400 && rain[i]) {
					i++;
				}
				i--;
				String goal = i + "";
				while (start.length() < 4) {
					start = "0" + start;
				}
				while (goal.length() < 4) {
					goal = "0" + goal;
				}
				if (goal.substring(2, 4).equals("60")) {
					goal = goal.charAt(0) + ""
							+ +(Integer.valueOf(goal.charAt(1) - '0') + 1)
							+ "00";
				}
				System.out.println(start + "-" + goal);
			}
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}
	}
}

Submission Info

Submission Time
Task D - 感雨時刻の整理
User suigingin
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 2558 Byte
Status AC
Exec Time 925 ms
Memory 38448 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 447 ms 19300 KB
00_sample_02.txt AC 427 ms 19308 KB
00_sample_03.txt AC 469 ms 19312 KB
cho_cho_chokudai.txt AC 925 ms 35832 KB
chokudai_ga_cho.txt AC 802 ms 36312 KB
test_01.txt AC 448 ms 19560 KB
test_02.txt AC 462 ms 19564 KB
test_03.txt AC 451 ms 19676 KB
test_04.txt AC 448 ms 19392 KB
test_05.txt AC 431 ms 19552 KB
test_06.txt AC 451 ms 21116 KB
test_07.txt AC 439 ms 20444 KB
test_08.txt AC 439 ms 20160 KB
test_09.txt AC 483 ms 23220 KB
test_10.txt AC 491 ms 23168 KB
test_11.txt AC 480 ms 21944 KB
test_12.txt AC 477 ms 22180 KB
test_13.txt AC 454 ms 20208 KB
test_14.txt AC 491 ms 22544 KB
test_15.txt AC 493 ms 22940 KB
test_16.txt AC 443 ms 20204 KB
test_17.txt AC 595 ms 22476 KB
test_18.txt AC 464 ms 20012 KB
test_19.txt AC 466 ms 21964 KB
test_20.txt AC 452 ms 21564 KB
test_21.txt AC 772 ms 36904 KB
test_22.txt AC 788 ms 35888 KB
test_23.txt AC 766 ms 36848 KB
test_24.txt AC 790 ms 36960 KB
test_25.txt AC 769 ms 36696 KB
test_26.txt AC 775 ms 37588 KB
test_27.txt AC 762 ms 38448 KB
test_28.txt AC 757 ms 35980 KB
test_29.txt AC 425 ms 19368 KB
test_30.txt AC 426 ms 19396 KB
test_31.txt AC 588 ms 27056 KB
test_32.txt AC 422 ms 19280 KB
test_33.txt AC 746 ms 36268 KB
test_34.txt AC 427 ms 19316 KB
test_35.txt AC 435 ms 19520 KB
test_36.txt AC 765 ms 36056 KB
test_37.txt AC 809 ms 37340 KB
test_38.txt AC 803 ms 37572 KB
test_39.txt AC 812 ms 36032 KB
test_40.txt AC 794 ms 36472 KB
test_41.txt AC 814 ms 35744 KB
test_42.txt AC 822 ms 35748 KB
test_43.txt AC 846 ms 35992 KB