CSES - Datatähti 2018 loppu - Results
Submission details
Task:Merkkijono
Sender:nokka7
Submission time:2018-01-18 13:09:05 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.05 sdetails
#20.05 sdetails
#30.04 sdetails
#40.04 sdetails
#50.03 sdetails

Code

#include <bits/stdc++.h>
using namespace std;
int t[101010]={0};
int c, e;

string s;
char a, b, d;

int main() {
	c=0;
	cin >> s;
	while (true) {
		if (s[0]>s[1]) {
		if ((s[0]!='Z') &&(s[1]!='Z')) {
			t[c]=0;
			a=s[1]; b=s[0];
			s[0]=a; s[1]=b;
			goto tassa;
		}
		}
	d=s[0];
	s[0]=s[25];
	t[c]=1;
	for (int i=1; i<25; i++) {
		d=s[i];
		s[i+1]=d;
}
	e=0;
	for (int i=0; i<25; i++) {
		if (s[i]>s[i+1]) goto tassa;
}
	break;
	tassa:;
	c++;
	}
	c+=1;
	cout << c << "\n";
	for (int i=0; i<c; i++) {
		if (t[i]==1) { cout << "MOVE" << "\n"; continue;}
		cout << "SWAP" << "\n";
}
}

Test details

Test 1

Verdict:

input
ABCDEFGHIJKLMNOPQRSTUVWXYZ

correct output
0

user output
2
MOVE
MOVE

Test 2

Verdict:

input
ZYXWVUTSRQPONMLKJIHGFEDCBA

correct output
923
MOVE
MOVE
SWAP
MOVE
...

user output
1
MOVE

Test 3

Verdict:

input
RPJMFWBHYQOTXUAENLDGZISCVK

correct output
611
SWAP
MOVE
MOVE
SWAP
...

user output
2
SWAP
MOVE

Test 4

Verdict:

input
GWJSPBHANMXYFLKIDORVUCEZQT

correct output
659
MOVE
SWAP
MOVE
SWAP
...

user output
1
MOVE

Test 5

Verdict:

input
BJYNFLKEIUCZMQHRAXOGWPSDTV

correct output
624
MOVE
SWAP
MOVE
SWAP
...

user output
3
MOVE
SWAP
MOVE