Submission #22010122


Source Code Expand

/** author: samari06,  created: 24.04.2021 21:08:18 **/
#include <bits/stdc++.h>
#define REP(i, N) for(int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;

int main(){
    string s;
    int n,q;
    cin >> n >> s >> q;

    bool f = false;

    while(q--){
        int t,a,b;
        scanf("%d%d%d",&t,&a,&b);
        if(t == 1){
            a--; b--;
            if(f){
                a += n;
                b += n;
                a %= 2*n;
                b %= 2*n;
            }

            swap(s[a], s[b]);
        }else{
            if(f) f=false;
            else f=true;
        }
    }

    if(f){
        string s1 = s.substr(n);
        string s2 = s.substr(0,n);
        s = s1+s2;
    }

    cout << s;
    return 0;
}

Submission Info

Submission Time
Task C - IPFL
User samari06
Language C++ (GCC 9.2.1)
Score 300
Code Size 794 Byte
Status AC
Exec Time 76 ms
Memory 4636 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   16 |         scanf("%d%d%d",&t,&a,&b);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 22
Set Name Test Cases
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
Case Name Status Exec Time Memory
manual_00.txt AC 7 ms 3484 KiB
manual_01.txt AC 3 ms 3544 KiB
random_00.txt AC 75 ms 3860 KiB
random_01.txt AC 64 ms 3816 KiB
random_02.txt AC 76 ms 3796 KiB
random_03.txt AC 61 ms 3820 KiB
random_04.txt AC 68 ms 3756 KiB
random_05.txt AC 74 ms 3828 KiB
random_06.txt AC 61 ms 3860 KiB
random_07.txt AC 75 ms 4636 KiB
random_08.txt AC 27 ms 3868 KiB
random_09.txt AC 57 ms 3984 KiB
random_10.txt AC 21 ms 3760 KiB
random_11.txt AC 72 ms 4452 KiB
random_12.txt AC 17 ms 3712 KiB
random_13.txt AC 63 ms 3736 KiB
random_14.txt AC 61 ms 4320 KiB
random_15.txt AC 17 ms 3848 KiB
random_16.txt AC 15 ms 4584 KiB
random_17.txt AC 58 ms 3660 KiB
sample_01.txt AC 3 ms 3652 KiB
sample_02.txt AC 2 ms 3628 KiB