답안 #17871

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17871 2016-01-12T16:40:25 Z Adilkhan 입자 가속기 (IZhO11_collider) C++
100 / 100
648 ms 3376 KB
#include <bits/stdc++.h>

#define pb push_back
#define endl "\n"
#define mp make_pair 
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fname ""
#define sz(x) (int)(x.size())

typedef long long ll;

using namespace std;

const ll N = (ll)(5e5) + 322;
const ll INF = (ll)(1e9);
const ll mod = (ll)(1e9) + 7;
const double eps = 1e-9;

int n, k, x, y;

string s;

vector <char> v;

char type, ch;

int main () {
//	cin.tie(0);
	ios_base :: sync_with_stdio(false);
//	freopen(fname".in", "r", stdin);
//	freopen(fname".out", "w", stdout);
	cin >> n >> k;
//	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; ++i) {
		cin >> ch;
//		scanf("%c", &ch);
		v.pb(ch);
	}
	for (int i = 1; i <= k; ++i) {
		cin >> type;
	//	scanf("%c", &type);
		if (type == 'a') {
		//  scanf("%d%d", &x, &y);
      cin >> x >> y;
      if (x == y) {continue;}
			ch = v[x - 1];    
			v.erase(v.begin() + x - 1);
			if (x > y) {
				v.insert(v.begin() + y - 1, ch);
			}else {
				v.insert(v.begin() + y - 1, ch);
			}
		}else {
			cin >> x;
			cout << v[x - 1] << endl;
		//	scanf("%d", &x);
		//	printf("%c\n", v[x - 1]);
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1712 KB Output is correct
2 Correct 12 ms 1712 KB Output is correct
3 Correct 19 ms 1980 KB Output is correct
4 Correct 189 ms 3376 KB Output is correct
5 Correct 328 ms 3376 KB Output is correct
6 Correct 453 ms 3376 KB Output is correct
7 Correct 556 ms 3376 KB Output is correct
8 Correct 238 ms 3376 KB Output is correct
9 Correct 648 ms 3376 KB Output is correct
10 Correct 430 ms 3376 KB Output is correct