Submission #410225
Source Code Expand
import java.util.Arrays; import java.util.Scanner; public class Main { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); long start = System.currentTimeMillis(); long fin = System.currentTimeMillis(); final int MOD = 1000000000; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int n = sc.nextInt(); String[][] in = new String[n][2]; for (int i = 0; i < n; i++) { in[i] = sc.next().split("-"); } int[] time = new int[1441]; // 1640 = 24 * 60 for (int i = 0; i < in.length; i++) { int s = Integer.valueOf(in[i][0]) / 100 * 60 + Integer.valueOf(in[i][0]) % 100; int t = Integer.valueOf(in[i][1]) / 100 * 60 + Integer.valueOf(in[i][1]) % 100; int r = s % 10; if (r != 0 && r != 5) { if (r < 5) { s -= r; } else { s -= r; s += 5; } } r = t % 10; if (r != 0 && r != 5) { if (r < 5) { t -= r; t += 5; } else { t -= r; t += 10; } } for (int j = s; j <= t; j++) { time[j]++; } } for (int i = 0; i < time.length; i++) { if (time[i] != 0) { int s = i; int t = 0; while (i < time.length && time[i] != 0) { i++; } t = i - 1; String from = ""; String to = ""; from += s / 60 < 10 ? "0" + s / 60 : s / 60; from += s % 60 < 10 ? "0" + s % 60 : s % 60; to += t / 60 < 10 ? "0" + t / 60 : t / 60; to += t % 60 < 10 ? "0" + t % 60 : t % 60; System.out.println(from + "-" + to); } } } public static void main(String[] args) { new Main().run(); } void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } void debug2(char[][] 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(); } } boolean inner(int h, int w, int limH, int limW) { return 0 <= h && h < limH && 0 <= w && w < limW; } void swap(int[] x, int a, int b) { int tmp = x[a]; x[a] = x[b]; x[b] = tmp; } // find minimum i (a[i] >= border) int lower_bound(int a[], int border) { int l = -1; int r = a.length; while (r - l > 1) { int mid = (l + r) / 2; if (border <= a[mid]) { r = mid; } else { l = mid; } } // r = l + 1 return r; } boolean palindrome(String s) { for (int i = 0; i < s.length() / 2; i++) { if (s.charAt(i) != s.charAt(s.length() - 1 - i)) { return false; } } return true; } 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()); } long nextLong() { return Long.parseLong(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; } } int[] nextIntArray(int n) { int[] in = new int[n]; for (int i = 0; i < n; i++) { in[i] = nextInt(); } return in; } int[][] nextInt2dArray(int n, int m) { int[][] in = new int[n][m]; for (int i = 0; i < n; i++) { in[i] = nextIntArray(m); } return in; } double[] nextDoubleArray(int n) { double[] in = new double[n]; for (int i = 0; i < n; i++) { in[i] = nextDouble(); } return in; } long[] nextLongArray(int n) { long[] in = new long[n]; for (int i = 0; i < n; i++) { in[i] = nextLong(); } return in; } char[][] nextCharField(int n, int m) { char[][] in = new char[n][m]; for (int i = 0; i < n; i++) { String s = sc.next(); for (int j = 0; j < m; j++) { in[i][j] = s.charAt(j); } } return in; } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | suigingin |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 4349 Byte |
Status | AC |
Exec Time | 777 ms |
Memory | 40624 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 | 411 ms | 23620 KB |
00_sample_02.txt | AC | 404 ms | 23700 KB |
00_sample_03.txt | AC | 405 ms | 23648 KB |
cho_cho_chokudai.txt | AC | 777 ms | 40064 KB |
chokudai_ga_cho.txt | AC | 718 ms | 39436 KB |
test_01.txt | AC | 437 ms | 23860 KB |
test_02.txt | AC | 428 ms | 23856 KB |
test_03.txt | AC | 428 ms | 23852 KB |
test_04.txt | AC | 428 ms | 23772 KB |
test_05.txt | AC | 433 ms | 23836 KB |
test_06.txt | AC | 441 ms | 24464 KB |
test_07.txt | AC | 462 ms | 24408 KB |
test_08.txt | AC | 436 ms | 24176 KB |
test_09.txt | AC | 478 ms | 25120 KB |
test_10.txt | AC | 465 ms | 25324 KB |
test_11.txt | AC | 465 ms | 25124 KB |
test_12.txt | AC | 451 ms | 24780 KB |
test_13.txt | AC | 434 ms | 24256 KB |
test_14.txt | AC | 470 ms | 25256 KB |
test_15.txt | AC | 481 ms | 25048 KB |
test_16.txt | AC | 437 ms | 24196 KB |
test_17.txt | AC | 466 ms | 25140 KB |
test_18.txt | AC | 444 ms | 24272 KB |
test_19.txt | AC | 457 ms | 24792 KB |
test_20.txt | AC | 459 ms | 24596 KB |
test_21.txt | AC | 714 ms | 40244 KB |
test_22.txt | AC | 727 ms | 40624 KB |
test_23.txt | AC | 719 ms | 39340 KB |
test_24.txt | AC | 696 ms | 38620 KB |
test_25.txt | AC | 710 ms | 40452 KB |
test_26.txt | AC | 714 ms | 39928 KB |
test_27.txt | AC | 712 ms | 39772 KB |
test_28.txt | AC | 702 ms | 39364 KB |
test_29.txt | AC | 412 ms | 23612 KB |
test_30.txt | AC | 431 ms | 23704 KB |
test_31.txt | AC | 560 ms | 27600 KB |
test_32.txt | AC | 421 ms | 23576 KB |
test_33.txt | AC | 700 ms | 38012 KB |
test_34.txt | AC | 414 ms | 23620 KB |
test_35.txt | AC | 425 ms | 23768 KB |
test_36.txt | AC | 719 ms | 39632 KB |
test_37.txt | AC | 724 ms | 40336 KB |
test_38.txt | AC | 717 ms | 39816 KB |
test_39.txt | AC | 717 ms | 39184 KB |
test_40.txt | AC | 703 ms | 39248 KB |
test_41.txt | AC | 737 ms | 39260 KB |
test_42.txt | AC | 717 ms | 38976 KB |
test_43.txt | AC | 747 ms | 39272 KB |