# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
897469 | presko | Collider (IZhO11_collider) | C++14 | 214 ms | 2924 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |