Submission #897469

#TimeUsernameProblemLanguageResultExecution timeMemory
897469preskoCollider (IZhO11_collider)C++14
100 / 100
214 ms2924 KiB
#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 timeMemoryGrader output
Fetching results...