結果

問題 No.429 CupShuffle
ユーザー btkbtk
提出日時 2016-10-02 22:40:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 832 bytes
コンパイル時間 1,655 ms
コンパイル使用メモリ 168,808 KB
実行使用メモリ 4,884 KB
最終ジャッジ日時 2023-08-13 17:09:21
合計ジャッジ時間 2,633 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 28 ms
4,884 KB
testcase_12 AC 26 ms
4,584 KB
testcase_13 AC 28 ms
4,800 KB
testcase_14 AC 26 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}init;
typedef long long LL;
    
int main(){
    int N,K,X;
    cin>>N>>K>>X;
    vector<int> A,B;
    vector<int> s(N),c(N);
    iota(s.begin(),s.end(),1);
    
    
    for(int i=0;i<X-1;i++){
        int a,b;cin>>a>>b;
        swap(s[a-1],s[b-1]);
    }
    string t1,t2;cin>>t1>>t2;
    for(int i=X;i<K;i++){
        int a,b;
        cin>>a>>b;
        A.push_back(a-1);
        B.push_back(b-1);
    }
    reverse(A.begin(),A.end());
    reverse(B.begin(),B.end());
    int z=A.size();
    
    for(auto &it:c)cin>>it;
    for(int i=0;i<z;i++)
        swap(c[A[i]],c[B[i]]);
    vector<int> res;
    for(int i=0;i<N;i++){
        if(s[i]!=c[i])res.push_back(i+1);
    }
    cout<<res[0]<<" "<<res[1]<<endl;
    return 0;
}
0