Submission #170687

#TimeUsernameProblemLanguageResultExecution timeMemory
170687div2derCollider (IZhO11_collider)C++14
0 / 100
2058 ms1968 KiB
#pragma GCC optimize ("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("avx,avx2,fma") #include <iostream> #include <vector> using namespace std; #define sz(s) (int)(s.size()) #define eb emplace_back const int N = 2e5 + 5; void solve() { int n, m; cin >> n >> m; string s; cin >> s; s = "#" + s; while(m--) { char type; cin >> type; if (type == 'a') { int l, r; cin >> l >> r; if (l > r) { swap(l, r); char x = s[r]; for (int i = r - 1; i >= l; -- i) s[i + 1] = s[i]; s[l] = x; } else if (l <= r) { char x = s[l]; for (int i = l + 1; i <= r; ++ i) s[i - 1] = s[i]; s[r] = x; } } else { int pos; cin >> pos; cout << s[pos] << '\n'; } } } int main () { solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...