Submission #158076

# Submission time Handle Problem Language Result Execution time Memory
158076 2019-10-14T15:58:19 Z muhammad_hokimiyon Collider (IZhO11_collider) C++14
100 / 100
666 ms 4560 KB
#include <bits/stdc++.h>
#include <ext/rope>
//#pragma GCC optimize("Ofast")

#define fi first
#define se second
#define LL long long

using namespace std;

const int N = 1e6 + 7;
const int mod = 1e9 + 7;
const int B = 317;

int n,m;
string s;
string f;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );
    //freopen( "collider.in" , "r" , stdin );
    //freopen( "collider.out" , "w" , stdout );

    cin >> n >> m >> s;
    for( int i = 0; i < n; i++ )f.push_back(s[i]);
    for( int i = 1; i <= m; i++ ){
        char c;
        cin >> c;
        if( c == 'a' ){
            int x,y;
            cin >> x >> y;
            x--,y--;
            string t = "";
            t = s[x];
            s.erase( x , 1 );
            s.insert( y , t );
        }
        else{
            int x;
            cin >> x;
            cout << s[x - 1] << "\n";
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 19 ms 888 KB Output is correct
4 Correct 181 ms 3472 KB Output is correct
5 Correct 351 ms 3468 KB Output is correct
6 Correct 480 ms 3732 KB Output is correct
7 Correct 522 ms 4552 KB Output is correct
8 Correct 232 ms 4432 KB Output is correct
9 Correct 666 ms 4560 KB Output is correct
10 Correct 446 ms 4556 KB Output is correct