CSES - Datatähti 2018 loppu - Results
Submission details
Task:Merkkijono
Sender:inv41idu53rn4m3
Submission time:2018-01-18 13:32:02 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.05 sdetails
#20.20 sdetails
#30.21 sdetails
#40.23 sdetails
#50.19 sdetails

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:

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:

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:

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:

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)