Submission #528213
Source Code Expand
// 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("-"); } // sort // var params = new Array([6,2], [3,9], [1,7], [4,0], [8,5]); input = input.sort(function(a,b){return(a[0] - b[0]);}); // 開始時刻と終了時刻代入 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(end[j]/10); var tmp2e = tmp1e*10; var tmp3e = end[j]-tmp2e; if(tmp3e>5){end[j]=tmp2e+10;} else if(tmp3e<5 && tmp3e!=0){end[j]=tmp2e+5;} } // // 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; // } // } // } // a.sort(function(a,b){ // if( a < b ) return -1; // if( a > b ) return 1; // return 0; // }); //出力 & 整理 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 | 2062 Byte |
Status | WA |
Exec Time | 255 ms |
Memory | 21308 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 | 165 ms | 11592 KB |
00_sample_02.txt | WA | 159 ms | 11208 KB |
00_sample_03.txt | AC | 165 ms | 11720 KB |
cho_cho_chokudai.txt | WA | 229 ms | 19260 KB |
chokudai_ga_cho.txt | WA | 247 ms | 21180 KB |
test_01.txt | WA | 176 ms | 12228 KB |
test_02.txt | WA | 166 ms | 11720 KB |
test_03.txt | WA | 168 ms | 11576 KB |
test_04.txt | WA | 181 ms | 12096 KB |
test_05.txt | WA | 163 ms | 11592 KB |
test_06.txt | WA | 166 ms | 11716 KB |
test_07.txt | WA | 165 ms | 11716 KB |
test_08.txt | WA | 167 ms | 11592 KB |
test_09.txt | WA | 164 ms | 11716 KB |
test_10.txt | WA | 167 ms | 11844 KB |
test_11.txt | WA | 169 ms | 11848 KB |
test_12.txt | WA | 166 ms | 11720 KB |
test_13.txt | WA | 165 ms | 11720 KB |
test_14.txt | WA | 166 ms | 11848 KB |
test_15.txt | WA | 167 ms | 11848 KB |
test_16.txt | WA | 166 ms | 11720 KB |
test_17.txt | WA | 165 ms | 11720 KB |
test_18.txt | WA | 165 ms | 11592 KB |
test_19.txt | WA | 168 ms | 11848 KB |
test_20.txt | WA | 166 ms | 11848 KB |
test_21.txt | WA | 248 ms | 21180 KB |
test_22.txt | WA | 248 ms | 21176 KB |
test_23.txt | WA | 249 ms | 21180 KB |
test_24.txt | WA | 254 ms | 21172 KB |
test_25.txt | WA | 255 ms | 21180 KB |
test_26.txt | WA | 255 ms | 21180 KB |
test_27.txt | WA | 254 ms | 20956 KB |
test_28.txt | WA | 248 ms | 21180 KB |
test_29.txt | WA | 164 ms | 11592 KB |
test_30.txt | WA | 166 ms | 11720 KB |
test_31.txt | WA | 189 ms | 14068 KB |
test_32.txt | WA | 168 ms | 11720 KB |
test_33.txt | WA | 237 ms | 18604 KB |
test_34.txt | WA | 166 ms | 11716 KB |
test_35.txt | WA | 168 ms | 11720 KB |
test_36.txt | WA | 251 ms | 21084 KB |
test_37.txt | WA | 254 ms | 21160 KB |
test_38.txt | WA | 250 ms | 21084 KB |
test_39.txt | WA | 248 ms | 21180 KB |
test_40.txt | WA | 249 ms | 21308 KB |
test_41.txt | WA | 252 ms | 21080 KB |
test_42.txt | WA | 253 ms | 21308 KB |
test_43.txt | WA | 251 ms | 21180 KB |