Submission #90096

#TimeUsernameProblemLanguageResultExecution timeMemory
90096YottaByteCollider (IZhO11_collider)C++14
0 / 100
2040 ms8160 KiB
#include <iostream> using namespace std; #define pb push_back #define mk make_pair #define fr first #define sc second main() { int n, q; cin >> n >> q; string s; cin >> s; while(q--) { char t; cin >> t; if(t == 'q') { int k; cin >> k; cout << s[k - 1] << endl; } else { int l, r; cin >> l >> r; l--; r--; char x = s[l]; if(l < r) { //cout << x << " " << l << " " << r << endl; s = s.substr(0, l) + s.substr(l + 1, abs(r - l)) + x + s.substr(r + 1, s.size() - r); } else { s = s.substr(0, r) + x + s.substr(r, abs(r - l)) + s.substr(l + 1, s.size() - l); } } //cout << s << endl; } } /* 14 3 xxyxyzxxzxzyyzy xxyxyzxxzxzyyzy */

Compilation message (stderr)

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