Submission #331070

# Submission time Handle Problem Language Result Execution time Memory
331070 2020-11-27T08:31:45 Z Binyomin Collider (IZhO11_collider) C++14
100 / 100
929 ms 2824 KB
# include <bits/stdc++.h>
# include <ext/rope>

# define fi first
# define se second
# define pb push_back
# define int long long
#define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std ;



int32_t main() {
    speed ;
    //freopen("cupboard.in", "r", stdin ) ;
    //freopen("cupboard.out", "w", stdout ) ;
    int n, m ; cin >> n >> m ;
    string s ; cin >> s ;
    for( int i = 0 ; i < m ; i ++ ) {
        char a ; cin >> a ;
        if( a == '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 1 ms 364 KB Output is correct
2 Correct 3 ms 492 KB Output is correct
3 Correct 19 ms 768 KB Output is correct
4 Correct 213 ms 2316 KB Output is correct
5 Correct 419 ms 2312 KB Output is correct
6 Correct 607 ms 2440 KB Output is correct
7 Correct 716 ms 2568 KB Output is correct
8 Correct 289 ms 2568 KB Output is correct
9 Correct 929 ms 2824 KB Output is correct
10 Correct 600 ms 2640 KB Output is correct