Submission #1100866

#TimeUsernameProblemLanguageResultExecution timeMemory
1100866raphaelpCollider (IZhO11_collider)C++14
100 / 100
119 ms3592 KiB
#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 timeMemoryGrader output
Fetching results...