AtCoder Beginner Contest 001

Submission #108508

Source codeソースコード

print=console.log;
ls=require("fs").readFileSync("/dev/stdin","utf-8").split("\n");ls.length--

op = Object.prototype;
op.toString = function(){
  var s=[];
  for(var i in this)if(this.hasOwnProperty(i))s=s.concat(i+":"+this[i]);
  return "{"+s.join(",")+"}" };
op.trace = function(x){
  process.stderr.write((x?(x+": "):"")+this+"\n"); return this };

ap = Array.prototype;
ap.toString = function(){ return "["+this.join(",")+"]" };
ap.max = function(){ return Math.max.apply(null, this) };
ap.min = function(){ return Math.min.apply(null, this) };
ap.sum = function(){ return this.reduce(add) };
ap.prod = function(){return this.reduce(mul) };
ap.copy = function(){ return this.map(id) };

function forIn(o,f){ for (var x in o) if (o.hasOwnProperty(x)) f(x); }
function forOf(o,f){ for (var x in o) if (o.hasOwnProperty(x)) f(o[x]); }

function iota(n,b,s){ b=b||0; s=s||1; for (var r=[];n--;b+=s) r.push(b); return r }
function add(a,b){return a+b}
function mul(a,b){return a*b}
function sub(a,b){return a-b}
function bus(a,b){return b-a}
function id(x){return x}
function int(x){return +x}

function fuck(s) {
  return (+s.slice(0, 2) * 12) + (+s.slice(2, 4) / 5)
}

function kcuf(d) {
  var h = ((d/12)|0)+""
    , m = 5*(d%12)+"";
  return "00".slice(0, 2-h.length)+h
       + "00".slice(0, 2-m.length)+m;
}

(function main() {

var n = +ls[0];

var t = [];
for (var i=0; i<2400/5*2+4; ++i)
  t[i] = 0;

ls.slice(1, n+1)
.forEach(function(l){
  l = l.split("-");
  var x = Math.floor(fuck(l[0]))
    , y = Math.ceil (fuck(l[1]))
    ;
  for (var i=x*2; i<=y*2; ++i)
    t[i] = 1;
});

var late=0;
var output=[];
for (var i=0; i<2400/5*2+3; ++i) {
  if (!late && t[i]) {
    output.push(kcuf(i/2));
    late = 1;
  } else if (late && !t[i]) {
    output.push(kcuf((i-1)/2))
    late = 0;
  }
}

for (var i=0; i<output.length; i+=2)
  print((output[i])+"-"+(output[i+1]));

})();

Submission

Task問題 D - 感雨時刻の整理
User nameユーザ名 118_ドキドキ☆ビジュアル全開マガジン
Created time投稿日時
Language言語 JavaScript (Node.js 0.6.12)
Status状態 AC
Score得点 100
Source lengthソースコード長 1961 Byte
File nameファイル名
Exec time実行時間 374 ms
Memory usageメモリ使用量 17040 KB

Test case

Set

Set name Score得点 / Max score Cases
all 100 / 100 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01.txt AC 374 ms 10960 KB
00_sample_02.txt AC 156 ms 10948 KB
00_sample_03.txt AC 160 ms 11212 KB
cho_cho_chokudai.txt AC 269 ms 16788 KB
chokudai_ga_cho.txt AC 232 ms 16784 KB
test_01.txt AC 161 ms 11340 KB
test_02.txt AC 167 ms 11336 KB
test_03.txt AC 166 ms 11340 KB
test_04.txt AC 168 ms 11324 KB
test_05.txt AC 167 ms 11472 KB
test_06.txt AC 161 ms 11080 KB
test_07.txt AC 160 ms 11084 KB
test_08.txt AC 160 ms 11084 KB
test_09.txt AC 162 ms 11340 KB
test_10.txt AC 165 ms 11336 KB
test_11.txt AC 162 ms 11212 KB
test_12.txt AC 161 ms 11212 KB
test_13.txt AC 162 ms 11084 KB
test_14.txt AC 161 ms 11212 KB
test_15.txt AC 161 ms 11328 KB
test_16.txt AC 160 ms 11080 KB
test_17.txt AC 158 ms 11336 KB
test_18.txt AC 155 ms 11084 KB
test_19.txt AC 159 ms 11212 KB
test_20.txt AC 162 ms 11212 KB
test_21.txt AC 221 ms 16784 KB
test_22.txt AC 225 ms 16764 KB
test_23.txt AC 220 ms 16748 KB
test_24.txt AC 225 ms 16752 KB
test_25.txt AC 226 ms 16784 KB
test_26.txt AC 214 ms 16784 KB
test_27.txt AC 214 ms 16776 KB
test_28.txt AC 218 ms 16784 KB
test_29.txt AC 158 ms 10956 KB
test_30.txt AC 158 ms 11084 KB
test_31.txt AC 186 ms 13760 KB
test_32.txt AC 157 ms 11084 KB
test_33.txt AC 217 ms 15976 KB
test_34.txt AC 160 ms 11084 KB
test_35.txt AC 162 ms 11208 KB
test_36.txt AC 226 ms 16784 KB
test_37.txt AC 216 ms 16776 KB
test_38.txt AC 217 ms 16780 KB
test_39.txt AC 216 ms 17040 KB
test_40.txt AC 219 ms 16784 KB
test_41.txt AC 250 ms 16784 KB
test_42.txt AC 242 ms 16784 KB
test_43.txt AC 243 ms 16780 KB