結果
問題 | No.429 CupShuffle |
ユーザー | te-sh |
提出日時 | 2017-10-27 17:04:06 |
言語 | D (dmd 2.107.1) |
結果 |
AC
|
実行時間 | 43 ms / 2,000 ms |
コード長 | 692 bytes |
コンパイル時間 | 677 ms |
コンパイル使用メモリ | 94,672 KB |
実行使用メモリ | 7,640 KB |
最終ジャッジ日時 | 2023-09-03 16:31:30 |
合計ジャッジ時間 | 2,726 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,384 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | AC | 1 ms
4,380 KB |
testcase_09 | AC | 1 ms
4,376 KB |
testcase_10 | AC | 5 ms
4,376 KB |
testcase_11 | AC | 42 ms
7,640 KB |
testcase_12 | AC | 42 ms
7,524 KB |
testcase_13 | AC | 43 ms
7,344 KB |
testcase_14 | AC | 42 ms
7,392 KB |
testcase_15 | AC | 1 ms
4,380 KB |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string; void main() { auto rd1 = readln.split.to!(int[]), n = rd1[0], k = rd1[1], x = rd1[2]; auto a = new int[](k), b = new int[](k); foreach (i; 0..k) { auto rd2 = readln.splitter; if (i != x-1) { a[i] = rd2.front.to!int-1; rd2.popFront(); b[i] = rd2.front.to!int-1; } } auto c = readln.split.map!(to!int).map!"a-1".array; auto d = new int[](n); foreach (i; 0..n) d[i] = i; foreach (i; 0..x-1) swap(d[a[i]], d[b[i]]); foreach_reverse (i; x..k) swap(c[a[i]], c[b[i]]); int[] ans; foreach (i; 0..n) if (d[i] != c[i]) ans ~= i; ans.sort(); writeln(ans[0]+1, " ", ans[1]+1); }