# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1100866 | raphaelp | 입자 가속기 (IZhO11_collider) | C++14 | 119 ms | 3592 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |