結果
問題 |
No.26 シャッフルゲーム
|
ユーザー |
![]() |
提出日時 | 2015-03-24 01:33:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 419 bytes |
コンパイル時間 | 502 ms |
コンパイル使用メモリ | 60,912 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 00:27:05 |
合計ジャッジ時間 | 865 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <iostream> #include <algorithm> #include <sstream> using namespace std; int main(int argc, char *argv[]) { string s; getline(cin, s); int N = atoi(s.c_str()); getline(cin, s); int M = atoi(s.c_str()); for (int i = 0; i < M; ++i) { getline(cin, s); stringstream ss(s); int P, Q; ss >> P >> Q; if (P == N) { N = Q; } else if (Q == N) { N = P; } } cout << N << endl; return 0; }