Task: | Merkkijono |
Sender: | Ilmari2000 |
Submission time: | 2018-01-18 15:46:41 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.04 s | details |
#2 | WRONG ANSWER | 0.04 s | details |
#3 | WRONG ANSWER | 0.04 s | details |
#4 | WRONG ANSWER | 0.04 s | details |
#5 | WRONG ANSWER | 0.04 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:37: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<int> coms; bool loop = true; while(loop) { loop = false; int m = 0; for(int i = 0; i < 25; i++) { if(str[i] > str[i + 1]) { for(int j = 0; j < 25 - m; j++) coms.push_back(2); swap(str[i], str[i + 1]); loop = true; coms.push_back(1); m = 0; } else m++; } } cout << coms.size() << endl; for(int i = 0; i < coms.size(); i++) { cout << (coms[i] == 1 ? "SWAP" : "MOVE") << endl; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
correct output |
---|
0 |
user output |
---|
0 |
Test 2
Verdict: WRONG ANSWER
input |
---|
ZYXWVUTSRQPONMLKJIHGFEDCBA |
correct output |
---|
923 MOVE MOVE SWAP MOVE ... |
user output |
---|
8450 MOVE MOVE MOVE MOVE ... |
Test 3
Verdict: WRONG ANSWER
input |
---|
RPJMFWBHYQOTXUAENLDGZISCVK |
correct output |
---|
611 SWAP MOVE MOVE SWAP ... |
user output |
---|
4314 MOVE MOVE MOVE MOVE ... |
Test 4
Verdict: WRONG ANSWER
input |
---|
GWJSPBHANMXYFLKIDORVUCEZQT |
correct output |
---|
659 MOVE SWAP MOVE SWAP ... |
user output |
---|
3593 MOVE MOVE MOVE MOVE ... |
Test 5
Verdict: WRONG ANSWER
input |
---|
BJYNFLKEIUCZMQHRAXOGWPSDTV |
correct output |
---|
624 MOVE SWAP MOVE SWAP ... |
user output |
---|
3285 MOVE MOVE MOVE MOVE ... |