Task: | Merkkijono |
Sender: | tuomask |
Submission time: | 2018-01-18 12:56:20 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | |
---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | 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:25:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i=0; i<s.length() && !jatka; i++) if (s[get(i)] != oik[i]) jatka=true; ^
Code
#include <bits/stdc++.h> using namespace std; string s; vector<string> si; int pos=0; int get(int i) { i += pos; i = i % s.length(); return i; } int main() { cin >> s; bool jatka=true; while (jatka) { if (s[get(0)] > s[get(1)]) { swap(s[get(0)], s[get(1)]); si.push_back("SWAP"); } si.push_back("MOVE"); pos--; if (pos < 0) pos = s.length()-1; string oik="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; jatka = false; for (int i=0; i<s.length() && !jatka; i++) if (s[get(i)] != oik[i]) jatka=true; } cout << si.size() << "\n"; for (auto it=si.begin(); it!=si.end(); it++) cout << *it << "\n"; }
Test details
Test 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
correct output |
---|
0 |
user output |
---|
(empty) |
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) |