結果

問題 No.26 シャッフルゲーム
ユーザー graph11463
提出日時 2025-04-11 17:57:53
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 444 bytes
コンパイル時間 1,181 ms
コンパイル使用メモリ 100,248 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-04-11 17:57:55
合計ジャッジ時間 1,770 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
using ll =long long;
void solve(){
    ll N,M;cin >> N >> M;
    int a[3]={0,0,0};
    a[N-1]++;
    for(ll i=0;i<M;i++){
        ll p,q;cin >> p >> q;
        swap(a[p-1],a[q-1]);
    }
    for(ll j=0;j<3;j++){
        if(a[j]==1){
            cout << j+1 << endl;
        }
    }
    return;
}
int main(){
    solve();
    return 0;
}
0