Submission #897469

# Submission time Handle Problem Language Result Execution time Memory
897469 2024-01-03T07:03:19 Z presko Collider (IZhO11_collider) C++14
100 / 100
214 ms 2924 KB
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
vector<char> order;
int main()
{
    int n,q;
    string s="";
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>q;
    cin>>s;
    for(int i=0;i<n;i++)order.push_back(s[i]);
    for(int i=0;i<q;i++)
    {
        char t;
        cin>>t;
        if(t=='q')
        {
            int pos;
            cin>>pos;
            cout<<order[pos-1]<<"\n";
        }
        else
        {
            int x,y;
            cin>>x>>y;
            char sym=order[x-1];
            order.erase(order.begin()+x-1);
            order.insert(order.begin()+y-1,sym);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 7 ms 604 KB Output is correct
4 Correct 60 ms 2552 KB Output is correct
5 Correct 118 ms 2552 KB Output is correct
6 Correct 159 ms 2804 KB Output is correct
7 Correct 177 ms 2920 KB Output is correct
8 Correct 75 ms 2808 KB Output is correct
9 Correct 214 ms 2924 KB Output is correct
10 Correct 148 ms 2924 KB Output is correct