CSES - Datatähti 2018 loppu - Results
Submission details
Task:Merkkijono
Sender:nokka7
Submission time:2018-01-18 14:19:02 +0200
Language:C++
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.05 sdetails
#2ACCEPTED0.03 sdetails
#3ACCEPTED0.05 sdetails
#4ACCEPTED0.05 sdetails
#5ACCEPTED0.04 sdetails

Code

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

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++) {
		f=s[i];
		s[i]=d;
		d=f;
}
	s[25]=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";
	if (c==0) {cout << "0";} else {
	for (int i=0; i<c; i++) {
		if (t[i]==1) { cout << "MOVE" << "\n"; continue;}
		cout << "SWAP" << "\n";
}
}
}

Test details

Test 1

Verdict: ACCEPTED

input
ABCDEFGHIJKLMNOPQRSTUVWXYZ

correct output
0

user output
26
MOVE
MOVE
MOVE
MOVE
...

Test 2

Verdict: ACCEPTED

input
ZYXWVUTSRQPONMLKJIHGFEDCBA

correct output
923
MOVE
MOVE
SWAP
MOVE
...

user output
923
MOVE
MOVE
SWAP
MOVE
...

Test 3

Verdict: ACCEPTED

input
RPJMFWBHYQOTXUAENLDGZISCVK

correct output
611
SWAP
MOVE
MOVE
SWAP
...

user output
611
SWAP
MOVE
MOVE
SWAP
...

Test 4

Verdict: ACCEPTED

input
GWJSPBHANMXYFLKIDORVUCEZQT

correct output
659
MOVE
SWAP
MOVE
SWAP
...

user output
659
MOVE
SWAP
MOVE
SWAP
...

Test 5

Verdict: ACCEPTED

input
BJYNFLKEIUCZMQHRAXOGWPSDTV

correct output
624
MOVE
SWAP
MOVE
SWAP
...

user output
624
MOVE
SWAP
MOVE
SWAP
...