Task: | Merkkijono |
Sender: | siirikuoppala |
Submission time: | 2018-01-18 13:41:46 +0200 |
Language: | C++ |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | ACCEPTED | 0.06 s | details |
#3 | ACCEPTED | 0.03 s | details |
#4 | ACCEPTED | 0.04 s | details |
#5 | ACCEPTED | 0.04 s | details |
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define N (1<<20) ll t[N], V1[N], V2[N]; vector<int> v; int main(){ string s; cin >> s; char a = 'Z'; --a; while(a != 'A'-1){ // max 26 while(s[0] != a) { s = s[25] + s.substr(0, 25); // max 26 v.push_back(1); } while(s[1] != a+1) { // max 26 s = s[25] + s.substr(0, 25); // 1 v.push_back(1); swap(s[0], s[1]); // 1 v.push_back(0); } --a; } cout << v.size() << "\n"; for(int i : v){ if(i) cout << "MOVE\n"; else 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 |
---|
925 MOVE MOVE MOVE MOVE ... |
Test 3
Verdict: ACCEPTED
input |
---|
RPJMFWBHYQOTXUAENLDGZISCVK |
correct output |
---|
611 SWAP MOVE MOVE SWAP ... |
user output |
---|
967 MOVE MOVE MOVE MOVE ... |
Test 4
Verdict: ACCEPTED
input |
---|
GWJSPBHANMXYFLKIDORVUCEZQT |
correct output |
---|
659 MOVE SWAP MOVE SWAP ... |
user output |
---|
965 MOVE MOVE MOVE MOVE ... |
Test 5
Verdict: ACCEPTED
input |
---|
BJYNFLKEIUCZMQHRAXOGWPSDTV |
correct output |
---|
624 MOVE SWAP MOVE SWAP ... |
user output |
---|
972 MOVE MOVE MOVE MOVE ... |