Submission #108650
Source Code Expand
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); // input int n = stdIn.nextInt(); int[] start = new int[n]; int[] stop = new int[n]; for(int i=0;i<n;i++){ String line = stdIn.next(); String[] split = line.split("-"); start[i] = Integer.valueOf(split[0]); stop[i] = Integer.valueOf(split[1]); } // round start for(int i=0;i<n;i++){ for(;;){ if(start[i]%5!=0){ start[i]--; } else{ break; } } } // round stop for(int i=0;i<n;i++){ for(;;){ if(stop[i]%5!=0){ stop[i]++; } else{ break; } } } // sort before debug output // for(int i=0;i<n;i++){ // System.err.println(start[i]+"-"+stop[i]); // } // System.err.println("----------------"); // sort for(int i=0;i<n-1;i++){ int min = start[i]; int z = i; for(int j=i+1;j<n;j++){ if(min>start[j]){ min = start[j]; z = j; } } // swap // 1. start int temp = start[i]; start[i] = start[z]; start[z] = temp; // 2. stop temp = stop[i]; stop[i] = stop[z]; stop[z] = temp; } // sort anfter debug output // for(int i=0;i<n;i++){ // System.err.println(start[i]+"-"+stop[i]); // } // ans create int[] ansStart = new int[n]; int[] ansStop = new int[n]; int index = 0; int max = -1; A:{ for(int i=0;i<n;){ // System.err.println("start="+start[i]); ansStart[index] = start[i]; max = -1; if(i+1>=n){ // System.err.println("stop="+stop[i]); ansStop[index++] = stop[i]; break; } if(stop[i]<start[i+1]){ // System.err.println("stop="+stop[i]); ansStop[index++] = stop[i]; i++; } else{ max = stop[i]; for(;;){ i++; // RE if(i+1>=n){ // System.err.println("stop="+stop[i]); ansStop[index++] = Math.max(max, stop[i]); break A; } if(stop[i]<start[i+1]){ // System.err.println("stop="+stop[i]); ansStop[index++] = Math.max(max, stop[i]); i++; break; } else{ max = Math.max(max, stop[i]); } } } } } // output for(int i=0;i<index;i++){ System.out.printf("%04d",ansStart[i]); System.out.print("-"); System.out.printf("%04d\n",ansStop[i]); } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | lanevok |
Language | Java (OpenJDK 1.7.0) |
Score | 0 |
Code Size | 2483 Byte |
Status | WA |
Exec Time | 1891 ms |
Memory | 41768 KB |
Judge Result
Set Name | all | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 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 | 481 ms | 23416 KB |
00_sample_02.txt | AC | 477 ms | 23512 KB |
00_sample_03.txt | AC | 483 ms | 23400 KB |
cho_cho_chokudai.txt | WA | 1788 ms | 40368 KB |
chokudai_ga_cho.txt | AC | 1800 ms | 41248 KB |
test_01.txt | AC | 533 ms | 24028 KB |
test_02.txt | AC | 516 ms | 24032 KB |
test_03.txt | AC | 513 ms | 24160 KB |
test_04.txt | AC | 514 ms | 24156 KB |
test_05.txt | AC | 514 ms | 24028 KB |
test_06.txt | AC | 524 ms | 24976 KB |
test_07.txt | AC | 509 ms | 24620 KB |
test_08.txt | AC | 483 ms | 23644 KB |
test_09.txt | AC | 586 ms | 26740 KB |
test_10.txt | AC | 559 ms | 25036 KB |
test_11.txt | AC | 774 ms | 24920 KB |
test_12.txt | AC | 533 ms | 24664 KB |
test_13.txt | AC | 531 ms | 24916 KB |
test_14.txt | AC | 546 ms | 25032 KB |
test_15.txt | AC | 561 ms | 25280 KB |
test_16.txt | WA | 531 ms | 24872 KB |
test_17.txt | WA | 575 ms | 24956 KB |
test_18.txt | WA | 510 ms | 24384 KB |
test_19.txt | AC | 539 ms | 24768 KB |
test_20.txt | WA | 543 ms | 24936 KB |
test_21.txt | WA | 1781 ms | 41624 KB |
test_22.txt | WA | 1809 ms | 41308 KB |
test_23.txt | AC | 1820 ms | 40804 KB |
test_24.txt | WA | 1856 ms | 41508 KB |
test_25.txt | AC | 1778 ms | 41768 KB |
test_26.txt | WA | 1784 ms | 41392 KB |
test_27.txt | AC | 1766 ms | 41188 KB |
test_28.txt | WA | 1813 ms | 40288 KB |
test_29.txt | AC | 473 ms | 23396 KB |
test_30.txt | WA | 492 ms | 23524 KB |
test_31.txt | WA | 710 ms | 28776 KB |
test_32.txt | WA | 480 ms | 23516 KB |
test_33.txt | WA | 1344 ms | 40356 KB |
test_34.txt | AC | 474 ms | 23392 KB |
test_35.txt | WA | 518 ms | 24744 KB |
test_36.txt | AC | 1786 ms | 41320 KB |
test_37.txt | WA | 1835 ms | 40840 KB |
test_38.txt | WA | 1804 ms | 41340 KB |
test_39.txt | AC | 1850 ms | 40984 KB |
test_40.txt | WA | 1891 ms | 40244 KB |
test_41.txt | AC | 1797 ms | 41276 KB |
test_42.txt | AC | 1776 ms | 41132 KB |
test_43.txt | AC | 1786 ms | 41472 KB |