Submission #73404834


Source Code Expand

function Main(input) {
    let ansT = [];
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    if(input == "") {
        console.log("入力入れろ!");
        return 0;
    }
    
    //let data = Number(input[0]);
    let row_0 = input[0].split(" ").map(Number);
    let N = row_0[0];
    let W = row_0[1];
    let K = row_0[2];
    let flag = true;
    if(N * K > W)flag = false;
    console.log(yes_no(flag))
    let row_1 = input[1].split(" ").map(Number)
    /*for(let i = 0; i < Q; i++){
        //Numberでなければ削除して
        row_i = input[i + 1].split(" ").map(Number);
        let A = row_i[0];
        let B = row_i[1];
    }*/
    
    //console.log(ansT.join("\n"));
}
//デバッグ用
function debug_m(str){
    let execute = 1;
    if(execute) console.log(str);
}

//エラーデータがあった時に、WAではなく、REを通告させるためのもの
function error(){
    a
}
function yes_no(bo) {
    return bo ? "Yes":"No";
}

function table_limit(T,x,y,dir = "l"){
    /*
    dirがl...左に行けるのであればtrue
    r...右に行けるのであればtrue
    u...上に
    d...下に
    */
    let ans = false;
    switch(dir){
        case "l": if(x - 1 >= 0) ans = true; break;
        case "r": if(x + 1 < T[y].length) ans = true; break;
        case "u": if(y - 1 >= 0) ans = true; break;
        case "d": if(y + 1 < T.length) ans = true; break;
        default: debug_m("引数はl,r,u,dのいずれかだぞ");break;
    }
    return ans;
}  
function ch_odd(n){
    if(n%2 == 1)return true;
    else return false;
}
function ch_even(n){
    if(n%2 == 0) return true;
    else return false;
}


function binary_search(num,Table,approximation = 0,l_or_r = "l"){
    /*approximationは近似の種類
    -1 は、num以下のもので最大
    1 は num以上のもので最小
    0は絶対値で近い方
    100は、ピンポイントでなければundefindを返す この時、undefind判断は===が良い。
    それ以外の値が入っていたら、0と同様の処理
    l_or_r...同じ値が複数あった時、最も左のやつを参照する? もっとも右のやつを参照する?
    return は、配列の位置
    */
    
    //データ数が1だとバグるから、それの苦肉の対策
    if(Table.length == 1){
        switch(approximation){
            case -1:{
                if(num >= Table[0]) return 0;
            } break;
            
            case 1:{
                if(num <= Table[0]) return 0;
            } break;
            case 100:{
                if(num == Table[0]) return 0;
            } break;
            default : return 0;
        }
        return undefined;
    }
    
    X_max = Table.length - 1;
    X_min = 0;
    let X = -1;
    let pX = 0;
    while(X_max !== X_min && X !== pX){
        pX = X;
        X = Math.floor((X_max + X_min)/2);
        if(Table[X] > num) X_max = X;
        else if(Table[X] < num) X_min = X;
    }
    
    if(Table[X] !== num){
        //近似の処理
        if(approximation !== -1 && approximation !== 1 && approximation !== 100) approximation = 0;
        //種類によって変える
        switch(approximation){
            case -1:{
                //num以下で最大
                //すでに条件を満たしているなら、もう1個上を見てみる
                if(Table[X] <= num) {
                        while(Table[X + 1] <= num && X + 1 <= Table.length - 1) X++;
                }else{
                    //下に移動しないといけない時
                    while(Table[X] >= num && !(X === undefined)){
                        if(X - 1 >= 0) X--;
                        else X = undefined;
                    }
                }   
            }break;
            
            case 1:{
                //num以上で最小
                //すでに条件を満たしているなら、1個下を見る
                if(Table[X] >= num) {
                    while(Table[X - 1] >= num && X - 1 >= 0) X--;
                }
                else{
                    //上に移動しないと行けない
                    while(Table[X] < num && !(X === undefined)){
                        if(X + 1 <= Table.length - 1) X++;
                        else X = undefined;
                    }
                }
            }break;
            case 100: X = undefined; break;
            
            //絶対値で近い方。
            default:{
                let other_p;
                if(num > Table[X]) other_p = X + 1;
                else other_p = X - 1;
                
                //この時、other_pが範囲外ならやんなくて良い
                if(other_p >= 0 && other_p <= Table.length - 1){
                    let X_abs = Math.abs(Table[X] - num);
                    let other_abs = Math.abs(Table[other_p] - num);
                    //other_absの方が優れているなら、答えはそっち。
                    if(other_abs < X_abs) X = other_p;
                }
            }
        }
    }else{
        //同じ値が複数あった時、どうする?
        if(Table[X] == Table[X + 1] || Table[X] == Table[X - 1]){
            //もう1度二分探索
            
            if(l_or_r == "l"){
                let l = 0;
                let r = Table.length - 1;
                let Y = Math.floor((l + r)/2)
                //最も左の値を参照する
                while(l < r){
                    //もし、num"未満"であれば、答えはそれより、+1以上右にある。
                    //そうでなければ、まだ左に行ける可能性がある。
                    if(Table[Y] < num) l = Y + 1;
                    else r = Y;
                    Y = Math.floor((l + r)/2)
                }
                X = Y;
            }else{
                //最も右の値を参照する
                let l = 0;
                let r = Table.length - 1;
                let Y = Math.ceil((l + r)/2)
                while(l < r){
                    //もし、num"より大きい"であれば、-1以上左にある。
                    //そうでなければ、まだ右にいける可能性がある。
                    if(Table[Y] > num) r = Y - 1;
                    else l = Y;
                    Y = Math.ceil((l + r)/2)
                }
                
                X = Y;
            }
        }
    }
    
    return X;
}

