| Task: | Merkkijono |
| Sender: | Katajisto |
| Submission time: | 2018-01-18 17:09:55 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.03 s | details |
| #2 | WRONG ANSWER | 0.03 s | details |
| #3 | WRONG ANSWER | 0.04 s | details |
| #4 | WRONG ANSWER | 0.04 s | details |
| #5 | WRONG ANSWER | 0.04 s | details |
Compiler report
input/code.cpp: In function 'bool order(std::string)':
input/code.cpp:5:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < s.length(); i++)
^
input/code.cpp: In function 'std::string to(std::string)':
input/code.cpp:16:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < s.length(); i++)
^
input/code.cpp: In function 'int main()':
input/code.cpp:34:16: warning: the address of 'bool order(std::string)' will always evaluate as 'true' [-Waddress]
while(!order)
^
input/code.cpp:31:7: warning: unused variable 'last' [-Wunused-variable]
bool last = false;
^
input/code.cpp:32:6: warning: unused variable 'counter' [-Wunused-variable]
int counter = 0;
^
input/code.cpp:33:14: warning: unused variable 'tohave' [-Wunused-variable]
char tohave = 'A';
^Code
#include<bits/stdc++.h>
using namespace std;
bool order(string s)
{
for(int i = 1; i < s.length(); i++)
{
if(s[i-1] > s[i]) return false;
}
return true;
}
string to(string s)
{
char last = s[s.length()-1];
char temp = s[0];
s[0] = last;
for(int i = 1; i < s.length(); i++)
{
char tt = s[i];
s[i] = temp;
temp = tt;
}
return s;
}
int main()
{
// cout << abs('A' - 'B') << "\n";
// cout << abs('A' - 'C') << "\n";
vector<string> move;
string s; cin >> s;
srand(time(NULL));
bool last = false;
int counter = 0;
char tohave = 'A';
while(!order)
{
int x = rand() % 6;
if(x < 4)
{
for(int i = 0; i < x; i++)
{
move.push_back("MOVE");
s = to(s);
}
}
if(x > 3)
{
if(s[1] < s[0])
{
char ttt = s[1];
s[1] = s[0];
s[0] = ttt;
}
}
}
cout << move.size() << "\n";
for(string s : move)
{
cout << s << "\n";
}
}
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| ABCDEFGHIJKLMNOPQRSTUVWXYZ |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| ZYXWVUTSRQPONMLKJIHGFEDCBA |
| correct output |
|---|
| 923 MOVE MOVE SWAP MOVE ... |
| user output |
|---|
| 0 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| RPJMFWBHYQOTXUAENLDGZISCVK |
| correct output |
|---|
| 611 SWAP MOVE MOVE SWAP ... |
| user output |
|---|
| 0 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| GWJSPBHANMXYFLKIDORVUCEZQT |
| correct output |
|---|
| 659 MOVE SWAP MOVE SWAP ... |
| user output |
|---|
| 0 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| BJYNFLKEIUCZMQHRAXOGWPSDTV |
| correct output |
|---|
| 624 MOVE SWAP MOVE SWAP ... |
| user output |
|---|
| 0 |
