結果
| 問題 | No.26 シャッフルゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-01-11 14:24:28 |
| 言語 | D (dmd 2.112.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 387 bytes |
| 記録 | |
| コンパイル時間 | 519 ms |
| コンパイル使用メモリ | 87,008 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2026-03-05 11:34:39 |
| 合計ジャッジ時間 | 1,173 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string;
void main()
{
int n = readln.chomp.to!int - 1;
size_t m = readln.chomp.to!size_t;
bool[] ci = new bool[](3);
ci[n] = true;
foreach (_; m.iota) {
int[] rd = readln.split.to!(int[]);
int p = rd[0] - 1, q = rd[1] - 1;
swap(ci[p], ci[q]);
}
int r = ci.countUntil!"a".to!int + 1;
writeln(r);
}