답안 #333772

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
333772 2020-12-07T18:18:10 Z limabeans 입자 가속기 (IZhO11_collider) C++17
100 / 100
840 ms 2780 KB
#include <bits/stdc++.h>
using namespace std;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;


const int maxn = 1e6 + 5;




int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

    int n,q;
    cin>>n>>q;
    string s;
    cin>>s;

    while (q--) {
	char op;
	cin>>op;
	if (op=='a') {
	    int x,y;
	    cin>>x>>y;
	    --x; --y;
	    string t(1,s[x]);
	    s.erase(x,1);
	    s.insert(y,t);
	} else {
	    int x;
	    cin>>x;
	    cout<<s[x-1]<<"\n";
	}
    }
    
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 17 ms 748 KB Output is correct
4 Correct 217 ms 2176 KB Output is correct
5 Correct 409 ms 2184 KB Output is correct
6 Correct 577 ms 2568 KB Output is correct
7 Correct 680 ms 2780 KB Output is correct
8 Correct 281 ms 2568 KB Output is correct
9 Correct 840 ms 2696 KB Output is correct
10 Correct 571 ms 2568 KB Output is correct