//クイックソート
function quick_sort(table_O,type = 1){
    //type が1でなければ、降順に
    //配列のコピーを作る
    let table = [...table_O];
    let m = [];
    let big = [];
    let sma = [];
    let result = [];
    
    let len = table.length;
    //2以上でおなじみの処理
    if(len >= 2){
        //適当な値を決める
        let choices = table[Math.floor(Math.random() * len)];
        for(let i = 0; i < len; i++){
            if(table[i] < choices) sma.push(table[i]);
            if(table[i] == choices) m.push(table[i]);
            if(table[i] > choices) big.push(table[i]);
        }
        big = quick_sort(big,type);
        sma = quick_sort(sma,type);
        
        //くっつける
        if(type == 1) result = [...sma,...m,...big];
        else result = [...big,...m,...sma]
        return result;
    }else{
        //1だったらそのまま返す
        return table;
    }
}

//Union_find
class Union_find{
    
    constructor(N){
        //頂点がn個。でも、0番は使わないで、n+1かな
        this.Uni = Array(N + 1);
        //初期値を設定
        this.Uni[0] = null;
        for(let i = 1; i < this.Uni.length;i++){
            this.Uni[i] = i;
        }
        
        this.group_size = Array(N + 1).fill(1);
        this.group_size[0] = null;
    }
    
    finds(vertex){
        //Uni[vertex]とかを見ていく
        let tmp_root = vertex;
        let next = this.Uni[vertex];
        let memoryT = [tmp_root];
        
        while(tmp_root !== next){
            tmp_root = next;
            next = this.Uni[tmp_root];
            
            memoryT.push(tmp_root);
        }
        
        //ここで、正しい根が分かる
        let root = tmp_root;
        
        //で、整理
        if(memoryT.length >= 2){
            for(let i = 0; i < memoryT.length; i++) this.Uni[memoryT[i]] = root;
        }
        
        return root;
    }
    
    union(vertexA,vertexB){
        let A_root = this.finds(vertexA);
        let B_root = this.finds(vertexB);

        let A_size = this.group_size[A_root];
        let B_size = this.group_size[B_root];
        //同じグループならやらない
        if(A_root !== B_root){
            if(A_size <= B_size){
                //AをBにくっつける
                this.Uni[B_root] = A_root;
                this.group_size[A_root] += B_size;
                
                //バグ防止
                this.group_size[B_root] = 0;
            }else{
                //BをAにくっつける
                this.Uni[A_root] = B_root;
                this.group_size[B_root] += A_size;
                
                //バグ防止
                this.group_size[A_root] = 0;
            }
        }
    }
    
    same(vertexA,vertexB){
        let A_root = this.finds(vertexA);
        let B_root = this.finds(vertexB);
        
        if(A_root == B_root)return true;
        else return false;
    }
    
    get_group_size(vertex){
        return this.group_size[this.finds(vertex)];
    }
}

class binary_heap{
    constructor(T = [],type = "min"){
        this.Table = [null];
        this.Table = [...this.Table,...T];
        this.type = type;
    }
    
