結果

問題 No.5001 排他的論理和でランニング
ユーザー ジョギングジョギング
提出日時 2018-03-16 23:50:50
言語 Rust
(1.77.0)
結果
AC  
実行時間 1,084 ms / 1,500 ms
コード長 1,064 bytes
コンパイル時間 641 ms
実行使用メモリ 7,424 KB
スコア 52,420,719
最終ジャッジ日時 2020-03-12 19:40:24
ジャッジサーバーID
(参考情報)
judge6 /
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,055 ms
5,380 KB
testcase_01 AC 165 ms
5,376 KB
testcase_02 AC 250 ms
5,376 KB
testcase_03 AC 511 ms
5,376 KB
testcase_04 AC 1,082 ms
5,380 KB
testcase_05 AC 364 ms
5,380 KB
testcase_06 AC 707 ms
5,376 KB
testcase_07 AC 779 ms
5,380 KB
testcase_08 AC 893 ms
5,380 KB
testcase_09 AC 10 ms
5,376 KB
testcase_10 AC 286 ms
5,380 KB
testcase_11 AC 413 ms
5,376 KB
testcase_12 AC 330 ms
5,380 KB
testcase_13 AC 910 ms
5,380 KB
testcase_14 AC 610 ms
5,380 KB
testcase_15 AC 366 ms
5,376 KB
testcase_16 AC 161 ms
5,376 KB
testcase_17 AC 228 ms
5,380 KB
testcase_18 AC 559 ms
5,376 KB
testcase_19 AC 427 ms
5,376 KB
testcase_20 AC 290 ms
5,380 KB
testcase_21 AC 257 ms
5,380 KB
testcase_22 AC 104 ms
5,380 KB
testcase_23 AC 73 ms
5,376 KB
testcase_24 AC 413 ms
5,380 KB
testcase_25 AC 942 ms
5,380 KB
testcase_26 AC 796 ms
5,376 KB
testcase_27 AC 505 ms
5,376 KB
testcase_28 AC 740 ms
5,380 KB
testcase_29 AC 875 ms
5,380 KB
testcase_30 AC 130 ms
7,424 KB
testcase_31 AC 655 ms
5,380 KB
testcase_32 AC 281 ms
5,380 KB
testcase_33 AC 1,000 ms
5,380 KB
testcase_34 AC 1,084 ms
5,380 KB
testcase_35 AC 702 ms
5,380 KB
testcase_36 AC 1,012 ms
5,380 KB
testcase_37 AC 783 ms
5,376 KB
testcase_38 AC 290 ms
5,376 KB
testcase_39 AC 363 ms
5,380 KB
testcase_40 AC 517 ms
5,380 KB
testcase_41 AC 121 ms
6,148 KB
testcase_42 AC 424 ms
5,380 KB
testcase_43 AC 502 ms
5,380 KB
testcase_44 AC 901 ms
5,384 KB
testcase_45 AC 973 ms
5,380 KB
testcase_46 AC 993 ms
5,376 KB
testcase_47 AC 410 ms
5,376 KB
testcase_48 AC 306 ms
5,376 KB
testcase_49 AC 778 ms
5,380 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];
    }
    if m < n {
        for i in 0..900 {
            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