Task: | Reversals |
Sender: | MacAnton |
Submission time: | 2016-09-17 15:01:21 +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 <iostream> #include <string> #include <stdio.h> int main() { using namespace std; int n = 0; int m = 0; cin >> n >> m; string ln; getline(cin, ln); getline(cin, ln); for (int i = 0; i < m; i++) { int a; int b; cin >> a >> b; a--; b--; char tmp = ' '; for (int j = a; j <= (b + a)/2; j++) { tmp = ln[j]; ln[j] = ln[b - (j - a)]; ln[b - (j - a)] = tmp; } } cout << ln << endl; return 0; }
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) |