提出 #22002618


ソースコード 拡げる

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}

void solve(){
    int n,q;
    string s[2];
    cin>>n>>s[0]>>q;
    s[1]=s[0].substr(n);
    s[0]=s[0].substr(0,n);
    bool f=false;
    for(int i{},t,a,b;i<(q);++i){
        cin>>t>>a>>b;
        if(t==1){
            --a,--b;
            if(f) swap(s[1-a/n][a%n],s[1-b/n][b%n]);
            else swap(s[a/n][a%n],s[b/n][b%n]);
        }
        else{
            f=!f;
        }
    }
    if(f) cout<<s[1]<<s[0]<<'\n';
    else cout<<s[0]<<s[1]<<'\n';
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    solve();
}

提出情報

提出日時
問題 C - IPFL
ユーザ Motsu_xe
言語 C++ (GCC 9.2.1)
得点 300
コード長 873 Byte
結果 AC
実行時間 71 ms
メモリ 4092 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 2
AC × 22
セット名 テストケース
Sample sample_01.txt, sample_02.txt
All manual_00.txt, manual_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, sample_01.txt, sample_02.txt
ケース名 結果 実行時間 メモリ
manual_00.txt AC 8 ms 3604 KiB
manual_01.txt AC 2 ms 3612 KiB
random_00.txt AC 71 ms 3928 KiB
random_01.txt AC 50 ms 4092 KiB
random_02.txt AC 62 ms 4040 KiB
random_03.txt AC 52 ms 4092 KiB
random_04.txt AC 58 ms 4000 KiB
random_05.txt AC 62 ms 4008 KiB
random_06.txt AC 52 ms 4040 KiB
random_07.txt AC 57 ms 3940 KiB
random_08.txt AC 19 ms 3956 KiB
random_09.txt AC 50 ms 3724 KiB
random_10.txt AC 15 ms 3780 KiB
random_11.txt AC 60 ms 4044 KiB
random_12.txt AC 20 ms 3724 KiB
random_13.txt AC 54 ms 3996 KiB
random_14.txt AC 52 ms 3972 KiB
random_15.txt AC 15 ms 3948 KiB
random_16.txt AC 5 ms 3944 KiB
random_17.txt AC 53 ms 3544 KiB
sample_01.txt AC 2 ms 3552 KiB
sample_02.txt AC 2 ms 3696 KiB