Task: | Babaza Game |
Sender: | user1111 |
Submission time: | 2024-09-02 17:47:32 +0300 |
Language: | C++ (C++20) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | ACCEPTED | 0.01 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | ACCEPTED | 0.00 s | details |
#12 | ACCEPTED | 0.00 s | details |
#13 | ACCEPTED | 0.00 s | details |
#14 | ACCEPTED | 0.00 s | details |
Compiler report
input/code.cpp: In function 'bool babaza(std::string)': input/code.cpp:5:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 5 | for (int i = 0; i < a.length()-1; i++) { | ~~^~~~~~~~~~~~~~ input/code.cpp: In function 'int main()': input/code.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 17 | for (int i = 0; i < a.length(); i++) { | ~~^~~~~~~~~~~~
Code
#include <bits/stdc++.h> using namespace std; bool babaza(string a) { for (int i = 0; i < a.length()-1; i++) { if (a[i] == a[i+1]) return false; } return true; } int main() { string a,b; cin >> a >> b; string absdiff = a; string ldiff = a, rdiff = a; for (int i = 0; i < a.length(); i++) { absdiff[i] = b[i] != a[i]; if (i%2) { ldiff[i] = b[i]; } else { rdiff[i] = b[i]; } } if (babaza(absdiff)) { cout << a << '\n'; cout << b << '\n'; return 0; } if (babaza(ldiff)) { cout << a << '\n'; cout << ldiff << '\n'; cout << b << '\n'; return 0; } if (babaza(rdiff)) { cout << a << '\n'; cout << rdiff << '\n'; cout << b << '\n'; return 0; } set<char> used = {}; for (unsigned i = 0; i < a.length(); i++) { used.insert(a[i]); used.insert(b[i]); } char unused = 'A'; for (;;unused++) { if (!(used.contains(unused))) { break; } } cout << a << '\n'; for (unsigned i = 0; i < a.length(); i++) { if (i%2) { ldiff[i] = unused; } } cout << ldiff << '\n'; for (unsigned i = 0; i < a.length(); i++) { if (!(i%2)) { ldiff[i] = b[i]; } } cout << ldiff << '\n'; cout << b << '\n'; return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
A B |
correct output |
---|
A B |
user output |
---|
A B |
Test 2
Verdict: ACCEPTED
input |
---|
BABAZA BACBCB |
correct output |
---|
BABAZA BACACA BACBCB |
user output |
---|
BABAZA BACACA BACBCB |
Test 3
Verdict: ACCEPTED
input |
---|
AB BA |
correct output |
---|
AB CB CA BA |
user output |
---|
AB AC BC BA |
Test 4
Verdict: ACCEPTED
input |
---|
ABC BCD |
correct output |
---|
ABC DBD DCD BCD |
user output |
---|
ABC AEC BED BCD |
Test 5
Verdict: WRONG ANSWER
input |
---|
AXYB CXYD |
correct output |
---|
AXYB CXYD |
user output |
---|
AXYB AXYD CXYD |
Test 6
Verdict: ACCEPTED
input |
---|
LMIJLF PAQBMH |
correct output |
---|
LMIJLF PMQJMF PAQBMH |
user output |
---|
LMIJLF LAIBLH PAQBMH |
Test 7
Verdict: ACCEPTED
input |
---|
PNIWLSLIH CRLVPUFHD |
correct output |
---|
PNIWLSLIH CNLWPSFID CRLVPUFHD |
user output |
---|
PNIWLSLIH CNLWPSFID CRLVPUFHD |
Test 8
Verdict: ACCEPTED
input |
---|
ZDYIAVTKL ZJKVXGAUM |
correct output |
---|
ZDYIAVTKL ZJYVAGTUL ZJKVXGAUM |
user output |
---|
ZDYIAVTKL ZJYVAGTUL ZJKVXGAUM |
Test 9
Verdict: ACCEPTED
input |
---|
FBIXISJH NXZIESMG |
correct output |
---|
FBIXISJH NBZXESMH NXZIESMG |
user output |
---|
FBIXISJH NBZXESMH NXZIESMG |
Test 10
Verdict: ACCEPTED
input |
---|
OPGW QJIE |
correct output |
---|
OPGW QPIW QJIE |
user output |
---|
OPGW OJGE QJIE |
Test 11
Verdict: ACCEPTED
input |
---|
DUKNPKQZBL NZPBMOEBIC |
correct output |
---|
DUKNPKQZBL NUPNMKEZIL NZPBMOEBIC |
user output |
---|
DUKNPKQZBL NUPNMKEZIL NZPBMOEBIC |
Test 12
Verdict: ACCEPTED
input |
---|
ZWDTX HZOXI |
correct output |
---|
ZWDTX HWOTI HZOXI |
user output |
---|
ZWDTX HWOTI HZOXI |
Test 13
Verdict: ACCEPTED
input |
---|
URJF ITIQ |
correct output |
---|
URJF IRIF ITIQ |
user output |
---|
URJF UTJQ ITIQ |
Test 14
Verdict: ACCEPTED
input |
---|
WYWBWU IRYVBA |
correct output |
---|
WYWBWU WRWVWA IRYVBA |
user output |
---|
WYWBWU WRWVWA IRYVBA |