Submission #336921

# Submission time Handle Problem Language Result Execution time Memory
336921 2020-12-17T10:12:23 Z boykut Collider (IZhO11_collider) C++14
100 / 100
849 ms 2696 KB
#include <map>
#include <iostream>

using namespace std;
// 1 <= ik <= N - M + 1,
// ik <= jk <= ik + M - 1

int dp[10000001];

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  int n, m;
  cin >> n >> m;
  
  string s;
  cin >> s;
  
  while (m--) {
    char ch;
    cin >> ch;
    
    int l, r;
    cin >> l; --l;
    
    if (ch == 'a') {
      cin >> r; --r;
      
      char h = s[l];
      
      s.erase(s.begin() + l);
      s.insert(s.begin() + r, h);
      
    } else {
      cout << s[l] << '\n';
    }
  }
  
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 492 KB Output is correct
3 Correct 17 ms 748 KB Output is correct
4 Correct 208 ms 2184 KB Output is correct
5 Correct 397 ms 2304 KB Output is correct
6 Correct 585 ms 2440 KB Output is correct
7 Correct 681 ms 2696 KB Output is correct
8 Correct 279 ms 2568 KB Output is correct
9 Correct 849 ms 2696 KB Output is correct
10 Correct 575 ms 2568 KB Output is correct