Task: | Merkkijono |
Sender: | inv41idu53rn4m3 |
Submission time: | 2018-01-18 13:32:02 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | RUNTIME ERROR | 0.20 s | details |
#3 | RUNTIME ERROR | 0.21 s | details |
#4 | RUNTIME ERROR | 0.23 s | details |
#5 | RUNTIME ERROR | 0.19 s | details |
Code
#include <iostream> using namespace std; int main() { int k = 0; bool* s = new bool[1 << 17]; string c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string d; cin >> d; while (d != c) { char a = d[0]; if (d[0] > d[1]) { s[k++] = true; d[0] = d[1]; d[1] = a; } else { s[k++] = false; d = d.substr(1); d[25] = a; } } cout << k << "\n"; for (int i = 0; i < k; i++) { if (s[k]) { cout << "SWAP\n"; } else { cout << "MOVE\n"; } } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
correct output |
---|
0 |
user output |
---|
0 |
Test 2
Verdict: RUNTIME ERROR
input |
---|
ZYXWVUTSRQPONMLKJIHGFEDCBA |
correct output |
---|
923 MOVE MOVE SWAP MOVE ... |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 1) > this->size() (which is 0)
Test 3
Verdict: RUNTIME ERROR
input |
---|
RPJMFWBHYQOTXUAENLDGZISCVK |
correct output |
---|
611 SWAP MOVE MOVE SWAP ... |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 1) > this->size() (which is 0)
Test 4
Verdict: RUNTIME ERROR
input |
---|
GWJSPBHANMXYFLKIDORVUCEZQT |
correct output |
---|
659 MOVE SWAP MOVE SWAP ... |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 1) > this->size() (which is 0)
Test 5
Verdict: RUNTIME ERROR
input |
---|
BJYNFLKEIUCZMQHRAXOGWPSDTV |
correct output |
---|
624 MOVE SWAP MOVE SWAP ... |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 1) > this->size() (which is 0)