#include<bits/stdc++.h>
using namespace std;
int n,q;
vector<char> a;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n>>q;
char c;
for(int i=0;i<n;i++)
{
cin>>c;
a.push_back(c);
}
char t;
int idx,idx2;
for(int i=0;i<q;i++)
{
cin>>t;
if(t=='q')
{
cin>>idx;
cout<<a[idx-1]<<"\n";
continue;
}
cin>>idx>>idx2;
char temp=a[idx];
a.erase(a.begin()+idx-1);
a.insert(a.begin()+idx2-1,temp);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
456 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |