結果
問題 | No.26 シャッフルゲーム |
ユーザー |
|
提出日時 | 2016-02-09 00:18:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 516 ms |
コンパイル使用メモリ | 57,072 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 21:51:41 |
合計ジャッジ時間 | 1,009 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <cstdlib> #include <algorithm> #include <array> #include <iostream> int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); int n, m; std::cin >> n >> m; std::array<bool, 3> cups; cups[n - 1] = true; for (int i = 0; i < m; i++) { int p, q; std::cin >> p >> q; std::swap(cups[p - 1], cups[q - 1]); } std::cout << (std::distance(cups.begin(), std::find(cups.begin(), cups.end(), true)) + 1) << std::endl; return EXIT_SUCCESS; }