# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1100866 | raphaelp | Collider (IZhO11_collider) | C++14 | 119 ms | 3592 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 <bits/stdc++.h>
using namespace std;
int main()
{
int N, M;
cin >> N >> M;
string S;
cin >> S;
vector<pair<int, int>> actions;
for (int i = 0; i < M; i++)
{
char typ;
cin >> typ;
if (typ == 'a')
{
int a, b;
cin >> a >> b;
a--, b--;
actions.push_back({a, b});
}
else
{
int x;
cin >> x;
x--;
for (int j = actions.size() - 1; j >= 0; j--)
{
if (x == actions[j].second)
x = actions[j].first;
else if (actions[j].second > actions[j].first && x >= actions[j].first && x < actions[j].second)
x++;
else if (actions[j].second < actions[j].first && x <= actions[j].first && x > actions[j].second)
x--;
}
cout << S[x] << '\n';
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |