提出 #59236953


ソースコード 拡げる

#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(clippy::needless_range_loop)]
#![allow(clippy::comparison_chain)]
#![allow(clippy::nonminimal_bool)]
#![allow(clippy::neg_multiply)]
use ac_library::*;
use amplify::confinement::Collection;
use itertools::{CombinationsWithReplacement, Itertools};
use lazy_static::lazy_static;
use libm::{ceil, log};
use num::{integer::Roots, traits::Pow, ToPrimitive};
use num_bigint::BigInt;
use num_integer::{div_ceil, Integer};
use proconio::marker::{Chars, Usize1};
use proconio::{input, source::line::LineSource};
use std::collections::{BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::convert::From;
use std::f64::consts::PI;
use std::hash::Hash;
use std::mem::swap;
use std::ops::Index;
use std::ops::Mul;
use std::{io::*, string};

fn solve() {
    #[rustfmt::skip]
    input! {
        N:usize,
        A:[isize; N],
        Q:usize,
        LR:[(usize, usize); Q]
    }
    let mut accum = vec![0];
    for (i, &a) in A.iter().enumerate() {
        if a == 0 {
            accum.push(accum[i] - 1);
        } else {
            accum.push(accum[i] + 1);
        }
    }
    let mut ans = vec![];
    for &(l, r) in LR.iter() {
        let tmp = accum[r] - accum[l - 1];
        if tmp > 0 {
            ans.push("win");
        } else if tmp == 0 {
            ans.push("draw");
        } else {
            ans.push("lose");
        }
    }
    println!("{}", ans.iter().join("\n"));
}

fn main() {
    // input! {N:usize}
    // for _ in 0..N {
    //     solve();
    // }
    solve();
}

提出情報

提出日時
問題 B06 - Lottery
ユーザ rakka
言語 Rust (rustc 1.70.0)
得点 1000
コード長 1647 Byte
結果 AC
実行時間 10 ms
メモリ 7784 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 1000 / 1000
結果
AC × 1
AC × 16
セット名 テストケース
Sample sample01.txt
All random00.txt, random01.txt, random02.txt, random03.txt, random04.txt, random05.txt, random06.txt, random07.txt, random08.txt, random09.txt, random10.txt, random11.txt, random12.txt, random13.txt, random14.txt, sample01.txt
ケース名 結果 実行時間 メモリ
random00.txt AC 6 ms 5900 KiB
random01.txt AC 3 ms 3888 KiB
random02.txt AC 9 ms 7492 KiB
random03.txt AC 1 ms 2432 KiB
random04.txt AC 7 ms 6460 KiB
random05.txt AC 6 ms 5900 KiB
random06.txt AC 10 ms 7784 KiB
random07.txt AC 3 ms 3288 KiB
random08.txt AC 5 ms 4764 KiB
random09.txt AC 4 ms 4520 KiB
random10.txt AC 5 ms 5228 KiB
random11.txt AC 2 ms 3128 KiB
random12.txt AC 6 ms 5496 KiB
random13.txt AC 5 ms 5008 KiB
random14.txt AC 3 ms 4196 KiB
sample01.txt AC 1 ms 2020 KiB