# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
90096 | YottaByte | Collider (IZhO11_collider) | C++14 | 2040 ms | 8160 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>
using namespace std;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
main()
{
int n, q;
cin >> n >> q;
string s;
cin >> s;
while(q--)
{
char t; cin >> t;
if(t == 'q')
{
int k; cin >> k;
cout << s[k - 1] << endl;
}
else
{
int l, r;
cin >> l >> r;
l--;
r--;
char x = s[l];
if(l < r)
{
//cout << x << " " << l << " " << r << endl;
s = s.substr(0, l) + s.substr(l + 1, abs(r - l)) + x + s.substr(r + 1, s.size() - r);
}
else
{
s = s.substr(0, r) + x + s.substr(r, abs(r - l)) + s.substr(l + 1, s.size() - l);
}
}
//cout << s << endl;
}
}
/*
14 3
xxyxyzxxzxzyyzy
xxyxyzxxzxzyyzy
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |