結果
| 問題 | No.26 シャッフルゲーム | 
| コンテスト | |
| ユーザー |  sorag | 
| 提出日時 | 2022-08-15 21:04:53 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 740 bytes | 
| コンパイル時間 | 797 ms | 
| コンパイル使用メモリ | 80,304 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-02 09:15:39 | 
| 合計ジャッジ時間 | 1,288 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include<string>
#include<queue>
#include<math.h>
#define all(x) begin(x),end(x)
#define ll long long
#define P pair<int,int>
#define lP pait<ll,ll>
using namespace std;
int main() {
    int n,m,p,q;
    cin>>n>>m;
    vector<P> a(3);
    for(int i=0;i<3;i++){
    a[i].first=i+1;
        if(a[i].first==n) a[i].second=1;
    }
    for (int i=0;i<m;i++){
        cin>>p>>q;
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
            if(a[j].first==p and a[k].first==q){
                swap(a[j].second,a[k].second);
            }
           }
    }
    }
    
    for(int i=0;i<3;i++){
        if(a[i].second==1) cout<<a[i].first<<endl;
    }
    return 0;
}
  
    
            
            
            
        