QHEAP1

  • + 0 comments

    Javascript

      let queries=input.split('\n')
        queries.splice(0,1)
        let arr=[]
        let min=null;
        for(let query of queries){
            query=query.split(' ')
            let op=query[0]
            let param=query[1]
            if(op=='1'){
                arr.push(param)            
                if(parseFloat(param)<parseFloat(min)){
                    min=param
                }else if(min===null){
                    min=param
                }
            }
            if(op=='3'){
                console.log(min)
            }
            if(op=='2'){
                arr.splice(arr.indexOf(param),1)     
                if(min==param){
                    min=Math.min(...arr)
                }
            }
        }