Submission #171014

# Submission time Handle Problem Language Result Execution time Memory
171014 2019-12-27T04:49:10 Z div2der Collider (IZhO11_collider) C++14
0 / 100
2 ms 256 KB
#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
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -