Submission #157774


Source Code Expand

import java.io.*;

class RainMemo {
	BufferedReader reader;
	void solve() {
		try {
			reader = new BufferedReader(new InputStreamReader(System.in));
			int n = ni();
			boolean[] check = new boolean[60/5*24+1];
			int sh, sm, eh, em;
			for(int i = 0;i < n;i++) {
				int[] period = nis();
				sh = period[0]/100;
				sm = period[0]%100;
				eh = period[1]/100;
				em = period[1]%100;
				int s = sh*12+sm/5;
				int e = eh*12+em/5+(em%5>0 ? 1 : 0);
				for(int j = s;j < e;j++) {
					check[j] = true;
				}
			}
			boolean flag = false;
			for(int i = 0;i < check.length;i++) {
				if(!flag && check[i]) {
					sh = i/12;
					sm = (i-sh*12)*5;
					System.out.print((sh<10 ? "0" : "") + sh + (sm<10 ? "0" : "") + sm + "-");
					flag = true;
				}
				if(flag && !check[i]) {
					eh = i/12;
					em = (i-eh*12)*5;
					System.out.println((eh<10 ? "0" : "") + eh + (em<10 ? "0" : "") + em);
					flag = false;
				}	
			}
		}
		catch(Exception e){
			e.printStackTrace();
		}
	}
	int[] nis() throws IOException {
		String[] str = nss();
		int[] ans = new int[str.length];
		for(int i = 0;i < str.length;i++) {
			ans[i] = Integer.parseInt(str[i]);
		}
		return ans;
	}
	int ni() throws IOException {
		return Integer.parseInt(ns());
	}
	String ns() throws IOException {
		return reader.readLine();
	}
	String[] nss() throws IOException {
		return ns().split("-");
	}
}
public class Main {
	public static void main(String[] args) {
		new RainMemo().solve();
	}
}

Submission Info

Submission Time
Task D - 感雨時刻の整理
User tanshiono
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 1530 Byte
Status AC
Exec Time 852 ms
Memory 33924 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 852 ms 20372 KB
00_sample_02.txt AC 385 ms 20520 KB
00_sample_03.txt AC 390 ms 20400 KB
cho_cho_chokudai.txt AC 748 ms 32680 KB
chokudai_ga_cho.txt AC 631 ms 32808 KB
test_01.txt AC 400 ms 20524 KB
test_02.txt AC 398 ms 20520 KB
test_03.txt AC 400 ms 20532 KB
test_04.txt AC 404 ms 20532 KB
test_05.txt AC 400 ms 20528 KB
test_06.txt AC 406 ms 21040 KB
test_07.txt AC 400 ms 21040 KB
test_08.txt AC 402 ms 20840 KB
test_09.txt AC 410 ms 22048 KB
test_10.txt AC 429 ms 21928 KB
test_11.txt AC 401 ms 21040 KB
test_12.txt AC 418 ms 22320 KB
test_13.txt AC 394 ms 20516 KB
test_14.txt AC 419 ms 21800 KB
test_15.txt AC 419 ms 22680 KB
test_16.txt AC 403 ms 20520 KB
test_17.txt AC 415 ms 21288 KB
test_18.txt AC 399 ms 20496 KB
test_19.txt AC 409 ms 20960 KB
test_20.txt AC 420 ms 21044 KB
test_21.txt AC 629 ms 32820 KB
test_22.txt AC 601 ms 31688 KB
test_23.txt AC 638 ms 32828 KB
test_24.txt AC 601 ms 33000 KB
test_25.txt AC 574 ms 31604 KB
test_26.txt AC 610 ms 33832 KB
test_27.txt AC 622 ms 33360 KB
test_28.txt AC 632 ms 33384 KB
test_29.txt AC 391 ms 20388 KB
test_30.txt AC 394 ms 20532 KB
test_31.txt AC 494 ms 25476 KB
test_32.txt AC 383 ms 20404 KB
test_33.txt AC 613 ms 33304 KB
test_34.txt AC 386 ms 20396 KB
test_35.txt AC 392 ms 20524 KB
test_36.txt AC 618 ms 32928 KB
test_37.txt AC 603 ms 33924 KB
test_38.txt AC 625 ms 33900 KB
test_39.txt AC 720 ms 31596 KB
test_40.txt AC 629 ms 32740 KB
test_41.txt AC 597 ms 32832 KB
test_42.txt AC 592 ms 32536 KB
test_43.txt AC 647 ms 32708 KB