| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 171014 | div2der | Collider (IZhO11_collider) | C++14 | 2 ms | 256 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>
#include <climits>
#include <vector>
using namespace std;
const int N = 2e6;
const int INF = INT_MAX;
vector <pair <int, int> >v;
int main () {
	cerr << "Ready\n";
	string s;
	int n, q;
	cin >> n >> q;
	cin >> s;
	while(q--) {
		char type;
		cin >> type;
		if (type == 'a') {
			int x, y;
			cin >> x >> y;
			#define eb emplace_back
			#define mkp make_pair
			v.eb(mkp(x, y));
		}
		else {
			int pos;
			cin >> pos;
			#define sz(s) (int)(s.size())
			for (int j = sz(v) - 1; j >= 0; -- j) {
				if (v[j].second == pos){
					pos = v[j].first;
					continue;
				}
				if (v[j].second < pos)
					--pos;
				if (v[j].first <= pos)
					++pos;
			}
			--pos;
			cout << s[pos] << '\n';
		}
	}
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
