Task: | Merkkijono |
Sender: | Katajisto |
Submission time: | 2018-10-15 12:09:45 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
#4 | TIME LIMIT EXCEEDED | -- | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:17:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 1; i < s.length(); i++) { ~~^~~~~~~~~~~~
Code
#include<bits/stdc++.h> using namespace std; int main() { vector<int> mov; string s; cin >> s; string ss = s; sort(ss.begin(), ss.end()); while(true) { if(s == ss) break; if(s[0] < s[1] && !(s[0] == 'Z' && s[1] == 'A')) { swap(s[0],s[1]); mov.push_back(1); } if(s == ss) break; char buff = s[0]; for(int i = 1; i < s.length(); i++) { s[i-1] = s[i]; } s[s.length()-1] = buff; mov.push_back(0); } cout << mov.size() << "\n"; for(int i : mov) { if(i == 0) cout << "MOVE" << "\n"; else cout << "SWAP" << "\n"; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
correct output |
---|
0 |
user output |
---|
0 |
Test 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
ZYXWVUTSRQPONMLKJIHGFEDCBA |
correct output |
---|
923 MOVE MOVE SWAP MOVE ... |
user output |
---|
(empty) |
Test 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
RPJMFWBHYQOTXUAENLDGZISCVK |
correct output |
---|
611 SWAP MOVE MOVE SWAP ... |
user output |
---|
(empty) |
Test 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
GWJSPBHANMXYFLKIDORVUCEZQT |
correct output |
---|
659 MOVE SWAP MOVE SWAP ... |
user output |
---|
(empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
BJYNFLKEIUCZMQHRAXOGWPSDTV |
correct output |
---|
624 MOVE SWAP MOVE SWAP ... |
user output |
---|
(empty) |