Submission #88154

#TimeUsernameProblemLanguageResultExecution timeMemory
88154abilCollider (IZhO11_collider)C++14
0 / 100
2091 ms8848 KiB
/** Solution by Abil **/ #include <bits/stdc++.h> using namespace std; main() { ios_base::sync_with_stdio(0); int n, m; cin >> n >> m; string s; cin >> s; int l, r; char ch; string s1,s2,s3; while(m--){ cin >> ch; if(ch == 'a'){ cin >> l >> r; if(l < r){ s1 = s.substr(0,l - 1); s2 = s.substr(r); int p = r - l; s3 = s.substr(l,p); s3 =s3 + s[l - 1]; s = s1 + s3 + s2; } else if(r < l){ s1 = s.substr(0,r - 1); s2 = s.substr(l); int p = l - r; s3 = s.substr(r - 1,p); s3 =s[l - 1] + s3; s = s1 + s3 + s2; } } else{ cin >> l; cout << s[l - 1] << endl; } } return 0; }

Compilation message (stderr)

collider.cpp:8:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...