Task: | Reversals |
Sender: | djbb |
Submission time: | 2016-09-17 14:22:09 +0300 |
Language: | C++ |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <algorithm> #include <iostream> #include <string> int main(){ using namespace std; ios::sync_with_stdio(0); int n, m; cin >> n >> m; string word = ""; getline(cin, word); //consume newline getline(cin, word); for(;m>0; m--){ int a, b; cin >> a >> b; a--; b--; while(a < b){ char temp = word[a]; word[a] = word[b]; word[b] = temp; a++; b--; } } cout << word << "\n"; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
50 100 pplcmurzajsxlqqcrxewfhzqyihkzp... |
correct output |
---|
fpuwlmatkzbhksppmjxpwurcvsdxcz... |
user output |
---|
fpuwlmatkzbhksppmjxpwurcvsdxcz... |
Test 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
500000 100000 slsmyuezdrenskmgkwxpcfzistssmu... |
correct output |
---|
slsmyuezvdfzhssyoofpsnsagrrzri... |
user output |
---|
(empty) |