結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 820 ms
5,380 KB
testcase_01 AC 112 ms
5,376 KB
testcase_02 AC 186 ms
5,384 KB
testcase_03 AC 430 ms
5,380 KB
testcase_04 AC 899 ms
5,380 KB
testcase_05 AC 310 ms
5,380 KB
testcase_06 AC 478 ms
5,376 KB
testcase_07 AC 551 ms
5,380 KB
testcase_08 AC 846 ms
5,380 KB
testcase_09 AC 9 ms
5,380 KB
testcase_10 AC 262 ms
5,380 KB
testcase_11 AC 369 ms
5,380 KB
testcase_12 AC 221 ms
5,376 KB
testcase_13 AC 828 ms
5,380 KB
testcase_14 AC 519 ms
5,380 KB
testcase_15 AC 294 ms
5,380 KB
testcase_16 AC 125 ms
7,420 KB
testcase_17 AC 200 ms
5,380 KB
testcase_18 AC 483 ms
5,376 KB
testcase_19 AC 311 ms
5,376 KB
testcase_20 AC 220 ms
5,380 KB
testcase_21 AC 221 ms
5,376 KB
testcase_22 AC 72 ms
5,376 KB
testcase_23 AC 53 ms
5,376 KB
testcase_24 AC 264 ms
5,380 KB
testcase_25 AC 614 ms
5,380 KB
testcase_26 AC 512 ms
5,380 KB
testcase_27 AC 321 ms
5,384 KB
testcase_28 AC 574 ms
5,380 KB
testcase_29 AC 646 ms
5,380 KB
testcase_30 AC 105 ms
5,380 KB
testcase_31 AC 544 ms
5,380 KB
testcase_32 AC 232 ms
5,380 KB
testcase_33 AC 890 ms
5,380 KB
testcase_34 AC 914 ms
5,380 KB
testcase_35 AC 550 ms
5,376 KB
testcase_36 AC 778 ms
5,380 KB
testcase_37 AC 568 ms
5,380 KB
testcase_38 AC 219 ms
5,380 KB
testcase_39 AC 324 ms
5,380 KB
testcase_40 AC 384 ms
5,380 KB
testcase_41 AC 102 ms
5,380 KB
testcase_42 AC 364 ms
5,380 KB
testcase_43 AC 417 ms
5,376 KB
testcase_44 AC 682 ms
5,376 KB
testcase_45 AC 746 ms
5,380 KB
testcase_46 AC 667 ms
5,380 KB
testcase_47 AC 321 ms
5,376 KB
testcase_48 AC 231 ms
5,380 KB
testcase_49 AC 719 ms
5,376 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..500 {
            for j in 0..n {
                let mut i = (j % 19 + j * 3 + i * i + (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