Submission #284839


Source Code Expand

import java.util.*;

class dpData{
  int countsum;
  int widthsum;
}

public class Main {
  public static String marume(String inp){
    char[] resStr = new char[9];
    resStr = inp.toCharArray();
    if(inp.charAt(3) <= '4'){
      resStr[3] = '0';
    }else{
      resStr[3] = '5';
    }

    if(inp.charAt(8) >= '6'){
      if(inp.charAt(7) <= '4'){
        resStr[8] = '0';
        resStr[7] = (char)((int)resStr[7] + 1);
      }else{
        resStr[8] = '0';
        resStr[7] = '0';
        if(inp.charAt(6) <= '8'){
          resStr[6] = (char)((int)resStr[6] + 1);
        }else{
          resStr[6] = '0';
          resStr[5] = (char)((int)resStr[5] + 1);
        }
      }

    }else if(inp.charAt(8) >= '1'){
      resStr[8] = '5';
    }
    String res = new String(resStr);
    return res;
  }


  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    String[] strs = new String[n];

    for(int i = 0; i < n; i++){
      String inp = sc.next();
      strs[i] = marume(inp);
    }

    Arrays.sort(strs);

    int count = 1;
    String[] answer = new String[n];
    answer[0] = strs[0];

    for(int i = 1; i < n; i++){
      if(Integer.parseInt(answer[count - 1].substring(5, 9)) >= Integer.parseInt(strs[i].substring(0,4))){
        if(Integer.parseInt(answer[count - 1].substring(5, 9)) < Integer.parseInt(strs[i].substring(5,9))){
          answer[count - 1] = answer[count - 1].replaceAll(answer[count - 1].substring(5, 9), strs[i].substring(5, 9));
        }
      }else{
        answer[count] = strs[i];
        count++;
      }
    }

    for(int i = 0; i < count; i++){
      System.out.println(answer[i]);
    }

  }
}

Submission Info

Submission Time
Task D - 感雨時刻の整理
User fuzuiR
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 1772 Byte
Status AC
Exec Time 1015 ms
Memory 42724 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 492 ms 23320 KB
00_sample_02.txt AC 462 ms 23208 KB
00_sample_03.txt AC 453 ms 23444 KB
cho_cho_chokudai.txt AC 886 ms 40896 KB
chokudai_ga_cho.txt AC 938 ms 42724 KB
test_01.txt AC 468 ms 23312 KB
test_02.txt AC 474 ms 23416 KB
test_03.txt AC 474 ms 23284 KB
test_04.txt AC 477 ms 23404 KB
test_05.txt AC 477 ms 23344 KB
test_06.txt AC 487 ms 24208 KB
test_07.txt AC 473 ms 23592 KB
test_08.txt AC 486 ms 23472 KB
test_09.txt AC 560 ms 25572 KB
test_10.txt AC 528 ms 26044 KB
test_11.txt AC 513 ms 24224 KB
test_12.txt AC 500 ms 23984 KB
test_13.txt AC 494 ms 24096 KB
test_14.txt AC 528 ms 25804 KB
test_15.txt AC 528 ms 26224 KB
test_16.txt AC 467 ms 23448 KB
test_17.txt AC 524 ms 24604 KB
test_18.txt AC 480 ms 23472 KB
test_19.txt AC 500 ms 24340 KB
test_20.txt AC 506 ms 24476 KB
test_21.txt AC 948 ms 42000 KB
test_22.txt AC 965 ms 41872 KB
test_23.txt AC 999 ms 42400 KB
test_24.txt AC 955 ms 41916 KB
test_25.txt AC 966 ms 42012 KB
test_26.txt AC 990 ms 42676 KB
test_27.txt AC 887 ms 41040 KB
test_28.txt AC 984 ms 41816 KB
test_29.txt AC 450 ms 23272 KB
test_30.txt AC 463 ms 23352 KB
test_31.txt AC 647 ms 30548 KB
test_32.txt AC 460 ms 23332 KB
test_33.txt AC 941 ms 41064 KB
test_34.txt AC 453 ms 23184 KB
test_35.txt AC 490 ms 23944 KB
test_36.txt AC 982 ms 42288 KB
test_37.txt AC 955 ms 41964 KB
test_38.txt AC 968 ms 42096 KB
test_39.txt AC 985 ms 42384 KB
test_40.txt AC 1015 ms 42472 KB
test_41.txt AC 827 ms 41468 KB
test_42.txt AC 953 ms 42284 KB
test_43.txt AC 835 ms 40748 KB