結果

問題 No.5001 排他的論理和でランニング
ユーザー ジョギングジョギング
提出日時 2018-03-17 00:30:24
言語 Rust
(1.77.0)
結果
AC  
実行時間 614 ms / 1,500 ms
コード長 1,097 bytes
コンパイル時間 864 ms
実行使用メモリ 6,148 KB
スコア 22,524,684
最終ジャッジ日時 2020-03-12 19:45:43
ジャッジサーバーID
(参考情報)
judge10 /
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 599 ms
5,380 KB
testcase_01 AC 93 ms
5,380 KB
testcase_02 AC 142 ms
5,376 KB
testcase_03 AC 291 ms
5,376 KB
testcase_04 AC 614 ms
5,384 KB
testcase_05 AC 208 ms
5,380 KB
testcase_06 AC 397 ms
5,380 KB
testcase_07 AC 439 ms
5,380 KB
testcase_08 AC 507 ms
6,148 KB
testcase_09 AC 6 ms
5,376 KB
testcase_10 AC 164 ms
5,376 KB
testcase_11 AC 237 ms
5,376 KB
testcase_12 AC 189 ms
5,380 KB
testcase_13 AC 519 ms
5,376 KB
testcase_14 AC 346 ms
5,384 KB
testcase_15 AC 207 ms
5,376 KB
testcase_16 AC 91 ms
5,380 KB
testcase_17 AC 129 ms
5,380 KB
testcase_18 AC 319 ms
5,376 KB
testcase_19 AC 241 ms
5,376 KB
testcase_20 AC 166 ms
5,376 KB
testcase_21 AC 145 ms
5,380 KB
testcase_22 AC 61 ms
5,380 KB
testcase_23 AC 41 ms
5,380 KB
testcase_24 AC 230 ms
5,376 KB
testcase_25 AC 527 ms
5,380 KB
testcase_26 AC 444 ms
5,380 KB
testcase_27 AC 283 ms
5,380 KB
testcase_28 AC 417 ms
5,380 KB
testcase_29 AC 494 ms
5,380 KB
testcase_30 AC 73 ms
5,376 KB
testcase_31 AC 372 ms
5,380 KB
testcase_32 AC 162 ms
5,380 KB
testcase_33 AC 566 ms
5,376 KB
testcase_34 AC 611 ms
5,380 KB
testcase_35 AC 397 ms
5,380 KB
testcase_36 AC 574 ms
5,380 KB
testcase_37 AC 443 ms
5,380 KB
testcase_38 AC 164 ms
5,380 KB
testcase_39 AC 208 ms
5,380 KB
testcase_40 AC 290 ms
5,376 KB
testcase_41 AC 69 ms
5,380 KB
testcase_42 AC 243 ms
5,376 KB
testcase_43 AC 284 ms
6,148 KB
testcase_44 AC 507 ms
5,380 KB
testcase_45 AC 550 ms
5,380 KB
testcase_46 AC 558 ms
5,380 KB
testcase_47 AC 233 ms
5,380 KB
testcase_48 AC 173 ms
5,376 KB
testcase_49 AC 444 ms
5,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{stdin, Read};

fn main() {
    let mut buf = String::new();
    stdin().read_to_string(&mut buf).unwrap();
    let mut buf = buf.split_whitespace();
    let mut get = || buf.next().unwrap().parse::<i32>().unwrap();
    
    let n = get() as usize;
    let m = get() as usize;
    let mut xs = vec![];
    for _ in 0..n { xs.push(get()); }
    
    let mut v = 0;
    for i in 0..m {
        v ^= xs[i];
    }
    xs.sort();
    xs.reverse();
    if m < n {
        for i in 0..500 {
            for j in 0..n {
                let mut i = (j % 19 + (j + i) % 7 + m + i % 103 + i % 31) % n;
                if i < m {
                    if n == m {
                        i = m;
                    } else {
                        i = m + i % (n - m);
                    }
                }
                let e = v ^ xs[j] ^ xs[i];
                if e > v {
                    xs.swap(i, j);
                    v = e;
                }
            }
        }
    }
    for i in 0..m {
        if i > 0 { print!(" "); }
        print!("{}", xs[i]);
    }
    println!();   
}
0