    comparison(n,m){
        let ans = false;
        switch(this.type){
            case "min": if(n < m) ans = true; break;
            case "max": if(n > m) ans = true; break;
        }
        return ans;
    }
    add(n){
        this.Table.push(n);
        let n_num = this.Table.length - 1;
        let flag = true;
        heap_loop:while(flag){
            //上の頂点は、floor(1/2)
            let up = Math.floor(n_num/2)
            if(up == 0) break heap_loop;
            
            let swap = this.comparison(this.Table[n_num],this.Table[up])
            //upとn_numを比較して、場合によってはスワップ
            if(swap){
                let tmp = this.Table[n_num];
                this.Table[n_num] = this.Table[up];
                this.Table[up] = tmp;
                n_num = up;
            }else{
                flag = false;
                break heap_loop;
            }
        }
    }
    
    get_most(){
        //一番最後と、最初を入れ替える
        let l_num = this.Table.length - 1;
        let tmp = this.Table[1];
        this.Table[1] = this.Table[l_num];
        this.Table[l_num] = tmp;
        let ans = this.Table.pop();
        
        //ここから、入れ替え処理
        let flag = true;
        let n_ind = 1;
        heap_loop:while(flag){
            let d_l = n_ind * 2;
            let d_r = d_l + 1;
            
            let l_num = this.check_undefinend(this.Table[d_l]);
            let r_num = this.check_undefinend(this.Table[d_r]);
            
            let m_ind = d_l;
            let main_num = l_num
            let selecter = "l";
            //rを選択するか
            if(this.comparison(r_num,l_num)){
                m_ind = d_r;
                main_num = r_num;
                selecter = "r";
            }
            //mainと、今の値を比較する。
            let n_num = this.Table[n_ind];
            if(this.comparison(main_num,n_num)){
                //swap
                let tmp = this.Table[n_ind];
                this.Table[n_ind] = this.Table[m_ind];
                this.Table[m_ind] = tmp;    
                
                //次は下に
                n_ind = m_ind;
            }else{
                //ループ終わり
                flag = false;
                break heap_loop;
            }
        }
        return ans
    }
    check_undefinend(n){
        if(n == undefined){
            if(this.type == "min") n = Infinity;
            if(this.type == "max") n = -Infinity;
        }
        return n;
    }
    
    
}
//segment tree
class Segment_Tree{
    
    constructor(T,type = "sum"){
        //頂点がn個、ここで、2^m >= n を満たす最低のmを求め
        let m = 0;
        while((1 << m) < T.length){
            m++;
        }
        this.tree = Array((1 << m+1))
        this.tree[0] = null;
        //最下層には普通に入れる
        for(let i = 0; i < T.length; i++){
            this.tree[i + (1 << m)] = T[i]
        }
        this.depth = m
        this.type = type;
        //こっから、逆に。
        for(let i = (1<<m) - 1; i > 0; i--){
            this.tree[i] = this.compute_down(i)
        }
    }
    //右下を得る
    get_rd(n){
        return this.tree[n*2 + 1];
    }
    //左下を得る
    get_ld(n){
        return this.tree[n*2];
    }
    //上の番号 これは、番号。
    up(n){
        return Math.floor(n/2)
    }
    //右下の葉と左下の葉をルールに則って結果を出す。
    compute_down(n){
        let a = this.get_ld(n);
        let b = this.get_rd(n);
        return this.compute(a,b);
    }
    compute(a,b){
        let ans;
        switch(this.type){
            case "sum":{
                if(a === undefined) a = 0;
                if(b === undefined) b = 0;
                ans = a + b;
            }break;
        }
        return ans;
    }
    //更新
    update(n,value){
        n += 1 << this.depth;
        this.tree[n] = value;
        n = this.up(n);
        while(n >= 1){
            this.tree[n] = this.compute_down(n);
            n = this.up(n);
        }
    }
    
    //区間取得
    segment_ans(L,R){
        L += 1 << this.depth;
        R += (1 << this.depth) + 1;
        let T = [];
        while(L < R){
            if(ch_odd(L)){
                T.push(this.tree[L++]);
            }
            if(ch_odd(R)){
                T.push(this.tree[--R]);
            }
            L = this.up(L)
            R = this.up(R)
        }
        while(T.length > 1){
            let a = T.pop();
            let b = T.pop();
            T.push(this.compute(a,b));
            
        }
        return T[0];
    }
}
//*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Submission Info

