Task: | Merkkijono |
Sender: | Ilmari2000 |
Submission time: | 2018-01-18 12:29:52 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
#4 | TIME LIMIT EXCEEDED | -- | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:31:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 1; i < str.size(); i++) ^ input/code.cpp:42:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < coms.size(); i++) ^
Code
#include <iostream>#include <vector>using namespace std;int main(){string str;cin >> str;vector<string> coms;bool nb = true;while(nb){if(str[0] > str[1]){coms.push_back("SWAP");char tmp = str[0];str[0] = str[1];str[1] = tmp;}else{str = str[str.size() - 1] + str;str.resize(str.size() - 1);coms.push_back("MOVE");}nb = false;for(int i = 1; i < str.size(); i++){if(str[i-1] > str[i]){nb = true;break;}}}cout << coms.size() << endl;for(int i = 0; i < coms.size(); i++)cout << coms[i] << endl;}
Test details
Test 1
Verdict: ACCEPTED
input |
---|
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
correct output |
---|
0 |
user output |
---|
50 MOVE SWAP MOVE SWAP ... |
Test 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
ZYXWVUTSRQPONMLKJIHGFEDCBA |
correct output |
---|
923 MOVE MOVE SWAP MOVE ... |
user output |
---|
(empty) |
Test 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
RPJMFWBHYQOTXUAENLDGZISCVK |
correct output |
---|
611 SWAP MOVE MOVE SWAP ... |
user output |
---|
(empty) |
Test 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
GWJSPBHANMXYFLKIDORVUCEZQT |
correct output |
---|
659 MOVE SWAP MOVE SWAP ... |
user output |
---|
(empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
BJYNFLKEIUCZMQHRAXOGWPSDTV |
correct output |
---|
624 MOVE SWAP MOVE SWAP ... |
user output |
---|
(empty) |