Submission #528193
Source Code Expand
w// inputに入力データ全体が入る function Main(input) { // 1行目がinput[0], 2行目がinput[1], …に入る input = input.split("\n"); // 2次元配列作成 for(var i=1; i<parseInt(input[0],10)+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); var tmp1 = Math.floor(start[j]/10); var tmp2 = tmp1*10; var tmp3 = start[j]-tmp2; if(tmp3<5){start[j]=tmp2;} else if(tmp3>5){start[j]=tmp2+5;} end[j] = parseInt(input[j+1][1],10); var tmp1e = Math.floor(start[j]/10); var tmp2e = tmp1e*10; var tmp3e = start[j]-tmp2e; if(tmp3e>0){start[j]=tmp2e+5;} else if(tmp3e>5){start[j]=tmp2e+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 | 1731 Byte |
Status | RE |
Exec Time | 212 ms |
Memory | 12156 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 | 212 ms | 12156 KB |
00_sample_02.txt | RE | 178 ms | 11892 KB |
00_sample_03.txt | RE | 176 ms | 11900 KB |
cho_cho_chokudai.txt | RE | 177 ms | 11900 KB |
chokudai_ga_cho.txt | RE | 178 ms | 11900 KB |
test_01.txt | RE | 177 ms | 11908 KB |
test_02.txt | RE | 188 ms | 11776 KB |
test_03.txt | RE | 181 ms | 11900 KB |
test_04.txt | RE | 187 ms | 11888 KB |
test_05.txt | RE | 177 ms | 11772 KB |
test_06.txt | RE | 177 ms | 11884 KB |
test_07.txt | RE | 177 ms | 11884 KB |
test_08.txt | RE | 175 ms | 11908 KB |
test_09.txt | RE | 176 ms | 11900 KB |
test_10.txt | RE | 176 ms | 11980 KB |
test_11.txt | RE | 178 ms | 11908 KB |
test_12.txt | RE | 179 ms | 12032 KB |
test_13.txt | RE | 176 ms | 11900 KB |
test_14.txt | RE | 182 ms | 11900 KB |
test_15.txt | RE | 184 ms | 11904 KB |
test_16.txt | RE | 189 ms | 11896 KB |
test_17.txt | RE | 182 ms | 11900 KB |
test_18.txt | RE | 179 ms | 11900 KB |
test_19.txt | RE | 179 ms | 11904 KB |
test_20.txt | RE | 178 ms | 12012 KB |
test_21.txt | RE | 181 ms | 11904 KB |
test_22.txt | RE | 176 ms | 11856 KB |
test_23.txt | RE | 177 ms | 11900 KB |
test_24.txt | RE | 180 ms | 11904 KB |
test_25.txt | RE | 177 ms | 11908 KB |
test_26.txt | RE | 177 ms | 11956 KB |
test_27.txt | RE | 176 ms | 11904 KB |
test_28.txt | RE | 177 ms | 11884 KB |
test_29.txt | RE | 177 ms | 11812 KB |
test_30.txt | RE | 177 ms | 12036 KB |
test_31.txt | RE | 170 ms | 11904 KB |
test_32.txt | RE | 178 ms | 11900 KB |
test_33.txt | RE | 178 ms | 11912 KB |
test_34.txt | RE | 177 ms | 11888 KB |
test_35.txt | RE | 175 ms | 11904 KB |
test_36.txt | RE | 176 ms | 11900 KB |
test_37.txt | RE | 186 ms | 11904 KB |
test_38.txt | RE | 183 ms | 11884 KB |
test_39.txt | RE | 181 ms | 11968 KB |
test_40.txt | RE | 182 ms | 11900 KB |
test_41.txt | RE | 176 ms | 11904 KB |
test_42.txt | RE | 179 ms | 11880 KB |
test_43.txt | RE | 177 ms | 11900 KB |