Submission #528175
Source Code Expand
w// inputに入力データ全体が入る function Main(input) { // 1行目がinput[0], 2行目がinput[1], …に入る input = input.split("\n"); // 2次元配列作成 for(var i=1; i<input[0]+1; i++){ input[i] = input[i].split("-"); } // 開始時刻と終了時刻代入 var start = new Array(); var end = new Array(); for(var j=0; j<input[0]; j++){ start[j] = parseInt(input[j+1][0],10); end[j] = parseInt(input[j+1][1],10); } // sort var n = parseInt(input[0],10); for(i=0; i<n-1; i++){ for(j=n-1; j>i; j--){ if(start[j-1] > start[j]){ // start sort var ts = start[j]; start[j] = start[j-1]; start[j-1] = ts; // end 並べ替え(ソートではない) var te = end[j]; end[j] = end[j-1]; end[j-1] = te; } } } //出力 & 整理 var s,e; //出力用変数 for(var k=0; k<n; k++){ s = start[k]; e = end[k]; while((e >= start[k+1] || s===start[k+1]) && k<n){ if(e < end[k+1]){ e = end[k+1]; } k++; } console.log('%d-%d',s,e); } } //*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します) Main(require("fs").readFileSync("/dev/stdin", "utf8"));
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | yuki0 |
Language | JavaScript (Node.js 0.6.12) |
Score | 0 |
Code Size | 1369 Byte |
Status | RE |
Exec Time | 173 ms |
Memory | 11588 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 | RE | 173 ms | 11464 KB |
00_sample_02.txt | RE | 141 ms | 11460 KB |
00_sample_03.txt | RE | 139 ms | 11456 KB |
cho_cho_chokudai.txt | RE | 139 ms | 11460 KB |
chokudai_ga_cho.txt | RE | 140 ms | 11440 KB |
test_01.txt | RE | 139 ms | 11460 KB |
test_02.txt | RE | 140 ms | 11460 KB |
test_03.txt | RE | 143 ms | 11588 KB |
test_04.txt | RE | 140 ms | 11488 KB |
test_05.txt | RE | 140 ms | 11456 KB |
test_06.txt | RE | 143 ms | 11576 KB |
test_07.txt | RE | 144 ms | 11456 KB |
test_08.txt | RE | 148 ms | 11584 KB |
test_09.txt | RE | 145 ms | 11456 KB |
test_10.txt | RE | 143 ms | 11456 KB |
test_11.txt | RE | 146 ms | 11456 KB |
test_12.txt | RE | 143 ms | 11456 KB |
test_13.txt | RE | 145 ms | 11440 KB |
test_14.txt | RE | 147 ms | 11568 KB |
test_15.txt | RE | 149 ms | 11456 KB |
test_16.txt | RE | 138 ms | 11456 KB |
test_17.txt | RE | 143 ms | 11460 KB |
test_18.txt | RE | 144 ms | 11452 KB |
test_19.txt | RE | 146 ms | 11424 KB |
test_20.txt | RE | 141 ms | 11460 KB |
test_21.txt | RE | 141 ms | 11460 KB |
test_22.txt | RE | 137 ms | 11460 KB |
test_23.txt | RE | 137 ms | 11460 KB |
test_24.txt | RE | 139 ms | 11460 KB |
test_25.txt | RE | 140 ms | 11460 KB |
test_26.txt | RE | 142 ms | 11452 KB |
test_27.txt | RE | 138 ms | 11460 KB |
test_28.txt | RE | 139 ms | 11460 KB |
test_29.txt | RE | 139 ms | 11460 KB |
test_30.txt | RE | 138 ms | 11460 KB |
test_31.txt | RE | 141 ms | 11456 KB |
test_32.txt | RE | 137 ms | 11460 KB |
test_33.txt | RE | 139 ms | 11460 KB |
test_34.txt | RE | 138 ms | 11460 KB |
test_35.txt | RE | 138 ms | 11460 KB |
test_36.txt | RE | 137 ms | 11460 KB |
test_37.txt | RE | 140 ms | 11460 KB |
test_38.txt | RE | 142 ms | 11392 KB |
test_39.txt | RE | 143 ms | 11456 KB |
test_40.txt | RE | 139 ms | 11460 KB |
test_41.txt | RE | 143 ms | 11456 KB |
test_42.txt | RE | 140 ms | 11452 KB |
test_43.txt | RE | 144 ms | 11456 KB |