Task: | Babaza Game |
Sender: | bielaltes |
Submission time: | 2024-09-02 17:49:51 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | RUNTIME ERROR |
test | verdict | time | |
---|---|---|---|
#1 | RUNTIME ERROR | 0.67 s | details |
#2 | RUNTIME ERROR | 0.80 s | details |
#3 | RUNTIME ERROR | 0.76 s | details |
#4 | RUNTIME ERROR | 0.77 s | details |
#5 | RUNTIME ERROR | 0.78 s | details |
#6 | RUNTIME ERROR | 0.80 s | details |
#7 | RUNTIME ERROR | 0.84 s | details |
#8 | RUNTIME ERROR | 0.84 s | details |
#9 | RUNTIME ERROR | 0.82 s | details |
#10 | RUNTIME ERROR | 0.78 s | details |
#11 | RUNTIME ERROR | 0.86 s | details |
#12 | RUNTIME ERROR | 0.78 s | details |
#13 | RUNTIME ERROR | 0.79 s | details |
#14 | RUNTIME ERROR | 0.80 s | details |
Compiler report
input/code.cpp: In function 'std::vector<std::__cxx11::basic_string<char> > change(std::string, std::string, int)': input/code.cpp:16:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 16 | for (int i = 0; i < aux.size(); ++i){ | ~~^~~~~~~~~~~~ input/code.cpp:19:55: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 19 | if (i > 0 && aux[i-1] != desired && i < aux.size()-1 && aux[i+1] != desired) | ~~^~~~~~~~~~~~~~ input/code.cpp: In function 'int main()': input/code.cpp:38:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'}...
Code
using namespace std; #include <iostream> #include <string> #include <queue> #include <vector> #include <algorithm> #include <set> vector<string> change(string a, string b, int n){ string aux = a; vector<string> res; res.push_back(a); while (res.back() != b){ for (int i = 0; i < aux.size(); ++i){ if (i % 2 == n % 2){ char desired = b[i]; if (i > 0 && aux[i-1] != desired && i < aux.size()-1 && aux[i+1] != desired) aux[i] = desired; } } res.push_back(aux); ++n; } return res; } int main() { string a, b; cin >> a >> b; vector<string> v1 = change(a, b, 0); vector<string> v2 = change(a, b, 1); if (v1.size() < v2.size()){ for (int i = 0; i< v1.size(); ++i) cout << v1[i] << endl; } else{ for (int i = 0; i< v2.size(); ++i) cout << v2[i] << endl; } }
Test details
Test 1
Verdict: RUNTIME ERROR
input |
---|
A B |
correct output |
---|
A B |
user output |
---|
(empty) |
Test 2
Verdict: RUNTIME ERROR
input |
---|
BABAZA BACBCB |
correct output |
---|
BABAZA BACACA BACBCB |
user output |
---|
(empty) |
Test 3
Verdict: RUNTIME ERROR
input |
---|
AB BA |
correct output |
---|
AB CB CA BA |
user output |
---|
(empty) |
Test 4
Verdict: RUNTIME ERROR
input |
---|
ABC BCD |
correct output |
---|
ABC DBD DCD BCD |
user output |
---|
(empty) |
Test 5
Verdict: RUNTIME ERROR
input |
---|
AXYB CXYD |
correct output |
---|
AXYB CXYD |
user output |
---|
(empty) |
Test 6
Verdict: RUNTIME ERROR
input |
---|
LMIJLF PAQBMH |
correct output |
---|
LMIJLF PMQJMF PAQBMH |
user output |
---|
(empty) |
Test 7
Verdict: RUNTIME ERROR
input |
---|
PNIWLSLIH CRLVPUFHD |
correct output |
---|
PNIWLSLIH CNLWPSFID CRLVPUFHD |
user output |
---|
(empty) |
Test 8
Verdict: RUNTIME ERROR
input |
---|
ZDYIAVTKL ZJKVXGAUM |
correct output |
---|
ZDYIAVTKL ZJYVAGTUL ZJKVXGAUM |
user output |
---|
(empty) |
Test 9
Verdict: RUNTIME ERROR
input |
---|
FBIXISJH NXZIESMG |
correct output |
---|
FBIXISJH NBZXESMH NXZIESMG |
user output |
---|
(empty) |
Test 10
Verdict: RUNTIME ERROR
input |
---|
OPGW QJIE |
correct output |
---|
OPGW QPIW QJIE |
user output |
---|
(empty) |
Test 11
Verdict: RUNTIME ERROR
input |
---|
DUKNPKQZBL NZPBMOEBIC |
correct output |
---|
DUKNPKQZBL NUPNMKEZIL NZPBMOEBIC |
user output |
---|
(empty) |
Test 12
Verdict: RUNTIME ERROR
input |
---|
ZWDTX HZOXI |
correct output |
---|
ZWDTX HWOTI HZOXI |
user output |
---|
(empty) |
Test 13
Verdict: RUNTIME ERROR
input |
---|
URJF ITIQ |
correct output |
---|
URJF IRIF ITIQ |
user output |
---|
(empty) |
Test 14
Verdict: RUNTIME ERROR
input |
---|
WYWBWU IRYVBA |
correct output |
---|
WYWBWU WRWVWA IRYVBA |
user output |
---|
(empty) |