結果

問題 No.26 シャッフルゲーム
ユーザー MoonlightSonata
提出日時 2019-08-31 16:59:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 699 bytes
コンパイル時間 1,847 ms
コンパイル使用メモリ 195,144 KB
最終ジャッジ日時 2025-01-07 16:11:42
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define PRINT(n) cout << n << "\n";
#define PRINT2(n, m) cout << n << " " << m << " "<< "\n";

#define REP(i,n)  for(int i=0;i<(int)n;++i)

void no26();
int main() {cin.tie(0); ios::sync_with_stdio(false); no26();}

/********************************/
/** yukicoder No.26            **/
/** by MoonlightSonata         **/
/********************************/

void no26(){
    int n, m;
    cin >> n >> m;
    vector<int> p(m, 0);
    vector<int> q(m, 0);
    int ans = n;
    REP(i,m){
        cin >> p[i] >> q[i];
        if (ans == p[i]){
            ans = q[i];
        }else if (ans == q[i]) {
            ans = p[i];
        }
    }
    PRINT(ans)
}
0