結果

問題 No.26 シャッフルゲーム
ユーザー kazuppa
提出日時 2024-06-02 23:22:13
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 251 bytes
コンパイル時間 3,216 ms
コンパイル使用メモリ 244,684 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 10:26:49
合計ジャッジ時間 4,060 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n,m;cin>>n>>m;
  vector<int> l(m);
  vector<int> r(m);
  for(int i=0;i<m;i++){
    cin>>l[i]>>r[i];
    if(l[i]==n)n=r[i];
    else if(r[i]==n)n=l[i];
  }
  cout<<n<<endl;
  return 0;
}
0