Task: | Palindrome |
Sender: | Maxim |
Submission time: | 2016-10-22 13:48:56 +0300 |
Language: | C++ |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
#3 | WRONG ANSWER | 0.09 s | details |
#4 | WRONG ANSWER | 0.07 s | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
#7 | TIME LIMIT EXCEEDED | -- | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:19:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while(j < str.length()) { ^ input/code.cpp:32:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while(j < str.length()) { ^
Code
#include <iostream> #include <string> #define _ ios_base::sync_with_stdio(0); using namespace std; int main() { string str; cin >> str; //its 0010 if %2 == 0 , else 010; int j = str.length()/2; string endstr = ""; if(str.length() % 2== 0 ) { int opposite = j - 1; while(j < str.length()) { if(str.at(j) == str.at(opposite)) { endstr = str.at(opposite) + endstr + str.at(j); } else { break; } j ++; opposite --; } } else { endstr = endstr + str.at(j); int opposite = j - 1; j = j + 1; while(j < str.length()) { if(str.at(j) == str.at(opposite)) { endstr = str.at(opposite) + endstr + str.at(j); } else { break; } j ++; } } cout << endstr; };
Test details
Test 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
correct output |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
user output |
---|
(empty) |
Test 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
saippuakauppiassaippuakauppias... |
correct output |
---|
saippuakauppiassaippuakauppias... |
user output |
---|
(empty) |
Test 3
Verdict: WRONG ANSWER
input |
---|
yfsnqpzfxfhdnbozewnjtseeyktblk... |
correct output |
---|
buevzveub |
user output |
---|
(empty) |
Test 4
Verdict: WRONG ANSWER
input |
---|
oyyahdsjdwtziuwnmpjhshemvxodtc... |
correct output |
---|
rrfaxafuttsospqnxbwaufpchwjaha... |
user output |
---|
(empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
tcaxtmkrvjovwnhsqquwxuemckkmks... |
correct output |
---|
xtmkrvjovwnhsqquwxuemckkmksqqj... |
user output |
---|
(empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
mwuepokhcaykorctrxqvplhxbxjndd... |
correct output |
---|
eyexbstwynwjbqjasyuaqrmckrgmki... |
user output |
---|
(empty) |
Test 7
Verdict: TIME LIMIT EXCEEDED
input |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
correct output |
---|
bcbcbcbcbcbcbcbcbcbcbcbcbcbcbc... |
user output |
---|
(empty) |