Submission Time
Task A - Planting the Flower Bed
User luckyK
Language JavaScript (Node.js 22.19.0)
Score 0
Code Size 15158 Byte
Status WA
Exec Time 42 ms
Memory 42200 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 166
Status
AC × 3
AC × 43
WA × 25
Set Name Test Cases
Sample sample01.txt, sample02.txt, sample03.txt
All sample01.txt, sample02.txt, sample03.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in38.txt, in39.txt, in40.txt, in41.txt, in42.txt, in43.txt, in44.txt, in45.txt, in46.txt, in47.txt, in48.txt, in49.txt, in50.txt, in51.txt, in52.txt, in53.txt, in54.txt, in55.txt, in56.txt, in57.txt, in58.txt, in59.txt, in60.txt, in61.txt, in62.txt, in63.txt, in64.txt, in65.txt
Case Name Status Exec Time Memory
in01.txt WA 42 ms 42028 KiB
in02.txt AC 24 ms 42112 KiB
in03.txt WA 24 ms 42112 KiB
in04.txt AC 24 ms 42200 KiB
in05.txt AC 24 ms 42032 KiB
in06.txt AC 24 ms 42196 KiB
in07.txt AC 24 ms 42196 KiB
in08.txt AC 24 ms 42048 KiB
in09.txt WA 24 ms 42196 KiB
in10.txt WA 24 ms 42072 KiB
in11.txt AC 24 ms 42080 KiB
in12.txt AC 24 ms 42060 KiB
in13.txt AC 24 ms 42080 KiB
in14.txt WA 24 ms 42068 KiB
in15.txt AC 24 ms 42060 KiB
in16.txt AC 24 ms 42200 KiB
in17.txt AC 24 ms 42048 KiB
in18.txt AC 24 ms 42072 KiB
in19.txt WA 24 ms 42080 KiB
in20.txt AC 24 ms 42080 KiB
in21.txt AC 24 ms 42064 KiB
in22.txt AC 24 ms 42032 KiB
in23.txt WA 23 ms 42196 KiB
in24.txt WA 24 ms 42064 KiB
in25.txt WA 24 ms 42064 KiB
in26.txt WA 24 ms 42068 KiB
in27.txt WA 24 ms 42032 KiB
in28.txt WA 24 ms 42092 KiB
in29.txt WA 24 ms 42080 KiB
in30.txt AC 24 ms 42080 KiB
in31.txt AC 24 ms 42196 KiB
in32.txt WA 24 ms 42068 KiB
in33.txt WA 24 ms 42032 KiB
in34.txt WA 24 ms 42060 KiB
in35.txt WA 24 ms 42196 KiB
in36.txt AC 24 ms 42052 KiB
in37.txt AC 24 ms 42112 KiB
in38.txt AC 24 ms 42092 KiB
in39.txt AC 24 ms 42032 KiB
in40.txt WA 24 ms 42048 KiB
in41.txt WA 24 ms 42080 KiB
in42.txt WA 24 ms 42080 KiB
in43.txt WA 24 ms 42048 KiB
in44.txt AC 24 ms 42056 KiB
in45.txt AC 24 ms 42068 KiB
in46.txt AC 24 ms 42196 KiB
in47.txt AC 23 ms 42060 KiB
in48.txt AC 24 ms 42080 KiB
in49.txt AC 23 ms 42064 KiB
in50.txt AC 24 ms 42100 KiB
in51.txt AC 24 ms 42060 KiB
in52.txt AC 24 ms 42072 KiB
in53.txt AC 24 ms 42064 KiB
in54.txt AC 24 ms 42200 KiB
in55.txt AC 24 ms 41996 KiB
in56.txt AC 24 ms 42016 KiB
in57.txt AC 24 ms 42048 KiB
in58.txt WA 24 ms 42016 KiB
in59.txt WA 24 ms 42112 KiB
in60.txt AC 24 ms 42100 KiB
in61.txt AC 24 ms 42032 KiB
in62.txt WA 24 ms 42056 KiB
in63.txt AC 24 ms 42200 KiB
in64.txt AC 24 ms 42196 KiB
in65.txt WA 24 ms 42112 KiB
sample01.txt AC 24 ms 42196 KiB
sample02.txt AC 24 ms 42100 KiB
sample03.txt AC 24 ms 42076 KiB